Air Quality Daily Forecast
Air Quality Daily Forecast API for Chinese cities, including AQI, air quality levels, primary pollutants.
Note: Air Quality API v1 (new) is now available, please try to use and upgrade.
Interface code | Interface | Class |
---|---|---|
air5d | Air quality 5-day forecast | AirDailyResponse |
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
.air5d(parameter)
print(response)
} catch QWeatherError.errorResponse(let error) {
print(error)
} catch {
print(error)
}
}
Objective-C
AirParameter * parameter = [AirParameter instanceWithLocation:@"101010100" lang:@(LangZH_HANS)];
[QWeatherObjc air5d:parameter completionHandler:^(AirDailyResponse * _Nullable response, NSError * _Nullable error) {
if (response) {
NSLog(@"%@", response.description);
}
if (error) {
NSLog(@"%@", error.localizedDescription);
}
}];
Response
AirDailyResponse
-
code
See Status Code -
updateTime
API last update time -
fxLink
Responsive web page of this data, for embedded in website or APP -
daily.fxDate
Forecast date -
daily.aqi
Air Quality Index -
daily.level
AQI level -
daily.category
AQI category -
daily.primary
The main pollutant. Iflevel=1
, returnNA
-
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.