Time Machine for Air Quality
Get the last 10 days of air quality history data.
Let’s say, today is December 30, you can get data from Dec. 20 to Dec. 29.
Historical
Interface code (Enum) | Interface | Class |
---|---|---|
INQUIRE_TYPE_HISTORICAL_AIR | Historical air quality | WeatherHistoricalBaseClass |
Request Parameters
If no optional parameters are set, the default value will be used.
-
location
(required)The location to be queried, only support LocationID and LocationID can be obtained by GeoAPI. For example:location=101010100
-
date
(required)Set the date, up to the most recent 10 days. The date format is yyyyMMdd. Example:date=20200531
-
appKey
(required)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, the available value areunit=m
for metric(default) andunit=i
for imperial. See more about Unit.
Sample Code
//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
-
code
See 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. Iflevel=1
, returnNA
-
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