Recommendations for air quality metrics

If you open your browsers devtools (F12) and look at the network tab & refresh the page you will see all the data in a nice JSON format ready for consumption.

It is simply a matter of grabbing the URL and headers then doing a HTTP request directly to the endpoint

demo flow...

[{"id":"16e2bef1fd0a7c1e","type":"function","z":"1683bd9a.5e0a02","name":"","func":"//original curl:  \n\n// curl 'https://airnowgovapi.com/reportingarea/get_state'   \n// -H 'Connection: keep-alive'   \n// -H 'Pragma: no-cache'   \n// -H 'Cache-Control: no-cache'   \n// -H 'sec-ch-ua: \" Not;A Brand\";v=\"99\", \"Google Chrome\";v=\"91\", \"Chromium\";v=\"91\"'   \n// -H 'Accept: */*'   \n// -H 'sec-ch-ua-mobile: ?0'   \n// -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'   \n// -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'   \n// -H 'Origin: https://www.airnow.gov'   \n// -H 'Sec-Fetch-Site: cross-site'   \n// -H 'Sec-Fetch-Mode: cors'   \n// -H 'Sec-Fetch-Dest: empty'   \n// -H 'Referer: https://www.airnow.gov/'   \n// -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,es;q=0.7'   \n// --data-raw 'state_code=NY'   \n// --compressed\n\n\nmsg.method = \"post\";\nmsg.url = \"https://airnowgovapi.com/reportingarea/get_state\";\n\nmsg.headers = {\n    \"Connection\": \"keep-alive\",\n    \"Pragma\": \"no-cache\",\n    \"Cache-Control\": \"no-cache\",\n    \"sec-ch-ua\": \"\\\" Not;A Brand\\\";v=\\\"99\\\", \\\"Google Chrome\\\";v=\\\"91\\\", \\\"Chromium\\\";v=\\\"91\\\"\",\n    \"Accept\": \"*/*\",\n    \"sec-ch-ua-mobile\": \"?0\",\n    \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\",\n    \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n    \"Origin\": \"https://www.airnow.gov\",\n    \"Sec-Fetch-Site\": \"cross-site\",\n    \"Sec-Fetch-Mode\": \"cors\",\n    \"Sec-Fetch-Dest\": \"empty\",\n    \"Referer\": \"https://www.airnow.gov/\",\n    \"Accept-Language\": \"en-GB,en-US;q=0.9,en;q=0.8,es;q=0.7\"\n};\nmsg.cookies = null;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":1400,"wires":[["f65ff22fcbde110d"]]},{"id":"f65ff22fcbde110d","type":"http request","z":"1683bd9a.5e0a02","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1250,"y":1400,"wires":[["73c1f60b6955fa69"]]},{"id":"6b3876b9ab49bfe8","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"state_code=NY","payloadType":"str","x":880,"y":1360,"wires":[["16e2bef1fd0a7c1e"]]},{"id":"8a302e8019f2a12a","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"state_code=OH","payloadType":"str","x":880,"y":1400,"wires":[["16e2bef1fd0a7c1e"]]},{"id":"320cfe2037f7d178","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"state_code=CA","payloadType":"str","x":880,"y":1440,"wires":[["16e2bef1fd0a7c1e"]]},{"id":"73c1f60b6955fa69","type":"debug","z":"1683bd9a.5e0a02","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1430,"y":1400,"wires":[]}]
2 Likes