# Recommendations for air quality metrics

**URL:** <https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156>\
**Category:** General\
**Created:** [1 August 2021 06:55 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156 "2021-08-01T06:55:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 August 2021 08:33 UTC](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156/2 "2021-08-01T08:33:35Z")

</div>

> [@Matt.L](#):
>
> I'm looking into if it's possible for me to get data directly from [AirNow.gov](http://AirNow.gov)

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.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c2a9319ba612829cf0684e7ee0161623adb6788.png)

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/9/29dc911296c77ffd64aebdc050cd65f775ae334d.png)

demo flow...

```auto
[{"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":[]}]

```

---

_[View the full topic](https://discourse.nodered.org/t/recommendations-for-air-quality-metrics/49156)._
