Current Air Quality
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 | 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
-
langMulti-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.tagUnique tag for this data -
indexes.codeCode of air quality index -
indexes.nameName of air quality index -
indexes.aqiValue of air quality index -
indexes.aqiDisplayDisplay name of the AQI value -
indexes.levelLevel of air quality index -
indexes.categoryCategory of air quality index -
indexes.color.redRed in RGBA color for AQI -
indexes.color.greenGreen in RGBA color for AQI -
indexes.color.blueBlue in RGBA color for AQI -
indexes.color.alphaAlpha in RGBA color for AQI -
indexes.primaryPollutant.codeThe primary pollutant code, maybe NULL. -
indexes.primaryPollutant.nameName of primary pollutant, maybe NULL. -
indexes.primaryPollutant.fullNameFull name of primary pollutant, maybe NULL. -
indexes.health.effectHealth effects of air quality, maybe NULL. -
indexes.health.advice.generalPopulationHealth advice for general population, maybe NULL. -
indexes.health.advice.sensitivePopulationHealth advice for sensitive population, maybe NULL. -
pollutants.codeThe pollutant code. -
pollutants.nameName of pollutant. -
pollutants.fullNameFull name of pollutant. -
pollutants.concentration.valueConcentration values of pollutants. -
pollutants.concentration.unitUnits for concentration values of pollutants. -
pollutants.subIndexes.codeCode of air quality sub-index, maybe NULL. -
pollutants.subIndexes.aqiSub-index value for pollutant, maybe NULL. -
pollutants.subIndexes.aqiDisplaySub-index for display, maybe NULL. -
stations.idLocation ID of the monitoring station for this AQI reference, maybe NULL. -
stations.nameName of the monitoring station for this AQI reference, maybe NULL.