Historical

For iOS SDK v4.9+

Get the last 10 days of weather and air quality data.

If you need a longer period of historical city data or grid historical data, please please contact us.

Historical

Interface code (Enum) Interface Class
INQUIRE_TYPE_HISTORICAL_WEATHER Historical weather WeatherHistoricalBaseClass
INQUIRE_TYPE_HISTORICAL_AIR Historical air quality WeatherHistoricalBaseClass

Request Parameters

If no optional parameters are set, the default value will be used.

location

The location to be queried, only support LocationID and LocationID can be obtained by GeoAPI.

For example: location=101010100

date

Set the date, up to the most recent 10 days. The date format is yyyyMMdd.

For example: date=20200531

appKey

API authentication key, please refer to How To Get Your Key.

For example: appKey=12334567890ABC

lang

Multi-language, default Chinese, if data does not match the language you set, it will return in English or its native language. Language parameter please refer to Language

unit

Set weather data unit, default Metric, unit parameters please refer Unit

Sample Code


    //Historical weather
    QWeatherConfigInstance.publicID = @"publicID";
    QWeatherConfigInstance.appKey = @"key";
    QWeatherConfigInstance.appType = APP_TYPE_BIZ;
    QWeatherConfigInstance.location = @"101010100";
    QWeatherConfigInstance.date = @"20200425";
    [QWeatherConfigInstance weatherWithInquireType:INQUIRE_TYPE_HISTORICAL_WEATHER WithSuccess:^(WeatherHistoricalBaseClass *responseObject) {
        
        NSLog(@"Description->%@",[responseObject description]);
        
    } faileureForError:^(NSError *error) {
        NSLog(@"error->%@",error);
        
    }];

    //Historical air quality
    QWeatherConfigInstance.publicID = @"publicID";
    QWeatherConfigInstance.appKey = @"key";
    QWeatherConfigInstance.appType = APP_TYPE_BIZ; QWeatherConfigInstance.location = @"101010100";
    QWeatherConfigInstance.date = @"20200425";
    [QWeatherConfigInstance weatherWithInquireType:INQUIRE_TYPE_HISTORICAL_AIR WithSuccess:^(WeatherHistoricalBaseClass *responseObject) {
        
        NSLog(@"Description->%@",[responseObject description]);
        
    } faileureForError:^(NSError *error) {
        NSLog(@"error->%@",error);
        
    }];

Response

Weather Historical Data

Parameters Description
code

API status code, please refer to Status Code

fxLink

Responsive web page of this data, for embedded in website or APP

weatherDaily.date

Date

weatherDaily.sunrise

Sunrise time

weatherDaily.sunset

Sunset time

weatherDaily.moonrise

Moonrise time

weatherDaily.moonset

Moonset time

weatherDaily.moonPhase

Moon phase name

weatherDaily.tempMax

The highest temperature of the day

weatherDaily.tempMin

The lowest temperature of the day

weatherDaily.precip

Estimated total precipitation for the day

weatherHourly.time

Time of the day

weatherHourly.temp

Hourly temperature

weatherHourly.icon

Icon code of weather conditions, free to download weather icons

weatherHourly.text

Hourly weather condition

weatherHourly.wind360

Hourly wind direction in azimuth degree

weatherHourly.windDir

Hourly wind direction

weatherHourly.windScale

Hourly wind scale

weatherHourly.windSpeed

Hourly wind speed, KM/H

weatherHourly.humidity

Hourly relative humidity in percent

weatherHourly.precip

Hourly accumulated precipitation

weatherHourly.pressure

Atmospheric pressure, hPa

refer.sources

Data source and other statements, may be null

refer.license

Data license, may be null

Air Quality Historical Data

Parameters Description
code

API status code, please refer to Status Code

fxLink

Responsive web page of this data, for embedded in website or APP

airHourly.pubTime

The data release time from the data source

airHourly.aqi

Air Quality Index

airHourly.level

AQI level

airHourly.category

AQI category

airHourly.primary

The main pollutant. If level=1, return NA

airHourly.pm10

PM10

airHourly.pm2p5

PM2.5

airHourly.no2

Nitrogen dioxide

airHourly.so2

Sulfur dioxide

airHourly.co

Carbon monoxide

airHourly.o3

Ozone

refer.sources

Data source and other statements, may be null

refer.license

Data license, may be null