Get current 1-7 day forecast by city or ZIP Code.
curl --request GET \
--url https://weather.io/forecast/forecast \
--header 'X-API-Key: <api-key>'import requests
url = "https://weather.io/forecast/forecast"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://weather.io/forecast/forecast', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"ForecastDay": [
{
"date": "2023-10-01",
"highTemperature": 28,
"lowTemperature": 15,
"description": "Sunny with a chance of rain"
}
],
"WeatherResponse": {
"city": "Las Cruces",
"zipCode": "88001",
"temperature": 23.5,
"unit": "Metric",
"description": "Partly cloudy"
}
}{
"error": "Invalid city name. Please check your input and try again."
}{
"error": "Unauthorized. Please provide a valid API key."
}{
"error": "Forbidden. You do not have permission to access this resource."
}{
"error": "City not found. Please check the city name or ZIP Code and try again."
}{
"error": "Internal server error. Please try again later."
}{
"error": "Service unavailable. Please try again later."
}Endpoints
Forecast
Returns the current weather forecast for a specified city. Users can input city name or ZIP Code to return a forecast. Forecast includes up to 7 days of weather information.
GET
/
forecast
Get current 1-7 day forecast by city or ZIP Code.
curl --request GET \
--url https://weather.io/forecast/forecast \
--header 'X-API-Key: <api-key>'import requests
url = "https://weather.io/forecast/forecast"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://weather.io/forecast/forecast', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"ForecastDay": [
{
"date": "2023-10-01",
"highTemperature": 28,
"lowTemperature": 15,
"description": "Sunny with a chance of rain"
}
],
"WeatherResponse": {
"city": "Las Cruces",
"zipCode": "88001",
"temperature": 23.5,
"unit": "Metric",
"description": "Partly cloudy"
}
}{
"error": "Invalid city name. Please check your input and try again."
}{
"error": "Unauthorized. Please provide a valid API key."
}{
"error": "Forbidden. You do not have permission to access this resource."
}{
"error": "City not found. Please check the city name or ZIP Code and try again."
}{
"error": "Internal server error. Please try again later."
}{
"error": "Service unavailable. Please try again later."
}
