I'm trying to send time stamped key value pairs to the ThingsBoard Demo platform (demo.thingsboard.io). The standard way is to send a timestamp and with some key-value-pairs like so:
{"ts":1451649600512, "values":{"key1":"value1", "key2":"value2"}}
My problem is, that I need to process up to 100 acceleration measurements per second and I dont want to send a http post for every x-y-z value-package. Is there a way to send one json body with, lets say, 100 timestamps with corresponding measurements?
I tried it:
{
"ts": 1508695100,
"values": {
"key1": 34,
"key2": 26
},
"ts": 1508695200,
"values": {
"key1": 38,
"key2": 29
}
}
There is no error message when pushing this json to ThingsBoard with curl, but only the last timestamp-value-block seems to be recognized by ThingsBoard.
Any suggestions on how to to solve my problem?
You should use following format (json array):
[{"ts":1451649600512, "values":{"key1":"value1", "key2":"value2"}}, {"ts":1451649600513, "values":{"key1":"value1", "key2":"value2"}}]
or
[
{
"ts":1451649600512,
"values":{
"key1":"value1",
"key2":"value2"
}
},
{
"ts":1451649600513,
"values":{
"key1":"value1",
"key2":"value2"
}
}
]
BTW, the JSON you have tried is not a valid JSON document at all. Please check the validity of the document before sending.