Back to Smartcitizen.me

Couldn't find Kit with "id"=

Hello everyone. I am new to smartcitizen.me. Right now I am trying to get data from my kit which is the kit 15908
Here is my Code

import json, requests, time

r = requests.get("https://api.smartcitizen.me/v0/kits/15908")
data = json.loads(r.text)
print(data)

Output:

{'id': 'record_not_found', 'message': "Couldn't find Kit with 'id'=8503", 'url': '', 'errors': ''}

Can somebody explain me how I get the data?

I also want to point out that this is the only thing i coded. I assume you have to login with your account first. But I don’t get how that should be done.

1 Like

Hi!

First of all, welcome!! :smiley:

So, the only issue is that the data for the devices is not on the kits endpoint, but on the devices one. This would be the url:

https://api.smartcitizen.me/v0/devices/15908/

To get the data, you would need to visit the readings path, and then pass sensor_id and the rollup (frequency of data requested), for instance:

https://api.smartcitizen.me/v0/devices/15908/readings?sensor_id=10&rollup=4h

If you are working in python, or R, there are quite a few options to go for already programmed:

Some other examples are in the toolkit in case you want to use processing or other things.

Finally, now we are working with visual programming tools, such as orange. You can find a package, in collaboration with other projects in mecoda.

Hope it helps!