Upload a Set of Timestamped Data
Last updated
Last updated
You can update a single Datastream with a set of timestamped data points. This can be helpful when you don't stream the data in real-time, but instead, collect it on the device and need to send it periodically as a dataset.
For example, your device can be offline most of the time, but connect periodically and upload a set of data points.
LIMIT: You can send a max of 10,000 data points per day per device. No matter if you split it into multiple sets or send all data once.
This limit can vary based on the plan you are using.
When sending the data you would need to provide a timestamp for each value and send the timestamp and value as a single entry, like this: [[timestamp, value]]
. Where timestamp
is the time difference between the current time and midnight, January 1, 1970 UTC measured in milliseconds.
The timestamp is the same as Unix epoch
or Unix timestamp
multiplied by 1000ms.
LIMIT: timestamps could be only one month in the past. Older timestamps won't be accepted.
The single entry format: [[timestamp, value]]
The full body with multiple entries:[[timestamp1, value1], [timestamp2, value2]]
Content-Type
the header is mandatory and should be set to application/json
Each entry value should respect datastream value type. Thus you have to pass a string for string datastream, true
or false
for boolean datastream, array of two numbers for location datastream.
Example body based on datastream type:
DataStream Value Type | Example |
---|---|
POST
https://{server_address}/external/api/batch/update?token={token}&pin={pin}
Content-Type
header should be set to application/json
Example: https://blynk.cloud/external/api/batch/update?token=bFFtSHNCZZDWQ__Zs96cP5jLMhLoJofg&pin=v1
Post body:
[[1648054765458,1.0],[1648054825459,2.0],[1648054885460,3.0]]
You can get the Device auth token in Device info.
curl -X POST -H 'Content-Type: application/json' -d '[[1650378744000,0]]' -i 'https://blynk.cloud/external/api/batch/update?token=YOUR_TOKEN&pin=v1'
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
String
[[1648054765458,"Some value"],[1648054825459,"Some another value"]]
Integer
[[1648054765458,1],[1648054825459,2]]
Double
[[1648054765458,36.6],[1648054825459,41.2]]
Boolean
[[1648054765458,true],[1648054825459,false]]
Enum
[[1648054765458,1],[1648054825459,2]]
Location ([[ts, [lon, lat]]])
[[1648054765458,[32.123960,49.109466]]]
token
String
Device AuthToken
pin
String
Virtual Pin
Content-Type
String
application/json