I use the SIM7600 module to post HTTP to Ubidots. I used the Gremlin 2 demo and it works well for one variable. Now, I want to send my position (latitude, longitude) to be shown on the map. In order to do that, I created a new variable called “position”, I copied it’s ID and I try to send the position using these commands:
I am sending {“position”:{“lat”:6.2442, “lng”:-75.5812}} :
You probably took this JSON payload format out this article, but such structure is only available through the /api/v1.6/devices/ endpoint, whereas you’re using the variables endpoint.
With that in mind, here are 2 options that you can choose from to fix the issue:
Adapt you current payload (content-length as well) to what’s expected by the /api/v1.6/variables/{ID}/values/ endpoint:
Leave the payload as is and change to the /api/v1.6/devices/{DEVICE_LABEL}/ endpoint instead. This option I recommend as you’d be using Labels (which are of your choice), as opposite to IDs.
Thank you the second example works. Now I would like to be able to pull the position from Ubidots back to a PC / android app. Do you have an example on how to achieve that?