Weather Indices Forecast
Get weather indices forecast data for cities in China and around the world.
- Weather Indices in China: Comfort Indices, Car Wash Indices, Dressing Indices, Cold Indices, Sports Indices, Travel Indices, UV Indices, Air Pollution Indices, Air Conditioning Indices, Allergy Indices, Sunglasses Indices, Makeup Indices, Sunshine Indices, Traffic Indices, Fishing Indices, Sun Protection Indices
- Weather Indices worldwide: Sports Indices, Car Wash Indices, UV Indices, Fishing Indices
| Interface code | Interface | Class |
|---|---|---|
| indices1d | Today Weather Indices | IndicesDailyResponse |
| indices3d | Weather Indices 3-days forecast | IndicesDailyResponse |
Parameters
IndicesParameter
-
location(required)The location to be queried, support LocationID or comma-separated longitude and latitude (decimal, up to 2 decimal places), LocationID can be obtained by GeoAPI. Example:location=101010100orlocation=116.41,39.92 -
type(required)Weather indices type ID, including car wash index, clothing index, fishing index, etc. You can get multiple types of weather indices at one time, and multiple types are separated by comma, e.g.,type=3,5, and all indices type see Indices Info. -
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 = IndicesParameter(location: "101010100", type: [.CW,.DRSG])
/**
* Get 1-day weather indices data
*/
let _ = try await QWeather.instance.indices1d(parameter)
/**
* Get 3-day weather indices data
*/
let _ = try await QWeather.instance.indices3d(parameter)
} catch QWeatherError.errorResponse(let error) {
print(error)
} catch {
print(error)
}
}
Objective-C
IndicesParameter *parameter = [IndicesParameter instanceWithLocation:@"101010100" type:@[@(IndicesCW),@(IndicesDRSG)] lang:@(LangZH_HANS)];
void (^handler)(IndicesDailyResponse *, NSError *) = ^(IndicesDailyResponse *response,
NSError *error) {
if (response) {
NSLog(@"%@", response.description);
}
if (error) {
NSLog(@"%@", error.localizedDescription);
}
};
/**
* Get 1-day weather indices data
*/
[QWeatherObjc indices1d:parameter lang:LangZH_HANS completionHandler:handler];
/**
* Get 3-day weather indices data
*/
[QWeatherObjc indices3d:parameter lang:LangZH_HANS completionHandler:handler];
Response
IndicesDailyResponse
-
codeSee Status Code -
updateTimeAPI last update time -
fxLinkResponsive web page of this data, for embedded in website or APP -
daily.dateForecast date -
daily.typeWeather indices forecast type ID -
daily.nameName of weather indices type -
daily.levelWeather indices level -
daily.categoryWeather indices category name -
daily.textDescription of the weather indices, may be null -
refer.sourcesData source and other statements, may be null -
refer.licenseData license, may be null
Index type and level
See Indices Info.