in Tutorials

[How To] Use Real-time Air Quality API from data.gov.in

data.gov.in is an Open Data platform which has many datasets and APIs from the Government of India. One of them is the Realtime Air Quality Index API which gives values from different monitoring stations across India. The pollutants monitored are Sulphur Dioxide (SO2), Nitrogen Dioxide (NO2), Particulate Matter (PM10 and PM2.5), Carbon Monoxide (CO), Ozone(O3), etc.

I’ve played around with the API in the try it out the section on the website and added filters to get particular information for a city or a state.

This API provides real-time information and hence you may have to store the information in a DB if you want to build something on the historical data of Air Quality. Also, note that this data is updated every hour. So make sure your requests are sent for an hour instead of every minute to not hit the rate limits and also, why would you fetch the same information again and again?

API URL: https://data.gov.in/resources/real-time-air-quality-index-various-locations

Request Type: GET

Parameters
apikey: Sign up and create an account on data.gov.in to get an apikey.
format: xml/csv/json
Example Request URL: https://api.data.gov.in/resource/3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69?api-key=YOUR_KEY_HERE&format=json&offset=0&filters[state]=Telangana

What can you build?

  1. Realtime map showing Air Quality Index of different cities
  2. Charts and graphs of Air Quality from different cities
  3. Graphs of the pollutants based on the Air Quality information of a city and help people make quick decisions

DEMO

Please update the API Key since this example shows the API Key from the website itself.

See the Pen Visualizing Air Quality Data from data.gov.in into a Table by Waldo (@werizwaldo) on CodePen.

0