Writes the records of data from the thing to the specified THING_TOKEN. Only alphanumeric characters and ".", "-", "" symbols are admited for the resource name "key".
Remember to replace THING_TOKEN with the thing token that you got when you activated your thing.
curl -i -H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{ "values": [ { "key": "fun", "value": "5000" } ] }'
\
-X POST "https://api.thethings.io/v2/things/THING_TOKEN" -k
Geolocation
If your thing can change its location you can geolocate your values adding the geo parameter in the body:
{
"values":
[{
"key": "my-geolocated-key",
"value" : 23,
"geo" : {
"lat" : 41.4121132,
"long" : 2.2199454
}
}]
}
Custom Timestamp
When thethings.iO receives a value, it also stores the current date and time in UTC format. But sometimes your thing can't or you do not want it to send the values at the time the sensor reading was done (i.e. your thing doesn't have connectivity or you want to save battery). To solve this use case, you can send a batch of values and indicate the time on each. The values don't need to be sorted by time, they will be sorted by our storage system automatically. The format is YYYYMMDDHHmmss. Notice thethings.iO considers all times to be in UTC.
{
"values":
[{
"key": "my-batch-key",
"value" : 23,
"datetime" : "20150520130000"
},
{
"key": "my-batch-key",
"value" : 24,
"datetime" : "20150520140000"
},
{
"key": "my-batch-key",
"value" : 25,
"datetime" : "20150520150000"
},
{
"key": "my-batch-key",
"value" : 22,
"datetime" : "20150520120000"
}]
}
You can get the server time by calling:
GET https://api.thethings.io/v2/utils/date?thingToken=THING_TOKEN&format=FORMAT
Where FORMAT can be UTC (default) or unix_timestamp