Ubidots Posting GPS data via Particle Webhook


#1

Hello,

I am attempting to post ‘automatic’ GPS information to my Ubidots device via a Webhook with my Particle Electron. My device will be moving and not a static location.

The hook response says I am not posting the correct data through the webhook.

I have setup a variable position that outputs GPS coordinates formatted as follows (example data):

EVENT NAME:
position

DATA:
lat: 41.8781, lon: 87.6298

Ubidots kicks it back saying the data is not usable. However, I do see the variable “position” at my device which means the webhook is connecting. There is not any data being shown at the variable.

Any suggestions on how to accomplish this?


#2

Greetings, please make sure that your payload is being built as follows:

{"position": {"value": 1, "context":{"lat": 41.8781, "lng": 87.6298}}}

The value can be any number, and the lat and long should be inside the context.

All the best


#3

Here is the string I’m trying to use to output to the cloud

String location = String::format("{“value”: 1, “context” : {“lat”: %f, “lng”: %f}}}", t.readLatDeg(), t.readLonDeg());

Here is the particle call to action to publish the event "position"

Particle.publish(“location”, location, 60, PRIVATE);

Here is the event being published

location

Here is the data being published

{“value”: 1, “context” : {“lat”: 0.000000, “lng”: 0.000000}}}

Here is what the webhook returns

status_code: 400, errors {value: [A valid number is required.


#4

Greetings, I see an additional curly bracket, ‘}’, at the end of the data, can you print the entire payload published? Including also the variable label? A 400 error means that your payload is not valid, so I suspect that it is not being built properly.

All the best