Hi there!
I am using Particle devices connected through webhooks to Ubidots. I’d like to send more than one data point of the same variable in the same Particle.publish. What is the correct webhook format for this?
Example: If I send only one data point, this is what I have to send the value “3” of the variable “LOAD”:
at firmware: Particle.publish("LOAD","3",PRIVATE,NO_ACK);
the webhook is programmed as per the Ubidots tutorial using the Particle webhook builder creating a template reference like this (omitting the token):
{
"event": "LOAD",
"responseTopic": "{{PARTICLE_DEVICE_ID}}/hook-response/{{PARTICLE_EVENT_NAME}}",
"url": "https://things.ubidots.com/api/v1.6/devices/{{PARTICLE_DEVICE_ID}}/?token=xxxx-xxxxx",
"requestType": "POST",
"noDefaults": true,
"rejectUnauthorized": true,
"form": {
"LOAD": "{{PARTICLE_EVENT_VALUE}}"
},
"errors": []
}
To send 2 or more values of the same variable, I put the values in an array and then use the Particle.Publish at firmware level like this:
Particle.publish("LOAD", String::format("%d,%d", LOAD[0],LOAD[1]));
Monitoring the above Publish in the Particle console, I see something like this (omitting the core id digits):
{"data":"1,2","ttl":60,"published_at":"2018-04-10T13:34:22.126Z","coreid":"xxxxxxxxx", "name": "LOAD"}
If I send 2 data points of the same variable, I’d like to receive and store in Ubidots 2 entries.
Thanks for the help