Hi Everyone,
first off let me say that I am very new at this. I’ve searched the forums, googled, youtubed, read docs, etc etc but I’m still stuck.
So basically I want my photon to get air pollution data and then act on it. The problem is the API that I am using sends me back an array with no name. I can’t figure out how to access the JSON data using the custom webhook template integration.
I’m getting the data from, https://docs.airnowapi.org/.
Here is what is returned…
[{“DateObserved”:"2018-01-16 ",“HourObserved”:20,“LocalTimeZone”:“PST”,“ReportingArea”:“Redwood City”,“StateCode”:“CA”,“Latitude”:37.48,“Longitude”:-122.22,“ParameterName”:“O3”,“AQI”:0,“Category”:{“Number”:1,“Name”:“Good”}},{“DateObserved”:"2018-01-16 ",“HourObserved”:20,“LocalTimeZone”:“PST”,“ReportingArea”:“Redwood City”,“StateCode”:“CA”,“Latitude”:37.48,“Longitude”:-122.22,“ParameterName”:“PM2.5”,“AQI”:54,“Category”:{“Number”:2,“Name”:“Moderate”}}]
You will noticed the above is an unamed array so I can’t do the usual mustache thing of {{a.AQI}} (to get air quality index in the “a” array) to get what i want. Or maybe I can but I’m just doing it wrong.
I’ve been using this as a reference, https://docs.particle.io/reference/webhooks/#variable-substitution and this, https://core-electronics.com.au/tutorials/webhooks-with-particle-io.html , oh and this http://mustache.github.io/mustache.5.html .
Any help would be hugely appreciated.
thanks,
Ethan