API Documentation
Welcome to our API Documentation! Our API provides real-time weather information for cities around the world.
Endpoint
/api/weather?city=MogadishuTo use our API, simply make a GET request to the endpoint above by replacing Mogadishu with the name of the city you want weather data for.
Code Examples
import requests
def get_weather(city):
response = requests.get(
f'http://localhost:3000/api/weather?city={city}'
)
return response.json()
print(get_weather('Mogadishu'))Response Format
Successful Response (200 OK)
{
"success": true,
"timestamp": "2024-11-04/23:30:56 UTC+3",
"developer": {
"website": "https://apitools.pages.dev"
},
"source": "Weather API",
"data": {
"city": "Mogadishu",
"country": "🇸🇴 Somalia",
"temperature": "28°C",
"feels_like": "32°C",
"weather": "Clear sky",
"humidity": "75%",
"wind_speed": "5.2 m/s",
"cloud_coverage": "10%"
},
"processingTime": "0.45s"
}Error Response (400 Bad Request)
{
"success": false,
"timestamp": "2024-11-09/21:50:19 UTC+3",
"developer": {
"website": "https://apitools.pages.dev"
},
"source": "Weather API",
"description": "Failed to fetch weather data",
"data": {
"error": "City parameter is required to fetch weather data"
}
}Error Response (404 Not Found)
{
"success": false,
"timestamp": "2024-11-09/21:50:19 UTC+3",
"developer": {
"website": "https://apitools.pages.dev"
},
"source": "Weather API",
"description": "Failed to fetch weather data",
"data": {
"error": "City not found"
}
}Response Fields
| Field | Description |
|---|---|
| city | The name of the city |
| country | The name of the country with flag emoji |
| temperature | Current temperature in degrees Celsius |
| feels_like | Temperature that feels like, factoring in weather conditions |
| weather | Description of current weather condition |
| humidity | Current humidity level as a percentage |
| wind_speed | Current wind speed in meters per second |
| cloud_coverage | Percentage of sky covered by clouds |