Fetching sensor data

Hello, we are currently trying to fetch the data from a sensor via API but we are struggling. We followed the tutorial by @Neoxelox (Cayenne API tutorial for beginners beginners with ai2/thunkable - #2 by rsiegel) though we just created GET and POST requests directly, we didn’t use his specific app example.
It all works well until the part where we actually need to fetch the sensor data.

I used this URL for the GET request: https://platform.mydevices.com/v1.1/telemetry/OUR-DEVICE-ID/sensors/OUR-SENSOR-ID/summaries?type=latest

And also the correct Headers (Authorization and X-API-Version).

The problem is that we always receive:

{
“statusCode”: 404,
“error”: “Not Found”
}

By the way: We are using an Arduino. Does that change anything about the URL parameter “telemetry”?

Any ideas? We could not find any references to this in documentation. Did we miss something?

Could anyone provide a working example (maybe just a curl request)?

Help would be really appreciated.

EDIT :grinning:

OKAY GUYS, we fixed it. Sometimes it’s simple. There was a space in the URL which we missed.

But one question is still up: “I could not find any references to this in documentation. Did we miss something?”

1 Like

API documentation as I know, is not completed, but there are quite a lot things Cayenne Docs

Hello @lukas.mueller,

Can you check this link: GitHub - myDevicesIoT/Cayenne-API-Sample-App

@hcortes

@bestes As we speak about the docs, I just browsed the section “Getting Started”. A lot of links are not working. I mean not links but the #fragments that have to point the users to the related tutorials. For example → Getting Started → Raspberry Pi → Actuators → View LED tutorial → point to nowhere…

2 Likes

I see some of these broken anchors as well. I’ll run through the documentation and make a list for our technical writer to correct, thanks for pointing it out.

1 Like

When I try to GET sensor value using:
https://platform.mydevices.com/v1.1/telemetry/xxxxxxxxxxx/sensors/xxxxxxxxx/summaries?type=latest

I always get:
{
“statusCode”: 404,
“error”: “Not Found”,
“message”: “Not Found”
}

But I can GET things → https://platform.mydevices.com/v1.1/things/

{
“id”: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”,
“name”: “xxxxx”,
“hardware_id”: null,
“user_id”: “xxxxxx”,
“device_type_id”: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxx”,
“created_at”: “2017-09-24T13:31:11.000Z”,
“updated_at”: “2017-09-24T13:31:11.000Z”,
“last_online”: null,
“deactivated_at”: null,
“status”: “ACTIVATED”,
“active”: 1,
“parent_id”: null,
“search_key”: null,
“properties”: {
“device_id”: “xxxxxxxxxxxxxxxxxxxxx”,
“data”: null,
“created_at”: “2017-09-24T13:31:11.000Z”,
“updated_at”: “2017-09-24T13:31:11.000Z”

https://platform.mydevices.com/v1.1/telemetry/xxxx/sensors/xxx/summaries?type=latest
working. Are u using the right headers? authorization and X-API-VERSION?

Now I’m working with a Raspberry Pi and I would like to have the CPU value, what would be the HTTP Request for this?
For the Arduino the: https://platform.mydevices.com/v1.1/telemetry/xxxx/sensors/xxx/summaries?type=latest worked perfectly fine. But when I adapt the URL for the raspberry it is not working. Have anyone suggestions how the URL look like to geht the CPU value?

Yes, I think so, because i can get Device info.

setup:
RaspberryPi 3
DS18B20 Temp sensor

REST API for RPI is working perfectly fine, I just tested now. That error seems that you put the url, sensor ID or the device ID wrong. @boxi.alarm @lukas.mueller

thanks for the fast reply, can you say me where do I get the ID from my CPU (which is predefined for the RPI), because i can’t find it. when I click on the sensor (as I did by my Arduino) there is only cpu.

Well, right now i have my RPI connected to Cayenne via MQTT, so I don’t have the CPU reading, however the device ID is shown in the page link when you are in the RPI’s Cayenne dashboard, and the sensorID for the CPU reading is shown, also in the page link, when you click on conf icon in the CPU sensor widget. If you continue to have problems send me a PM with screenshots of your dashboard and I will try to get reading myself (I will need also a auth token, but calm down, once you get another auth token the last doesnt work)

Thanks for reply, but I cant find the problem.

Using Postman:

  1. I SEND pass and email to https://auth.mydevices.com/oauth/token and ill get back access_token
  2. Using token in Bearer Token I can GET device_type ID from https://platform.mydevices.com/v1.1/things
  3. But if I try to GET Sensor data from https://platform.mydevices.com/v1.1/telemetry/DEVICE-ID/sensors/SENSOR-ID/summaries?type=latest using Token ill get:
    “statusCode”: 404,
    “error”: “Not Found”,
    “message”: “Not Found”

ps. I tried using Neoxelox APP and same problem there. I can get device info but no go to sensors.

You are trying to get data from like raspberry’s cpu widgets , or other widgets? Because I asked the dev team and right now we can’t get data from raspberry’s cpu widget, as they don’t save historical data from it.