Weather Daily Forecast
Get weather daily forecasts for the next 3-30 days for cities around the world.
| Interface code | Interface | Class |
|---|---|---|
| weather3d | 3-days forecast | WeatherDailyResponse |
| weather7d | 7-days forecast | WeatherDailyResponse |
| weather10d | 10-days forecast | WeatherDailyResponse |
| weather15d | 15-days forecast | WeatherDailyResponse |
| weather30d | 30-days forecast | WeatherDailyResponse |
Parameters
WeatherParameter
-
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 -
langMulti-language setting, please see Language to find out how our multi-language works and how to set up. -
unitSet weather data unit, the available value areunit=mfor metric(default) andunit=ifor imperial. See more about Unit.
Sample code
Swift
Task{
do {
let parameter = WeatherParameter(location: "101010100")
/**
* Get 3-days forecast data
*/
let _ = try await QWeather.instance.weather3d(parameter)
/*
* Get 7-days forecast data
*/
let _ = try await QWeather.instance.weather7d(parameter)
/**
* Get 10-days forecast data
*/
let _ = try await QWeather.instance.weather10d(parameter)
/**
* Get 15-days forecast data
*/
let _ = try await QWeather.instance.weather15d(parameter)
/*
* Get 30-days forecast data
*/
let _ = try await QWeather.instance.weather30d(parameter)
} catch QWeatherError.errorResponse(let error) {
print(error)
} catch {
print(error)
}
}
Objective-C
WeatherParameter *parameter = [WeatherParameter instanceWithLocation:@"101010100" lang:@(LangZH_HANS) unit:@(UnitMETRIC)];
void (^handler)(WeatherDailyResponse *, NSError *) = ^(WeatherDailyResponse *response,
NSError *error) {
if (response) {
NSLog(@"%@", response.description);
}
if (error) {
NSLog(@"%@", error.localizedDescription);
}
};
/**
* Get 3-days forecast data
*/
[QWeatherObjc weather3d:parameter completionHandler:handler];
/**
* Get 7-days forecast data
*/
[QWeatherObjc weather7d:parameter completionHandler:handler];
/**
* Get 10-days forecast data
*/
[QWeatherObjc weather10d:parameter completionHandler:handler];
/**
* Get 15-days forecast data
*/
[QWeatherObjc weather15d:parameter completionHandler:handler];
/**
* Get 30-days forecast data
*/
[QWeatherObjc weather30d:parameter completionHandler:handler];
Response
WeatherDailyResponse
-
codeSee Status Code -
updateTimeAPI last update time -
fxLinkResponsive web page of this data, for embedded in website or APP -
daily.fxDateForecast date -
daily.sunriseSunrise time. Maybe null in high latitude area -
daily.sunsetSunset time. Maybe null in high latitude area -
daily.moonriseMoonrise time of current day. Maybe null -
daily.moonsetMoonset time of current day. Maybe null -
daily.moonPhaseMoon phase name -
daily.moonPhaseIconIcon code for moon phase. See also QWeather Icons -
daily.tempMaxThe highest temperature of the day -
daily.tempMinThe lowest temperature of the day -
daily.iconDayIcon code for daytime weather conditions. See also QWeather Icons -
daily.textDayWeather conditions for daytime -
daily.iconNightIcon code for night weather conditions. See also QWeather Icons -
daily.textNightWeather conditions for night -
daily.wind360DayDaytime wind direction in azimuth degree -
daily.windDirDayDaytime wind direction -
daily.windScaleDayDaytime wind scale -
daily.windSpeedDayDaytime wind speed, KM/H -
daily.wind360NightNightly wind direction in azimuth degree -
daily.windDirNightNightly wind direction -
daily.windScaleNightNightly wind scale -
daily.windSpeedNightNightly wind speed, KM/H -
daily.precipEstimated total precipitation for the day -
daily.uvIndexUV index -
daily.humidityRelative humidity in percent -
daily.pressureAtmospheric pressure, hPa -
daily.visVisibility, KM -
daily.cloudCloud cover in percent, may be null -
refer.sourcesData source and other statements, may be null -
refer.licenseData license, may be null