▫️Weather

/weather

This endpoint retrieves weather information for a specified city. It accepts a GET request with query parameters including the city, format, and lang. If any of these parameters are missing, it returns a custom HTML page indicating missing parameters. If the city is not found, it throws an error. If the weather data is successfully fetched, it returns the temperature, weather description, time of observation, and the city name. If the weather data retrieval fails or an error occurs, it returns a corresponding error message with a status code of 500.

Query Parameters

ParameterTypeDescription

city

string

The name of the city for which weather data is requested.

format

string

The format of the temperature (e.g., 'metric', 'imperial', 'standard').

lang

string

The language code for the response (e.g., 'en', 'fr', 'es').

Example Usage

GET /weather?city=London&format=metric&lang=en

Response

{
  "temperature": 20,
  "description": "Cloudy",
  "time": "10:30:00 AM",
  "city": "London"
}

Last updated