I am trying to get data from a few sensors in an area around Karachi. The Purple Air map (here: Real-Time Air Quality Map | PurpleAir) shows one sensor is online and 5-6 are offline.
However, when I use the api: /v1/sensors/
(without no optional params) only one of the sensors in this area (id 40839
) is returned in the response. None of the other sensors are returned.
However, what’s strange is that if I find the ID from the Purple Air map (e.g. one sensor has an ID of 101015
) and then I try to access that sensor directly using /v1/sensors/101015/
then I can get the data.
To me, it appears that the /v1/sensors/
call only returns active sensors, as opposed to all of them. The api call should in fact return all sensors, unless I optionally filtered them using the available params.
Here’s some pseudo code:
response = requests.get('/v1/sensors/', data={'fields': 'name'})
// response returns a list of all sensors, but some aren't included. E.g. ID 101015, 56159 aren't returned
response = requests.get('/v1/sensors/101015', data={})
// response returns data for this sensor, even though it didn't appear in the above list of sensors.
Why might one want to get old sensors that haven’t been updated in a long time? One reason is for historical data purposes.