Real-time Air Quality
Real-time air quality for Chinese cities and 1,700 monitoring stations, including AQI, air quality levels, primary pollutants, PM10, PM2.5, ozone, nitrogen dioxide sulfur dioxide and carbon monoxide values.
Note: Air Quality API v1 (new) is now available, please try to use and upgrade.
Interface code | Interface | Class |
---|---|---|
airNow | Real-time Air Quality | AirNowResponse |
Parameters
AirParameter
-
location
(required)The location to be queried, support LocationID or comma-separated longitude and latitude (decimal, up to 2 decimal places), LocationID can be obtained by GeoAPI. Example:location=101010100
orlocation=116.41,39.92
-
lang
Multi-language setting, please see Language to find out how our multi-language works and how to set up.
Sample code
Swift
Task {
do {
let parameter = AirParameter.make(location: "101010100" lang:.ZH_HANS)
let response = try await QWeather.instance
.airNow(parameter)
print(response)
} catch QWeatherError.errorResponse(let error) {
print(error)
} catch {
print(error)
}
}
Objective-C
AirParameter * parameter = [AirParameter instanceWithLocation:@"101010100" lang:@(LangZH_HANS)];
[QWeatherObjc airNow:parameter completionHandler:^(AirNowResponse * _Nullable response, NSError * _Nullable error) {
if (response) {
NSLog(@"%@", response.description);
}
if (error) {
NSLog(@"%@", error.localizedDescription);
}
}];
Response
AirNowResponse
station
, the air data from monitoring station are only response for cities in POI-Air-Monitoring-Station-List.
-
code
See Status Code -
updateTime
API last update time -
fxLink
Responsive web page of this data, for embedded in website or APP -
now.pubTime
The data release time from the data source -
now.aqi
Air Quality Index -
now.level
AQI level -
now.category
AQI category -
now.primary
The main pollutant. Iflevel=1
, returnNA
-
now.pm10
PM10 -
now.pm2p5
PM2.5 -
now.no2
Nitrogen dioxide -
now.so2
Sulfur dioxide -
now.co
Carbon monoxide -
now.o3
Ozone -
station.name
The name of the monitoring station -
station.id
ID of the monitoring station -
station.pubTime
The data release time from the data source -
station.aqi
Air Quality Index -
station.level
AQI level -
station.category
AQI category -
station.primary
The main pollutant. Iflevel=1
, returnNA
-
station.pm10
PM10 -
station.pm2p5
PM2.5 -
station.no2
Nitrogen dioxide -
station.so2
Sulfur dioxide -
station.co
Carbon monoxide -
station.o3
Ozone -
refer.sources
Data source and other statements, may be null -
refer.license
Data license, may be null
Air Quality Index Level
See Air Quality Info.