wytten
1
I’m reviving an Electric Imp project that previously worked with xively.com.
The agent code that was working looks like:
local request = http.put(xively_url, {"X-ApiKey":API_KEY, "Content-Type":"text/csv", "User-Agent":"Xively-Imp-Lib/1.0"}, feedCSV);
Can I post data in a similar way to thinger.io?
Hi, you will need to create an HTTP device in the platform. In the Callback
section of the device, you will see details for sending information, i.e.:
curl \
-H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9......." \
-H "Accept: application/json, text/plain, */*" \
-X POST \
-d '{"lat":40.416775,"lng":-3.70379,"temperature":23.33,"humidity":32.44}' \
https://backend.thinger.io/v3/users/alvarolb/devices/GeofenceTest/callback/data
So, your request should be something like this (adapting your username, device id, bearer, etc)…:
local request = http.post("http://backend.thinger.io/v3/users/alvarolb/devices/GeofenceTest/callback/data", {"Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9......." , "Content-Type":"application/json", "User-Agent":"Xively-Imp-Lib/1.0"}, yourJson);