Get weather forecast for a city
Retrieve weather forecast information for a specified location using WeatherAPI.com.
Features:
- Multi-day weather forecasts (1-7 days)
- Support for city names or coordinates (lat/lon)
- Detailed daily weather information including min/max temperatures
- Precipitation chance and wind information
- Support for multiple temperature units
- Authentication required for all requests
Location Input:
- City-based: Provide
cityparameter (e.g., “London”, “New York”) - Coordinate-based: Provide
latandlonparameters (e.g., 51.5074, -0.1278) - Either city OR coordinates must be provided
Forecast Information:
- Daily high/low temperatures
- Weather conditions and descriptions
- Humidity and wind speed
- Precipitation probability
- Weather icons for UI display
Authentication:
- Requires valid Bearer token
- Test tokens available for development:
test-jwt-token,agent-jwt-token - Production tokens verified with external auth service
Rate Limits:
- Subject to WeatherAPI.com rate limits
- 10-second timeout for external API calls
Examples:
- 3-day forecast for London:
/api/context/weather/forecast?city=London - 7-day forecast for New York:
/api/context/weather/forecast?city=New%20York&days=7 - Imperial units for Tokyo:
/api/context/weather/forecast?city=Tokyo&units=imperial&days=5 - Coordinates:
/api/context/weather/forecast?lat=51.5074&lon=-0.1278&days=3
Authentication
AuthorizationBearer
JWT token obtained from the Auth API
Headers
Query parameters
city
City name (required if coordinates not provided)
country
Country code for disambiguation (optional)
lat
Latitude coordinate (required if city not provided)
lon
Longitude coordinate (required if city not provided)
units
Temperature units (default: metric)
days
Number of forecast days (1-7, default: 3)
Response
Weather forecast data retrieved successfully

