Forecasts
https://phrases.api.xweather.com/forecasts/
The Forecasts endpoint generates a summary of the requested forecast periods. By default, requests before 5pm return the current day and night forecast; requests after 5pm return the night and next day forecast. Forecasts aggregates and identifies the most important weather metrics and presents them akin to traditional weather broadcasts or reports. This report can include metrics such as temperatures, wind speeds, precipitation, humidity, and more.
This endpoint primarily utilizes data from Forecasts (opens in a new tab) Data API endpoint. Please refer to this for more information on the available metrics and valid time ranges.
Note: The limit parameter maximum is 31 when using day
, daynight
, or mdnt2mdnt
filters. This allows for the maximum forecast range of +15 days. The limit parameter maximum is 25 otherwise for #hr
or #min
filters.
Requests
The request URL should be in the following format:
https://phrases.api.xweather.com/forecasts/?client_id={client_id}&client_secret={client_secret}&{params}
Supported Parameters
The following parameters are optional unless otherwise noted:
Parameter | Description | Format |
---|---|---|
stream | Type: stringWhether to stream the results in real-time. The default value is false . | stream=:boolean |
include_location | Type: stringWhether to include a reference to the requested location in the response. The default value is true . | include_location=:boolean |
units | Type: stringThe units to use for the results. The default value is both . Valid values are: both , imperial , metric . | units=:string |
personality | Type: stringThe personality to use for the results. The default value is default , which is a helpful meteorologist. Valid values are: default , meteorologist , on_air_met , radio_host , shock_jock . | personality=:string |
language | Type: stringThe desired output language of the results. The default value is en . Refer to the list of Supported Languages for the full range of values. | language=:string |
from | Type: stringReturns the results starting from the value specified. For best practices we recommend using the to parameter as well to define a specific time frame. Supports a UNIX timestamp or a specific date string. Alternatively, common date formats supported by the PHP strtotime() function will be accepted; however, commas are not accepted. | from=:string |
to | Type: stringReturns the results between now and the value specified. For best practices we recommend using the from parameter as well to define a specific time frame. When used in conjunction with the from parameter, the value of to will be relative to the value of from, not relative to the current time. Supports a UNIX timestamp or a specific date string. Alternatively, common date formats supported by the PHP strtotime() function will be accepted; however, commas are not accepted. | to=:string |
filter | Type: stringForecast filters for the results. The default value is daynight . Valid values are: daynight , day , mdnt2mdnt , #hr . See Filters tab for more info on usage of these values. | filter=:string |
limit | Type: stringThe total number of forecast period results that filter uses. The default value is 2 . | limit=:total |
Response
The following is an example of what each object in the response will consist of. Depending on your requested action, the response may contain multiple instances of this object within an array.
Properties
response (string)
The object containing the text summary output.
{
"response": "On June 5 in Minneapolis, MN, the weather will begin with partly cloudy skies and a chance of showers and isolated storms in the morning. The maximum temperature will reach around 27.2°C (81°F), while the minimum feels like temperature will be 26.7°C (80°F). Winds will be from the south-southwest at speeds ranging from 9 to 18 km/h (6 to 11 mph). There is a 22% probability of precipitation, with light rain expected at a rate of 0.1 mm (0.004 in) per hour.\n\nAs the day transitions to evening, the weather will become mostly cloudy with a chance of storms. The temperature will drop to a minimum of 15°C (59°F) with a maximum feels like temperature of 24.4°C (76°F). Winds will shift to the south at speeds between 7 to 14 km/h (4 to 9 mph). The probability of precipitation increases to 58%, with rain expected at a rate of 3.2 mm (0.126 in) per hour."
}