Accessing Server Data?


#1

I’m successfully posting data using my ESP32, but I cannot figure out how to access that data using Postmaster or something of the like. I’d like my own app to be able to access and display this data in real time.

I’ve tried finagling something with triggers and webhooks but to no avail. Does anyone have suggestions?


#2

you can have a look at this Tutorial Using Postman with Cayenne API or CaySimple - Homemade Android App Demo / Toolkit


#3

Thanks. I’d already read those, I suppose I should have been more specific with my question. I’m hoping for a cleaner solution. In particle I can do a simple GET web request from a link like: https://api.particle.io/v1/devices/310020000b51323432383931/variableName?access_token=df43a6ada43611342c90e3d2c64b920a17f8xx69

Is this not a possibility in Cayenne, and if not does anyone know a platform that perhaps may make this easier? I am just trying to read the data from a Unity application.


#4

Hi there,

We are in the process of modifying the docs, sorry for the inconvenience.

Here’s how you can access your data:

Obtain a JWT token by doing a HTTP POST to auth.mydevices.com, see below:

curl --request POST \
  --url https://auth.mydevices.com/oauth/token \
  --header 'content-type: application/json' \
  --data '{
	"username": "foobar@example.com",
	"password": "password123",
	"grant_type": "password"
}'

Use access_token from authentication response to retrieve latest readings:

curl --request GET \
  --url 'https://platform.mydevices.com/v1.1/telemetry/THING_ID/sensors/SENSOR_ID/summaries?type=latest' \
  --header 'authorization: Bearer access_token'

To get the THING_ID and SENSOR_ID use this request:

curl --request GET \
  --url https://platform.mydevices.com/v1.1/things \
  --header 'authorization: Bearer access_token'

SENSOR_ID is the individual sensor/channel under children collection.

Hope this help.