Current Air Quality (new)
The current air quality (AQI) API provides real-time air quality data for specified locations, data resolution is 1x1 km.
- AQI, category, color and primary pollutant based on local standards for each country or region
- Generic QWeather AQI
- Pollutant concentration values and their sub-index.
- Health effects and advice
- Associated monitoring station information
We recommend to read Air Quality Info to learn about the AQIs, pollutants, supported regions and more.
Interface code | Interface | Class |
---|---|---|
airCurrent | Current Air Quality (new) | AirV1CurrentResponse |
Parameters
AirV1Parameter
-
latitude
(required)The latitude of the desired location. Decimal format, up to 2 decimal places. For example39.92
-
longitude
(required)The longitude of the desired location. Decimal format, up to 2 decimal places. For example116.41
-
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 = AirV1Parameter(longitude: 116.41, latitude: 39.92)
let response = try await QWeather.instance
.airCurrent(parameter)
print(response)
} catch QWeatherError.errorResponse(let error) {
print(error)
} catch {
print(error)
}
}
Objective-C
AirV1Parameter *parameter = [AirV1Parameter instanceWithLongitude:116.41 latitude:39.92 lang:@(LangZH_HANS)];
[QWeatherObjc airCurrent:parameter completionHandler:^(AirV1CurrentResponse * _Nullable response, NSError * _Nullable error) {
if (response) {
NSLog(@"%@", response.description);
}
if (error) {
NSLog(@"%@", error.localizedDescription);
}
}];
Response
AirV1CurrentResponse
-
metadata.tag
Unique tag for this data -
indexes.code
Code of air quality index -
indexes.name
Name of air quality index -
indexes.aqi
Value of air quality index -
indexes.aqiDisplay
Display name of the AQI value -
indexes.level
Level of air quality index -
indexes.category
Category of air quality index -
indexes.color.red
Red in RGBA color for AQI -
indexes.color.green
Green in RGBA color for AQI -
indexes.color.blue
Blue in RGBA color for AQI -
indexes.color.alpha
Alpha in RGBA color for AQI -
indexes.primaryPollutant.code
The primary pollutant code, maybe NULL. -
indexes.primaryPollutant.name
Name of primary pollutant, maybe NULL. -
indexes.primaryPollutant.fullName
Full name of primary pollutant, maybe NULL. -
indexes.health.effect
Health effects of air quality, maybe NULL. -
indexes.health.advice.generalPopulation
Health advice for general population, maybe NULL. -
indexes.health.advice.sensitivePopulation
Health advice for sensitive population, maybe NULL. -
pollutants.code
The pollutant code. -
pollutants.name
Name of pollutant. -
pollutants.fullName
Full name of pollutant. -
pollutants.concentration.value
Concentration values of pollutants. -
pollutants.concentration.unit
Units for concentration values of pollutants. -
pollutants.subIndexes.code
Code of air quality sub-index, maybe NULL. -
pollutants.subIndexes.aqi
Sub-index value for pollutant, maybe NULL. -
pollutants.subIndexes.aqiDisplay
Sub-index for display, maybe NULL. -
stations.id
Location ID of the monitoring station for this AQI reference, maybe NULL. -
stations.name
Name of the monitoring station for this AQI reference, maybe NULL.