Air Quality Daily Forecast (new)

Platform: API iOS Android

Air quality (AQI) dailay forecasts, pollutants, and health advice for the next 3 days.

We recommend to read Air Quality Info to learn about the AQIs, pollutants, supported regions and more.

Interface code Interface Class
airDaily Air quality daily forecast (new) AirV1DailyResponse

Parameters

AirV1Parameter

  • latitude(required)The latitude of the desired location. Decimal format, up to 2 decimal places. For example 39.92
  • longitude(required)The longitude of the desired location. Decimal format, up to 2 decimal places. For example 116.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
            .airDaily(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 airDaily:parameter completionHandler:^(AirV1DailyResponse * _Nullable response, NSError * _Nullable error) {
    if (response) {
        NSLog(@"%@", response.description);
    }
    if (error) {
        NSLog(@"%@", error.localizedDescription);
    }
}];

Response

AirV1DailyResponse

  • metadata.tag Unique tag for this data
  • days.forecastStartTime The start time of the forecast data, ISO8601 format
  • days.forecastEndTime The end time of the forecast data, ISO8601 format
  • days.indexes.code Code of air quality index
  • days.indexes.name Name of air quality index
  • days.indexes.aqi Value of air quality index
  • days.indexes.aqiDisplay Display name of the AQI value
  • days.indexes.level Level of air quality index
  • days.indexes.category Category of air quality index
  • days.indexes.color.red Red in RGBA color for AQI
  • days.indexes.color.green Green in RGBA color for AQI
  • days.indexes.color.blue Blue in RGBA color for AQI
  • days.indexes.color.alpha Alpha in RGBA color for AQI
  • days.indexes.primaryPollutant.code The primary pollutant code, maybe NULL.
  • days.indexes.primaryPollutant.name Name of primary pollutant, maybe NULL.
  • days.indexes.primaryPollutant.fullName Full name of primary pollutant, maybe NULL.
  • days.indexes.health.effect Health effects of air quality, maybe NULL.
  • days.indexes.health.advice.generalPopulation Health advice for general population, maybe NULL.
  • days.indexes.health.advice.sensitivePopulation Health advice for sensitive population, maybe NULL.
  • days.pollutants.code The pollutant code.
  • days.pollutants.name Name of pollutant.
  • days.pollutants.fullName Full name of pollutant.
  • days.pollutants.concentration.value Concentration values of pollutants.
  • days.pollutants.concentration.unit Units for concentration values of pollutants.
  • days.pollutants.subIndexes.code Code of air quality sub-index, maybe NULL.
  • days.pollutants.subIndexes.aqi Sub-index value for pollutant, maybe NULL.
  • days.pollutants.subIndexes.aqiDisplay Sub-index for display, maybe NULL.