... | ... | @@ -202,6 +202,8 @@ The API to be used for pushing this data, lives in another component than the CO |
|
|
Before starting to push Device data into API we need to check that device exists in the platform, see `Creating the entity in the IoT platform` section.
|
|
|
|
|
|
Now, image that you have a data logger that logs temperature and soil_moisture , you have collected some sets and you want to make this data available through the IoT Platform.
|
|
|
|
|
|
|
|
|
Here below we show how to POST **A SINGLE ENTRY OF THE SET** for the date `"2020-10-21T16:16:16.00Z",` this is:
|
|
|
|
|
|
```bash
|
... | ... | @@ -241,22 +243,6 @@ curl --location --request POST 'http://5.53.108.182:8668/v2/notify' \ |
|
|
"value": "2020-10-21T16:16:16.00Z"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
"location": {
|
|
|
"type": "geo:json",
|
|
|
"value": {
|
|
|
"type": "Point",
|
|
|
"coordinates": [
|
|
|
0.0,
|
|
|
0.0
|
|
|
]
|
|
|
},
|
|
|
"metadata": {
|
|
|
"dateModified": {
|
|
|
"type": "DateTime",
|
|
|
"value": "2020-10-21T16:16:16.00Z"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
]
|
... | ... | @@ -276,7 +262,90 @@ The date when the measurment was taken needs to be formatted as: |
|
|
}
|
|
|
|
|
|
```
|
|
|
All fields of the data model need to include this metadata, else, the current time will be used.
|
|
|
NOTE WELL: **All fields of the data model need to include this metadata, else, the current time will be used.**
|
|
|
|
|
|
# 4. How to push all `locally collected` as a batch operation
|
|
|
|
|
|
If you have plenty of records and not just a single one you can add those to the `data` of the HTTP message, e.g. image you have locally collected data each hour.
|
|
|
|
|
|
In the following example we show how to push two registers, one generated at "2020-10-21T16:16:16.00Z" and the other generates at "2020-10-21T17:16:16.00Z". The same thing can be done for any amount of registers, although the amount of data that can be received at the same time is limited by a couple of mega bytes.
|
|
|
We recommend not pushing more than 1000 registers at a time.
|
|
|
|
|
|
```bash
|
|
|
|
|
|
curl --location --request POST 'http://5.53.108.182:8668/v2/notify' \
|
|
|
--header 'Fiware-Service: carouge' \
|
|
|
--header 'Fiware-ServicePath: /' \
|
|
|
--header 'Content-Type: application/json' \
|
|
|
--data-raw '{
|
|
|
"subscriptionId": "5f8f0225da7e7c9ac9757a77",
|
|
|
"data": [
|
|
|
{
|
|
|
"id": "urn:ngsi-ld:Device:Device-test",
|
|
|
"type": "Device",
|
|
|
"value": {
|
|
|
"type": "Array",
|
|
|
"value": [
|
|
|
202.01,
|
|
|
1992
|
|
|
],
|
|
|
"metadata": {
|
|
|
"dateModified": {
|
|
|
"type": "DateTime",
|
|
|
"value": "2020-10-21T16:16:16.00Z"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
"controlledProperty": {
|
|
|
"type": "Array",
|
|
|
"value": [
|
|
|
"soil_moisture",
|
|
|
"temperature"
|
|
|
],
|
|
|
"metadata": {
|
|
|
"dateModified": {
|
|
|
"type": "DateTime",
|
|
|
"value": "2020-10-21T16:16:16.00Z"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
{
|
|
|
"id": "urn:ngsi-ld:Device:Device-test",
|
|
|
"type": "Device",
|
|
|
"value": {
|
|
|
"type": "Array",
|
|
|
"value": [
|
|
|
303.01,
|
|
|
3000
|
|
|
],
|
|
|
"metadata": {
|
|
|
"dateModified": {
|
|
|
"type": "DateTime",
|
|
|
"value": "2020-10-21T17:16:16.00Z"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
"controlledProperty": {
|
|
|
"type": "Array",
|
|
|
"value": [
|
|
|
"soil_moisture",
|
|
|
"temperature"
|
|
|
],
|
|
|
"metadata": {
|
|
|
"dateModified": {
|
|
|
"type": "DateTime",
|
|
|
"value": "2020-10-21T17:16:16.00Z"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
]
|
|
|
}'
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
Getting all historical values of the Device
|
... | ... | |