WXforum.net
Weather Station Hardware => Air Quality Sensors => Topic started by: saratogaWX on May 27, 2022, 01:01:41 PM
-
It appears they shut off the old queries like http://www.purpleair.com/json?show=4299 and now redirect to a server that won't respond to the query.
https://community.purpleair.com/t/discontinuation-of-the-json-and-data-json-urls/713 says adrian
13h
After a few years of grace period, we are now redirecting these two URLs (www.purpleair.com/json and www.purpleair.com/data.json ) to a server that will not respond.
Please contact us if you have any questions or need any help getting going on our new API, at https://api.purpleair.com .
Sigh.. I've sent an email to request a READ key, and will rework my scripts to use it instead. Meanwhile, the realtime query script(s) are very broken.. no data available.
For weather software developers that support realtime queries, they'll have to obtain keys and rewrite that portion of their software.
Grumble.
-
WD already has option to use purple air api luckily
-
Where do you request the API key? I'm not seeing it readily.
-
Looks like just their regular "Contact us" page is to be used.
https://www2.purpleair.com/pages/contact-us
-
WD already has option to use purple air api luckily
It's does but after entering my API key my graph is still flat lined. I think the graph is linked to the old method and not the new one.
-
For the PHP script, I had the two sensorida and sensoridb. Do I use the a value for Weather Display sensor number?
I got a read key, so I'm part way there I think.
-
I've reworked the purpleair-inc.php script to use the new API. Seems to be working on my page now.
They were fairly fast in providing an API key, but stunningly, the process was via email... The FAQ on their site needs to be changed now that the old method is turned off.
-
re WD, it should still be graphing OK
what shows in file
airqualityapi.txt
also though WD can get data via local IP (if your purple air sensor is connected to your LAN)
in the file airquality.txt
is there the data
pm2.5_aqi":
and if so, is that giving the correct aqi value
-
In the old script, there was sensorida and sensoridb. Are these the same for the new script? Or where do I find it?
-
Yes, the sensorids haven't changed with the new API. Mine was 4299,4300 and remains that for the new API.
The API returns stats, stats_a, stats_b now so you only have to query the primary (a) sensor to get the (b) sensor data too.
-
Yeah, that's what I did, I'm getting no data.
-
re WD, it should still be graphing OK
what shows in file
airqualityapi.txt
also though WD can get data via local IP (if your purple air sensor is connected to your LAN)
in the file airquality.txt
is there the data
pm2.5_aqi":
and if so, is that giving the correct aqi value
here is the latest file I had.
-
[ You are not allowed to view attachments ]
re WD, it should still be graphing OK
what shows in file
airqualityapi.txt
Here are my settings. What's odd is when I do a test of the top one, I now get an error. I never used to. But after the error, it will show the numbers anyway.
I un-checked the "Use local data for 1.0 and 10.0 PM size data", just to see if the lower api part will work now.
-
The 302 just indicates a temporary redirect was returned.. the api.purpleair.com should be accessed via https likely.
The local URL shouldn't have changed in response (mine hasn't).
-
Even if I disable the API section, I still get that error message. So I don't think it's related to adding the API section I never had.
On the PA Community forum, there were some questions about a firmware 7 version that is being rolled out. I didn't pay attention to what version I had out of the box. But I'm now at 7.00 . I'm beginning to wonder if that could be related to the new errors, if mine did get the update, and not everyone has it yet.
-
if you have local IP working for purple air data, I have now added where it will use PM2.5 value from that data instead of trying to get it from the cloud
-
I tried to use the file Ken provided but after entering my station and key I only get a blank page. What am I doing wrong?
-
The purpleair-inc.php doesn't directly produce visible output .. it has to be used with something like the wxpurpleair.php page attached.
-
Thanks Ken, I'm getting data now. Now lets see if I can incorporate the changes into the script I'm using.
-
Ken I am lost. Do i still need get-purpleair-aqi or is it replaced with purple-inc and wxpurpleair. having a senior moment. I only have one ID and it is only 5 numbers? I have the keys and am waiting for purpleair to get back with two ID,s. Thanks Joe
-
i have tested the api in WD , using a Station ID number (you can get that for your station via the purple air map) and a api key for someones purple air sensor and it does work
-
Ken I am lost. Do i still need get-purpleair-aqi or is it replaced with purple-inc and wxpurpleair. having a senior moment. I only have one ID and it is only 5 numbers? I have the keys and am waiting for purpleair to get back with two ID,s. Thanks Joe
You need an API key for api.purpleair.com access to data --only the READ key need be used. The station number of your station hasn't changed, so you already have that.
If you configure purpleair-inc.php with your station number and the API READ key, then it can pull data from api.purpleair.com.
The wxpurpleair.php page is needed to present the data gathered by purpleair-inc.php (since that script only gets, but not presents the data).
Hope this helps...
-
I tried but I have no idea what I'm doing. Anyone want to look at my file and let me know what I'm doing wrong?
-
The issue is likely with
$PurpleAirAPI = 'blank';
You need to request API keys from contact@purpleair.com . Include your real name and sensorid in the request.
They’ll email back with two API keys, one for Read and one for Write. Copy the Read key to replace the word ‘blank’ and upload the changed file. You must have a valid API key for queries to api.purpleair.com
-
Hi Ken,
I have an API key but removed it before uploading the file so other don't use it.
-
FYI, It looks like todays version of WD fixed the flat line graph issue.