RapidAPI logo

AirVisual

FREE
By raygorodskij
Updated 6 months ago
Travel, Transportation
6.4/10
Popularity Score
271ms
Latency
100%
Success Rate

AirVisual API Documentation

The world’s smartest air quality monitor helping you track, foresee, and take action against invisible threats in the air.

View API Details
POSTgetCity
POSTgetNearestCity
POSTgetCity

Pollution data for a specified city.

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
stateSTRING
REQUIRED Name of city you wish to get the data from.
apiKeyCREDENTIALS
REQUIREDYour API key from airVisual account.
countrySTRING
REQUIREDCountry name where the city is located.
citySTRING
REQUIREDState/Country/Region name where the city is located.
Code Snippet
unirest.post("https://AirVisualraygorodskijV1.p.rapidapi.com/getCity")
.header("X-RapidAPI-Host", "AirVisualraygorodskijV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://AirVisualraygorodskijV1.p.rapidapi.com/getCity
Request Method: POST
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://AirVisualraygorodskijV1.p.rapidapi.com/getCity")
.header("X-RapidAPI-Host", "AirVisualraygorodskijV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication