Page 1 of 1

Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Fri 27 May 2022 5:04 pm
by saratogaWX
It appears they shut off the old queries like [nobbc]http://www.purpleair.com/json?show=4299[/nobbc] and now redirect to a server that won't respond to the query.

https://community.purpleair.com/t/disco ... n-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.

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Fri 27 May 2022 5:42 pm
by ConligWX
yep they are changing quite a bit

https://api.purpleair.com/

https://community.purpleair.com/t/purpl ... iq9ur6D0OQ

in the meantime you can grab code to display realtime widget just click on the "get this widget" and put it on a webpage for now.
Screenshot 2022-05-27 184853.png

like so: https://www.conligwx.org/wxairquality.php

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sat 28 May 2022 12:16 am
by saratogaWX
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.

It may be easier for folks to just use the widget from them instead...

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sat 28 May 2022 5:16 pm
by ConligWX
Thanks once again Ken for your work. Much appreciated :clap:

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sat 28 May 2022 11:32 pm
by BeaumarisWX
Hi Ken,
What script uses the "purpleair-inc.php" ?
Kind Regards,
Tony

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sun 29 May 2022 12:02 am
by ConligWX
BeaumarisWX wrote: Sat 28 May 2022 11:32 pm Hi Ken,
What script uses the "purpleair-inc.php" ?
Kind Regards,
Tony

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sun 29 May 2022 12:09 am
by ConligWX
Ken

I found I had to add a second <br/> on line 395 (purpleair-inc.php) otherwise the $Description and $Message were on the same line or at least overlapping.

Code: Select all

<td class="auto-style9" style="width: 85%"><strong>' . $Description . '</strong><br/><br/>

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sun 29 May 2022 12:16 am
by BeaumarisWX
Ah OK thanks Simon, appreciated.
I was hoping for the old wim or beteljuice one.
Cheers,
Tony

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sun 29 May 2022 12:20 am
by ConligWX
BeaumarisWX wrote: Sun 29 May 2022 12:16 am Ah OK thanks Simon, appreciated.
I was hoping for the old wim or beteljuice one.
Cheers,
Tony
no worries, got mine up and running now.

https://www.conligwx.org/wxpurpleair.php

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sun 29 May 2022 2:22 am
by BeaumarisWX
Yep,
I'll use it for know till I can find a fix for the other one : https://beaumaris-weather.com/wxpurpleair_api.php
Also adapted a Dashboard one for the ajax-dashboard : https://beaumaris-weather.com/index.php
Also adjusted as best I could for Tasmanian Category Calcs / Colors / Descriptions. etc.
Kind Regards,

Re: Heads-up: PurpleAir JSON query now requires an API key... grrrrr.

Posted: Sun 05 Jun 2022 12:47 pm
by ConligWX
Ken there maybe changes to the api soon, not sure if they will affect your script however.


As far as I can tell the is will add the ability to poll for history too.
BA6654CE-304D-4D5E-B29A-79B9A1F7C6E6.png


https://community.purpleair.com/t/previ ... istory/853