Documentation
Welcome to our API Documentation! Our API provides real-time weather information for cities around the world. You can use our API to retrieve data such as temperature, humidity, wind speed, and more. Below, we provide examples in various programming languages to show how you can interact with our API to get weather information for any city. Each example demonstrates how to make a request to our API and handle the response.
Endpoint
The base URL for accessing weather information is:
https://skyweather.pages.dev/?city=Mogadishu
To use our API, simply make a GET request to the previous API key by replacing {Mogadishu}
with the name of the city you want to get weather data for. The response will include details like temperature, humidity, weather conditions, and more. Below are code examples in different programming languages that illustrate how to use our API effectively.
import requests
def get_weather(city):
response = requests.get(f'https://skyweather.pages.dev/?city={city}')
return response.json()
print(get_weather('Mogadishu'))
POSSIBLE RESPONSES FOR THE
The API provides weather information for a given city. When you make a request to the API with a city name, it returns a JSON object with detailed weather data. Here's a breakdown of the different possible responses:
API Request Example:
https://skyweather.pages.dev/?city=Mogadishu
Successful Response (200 OK)
When the API request is successful and the city is found, the response will be in the following format:
{
"success": true,
"timestamp": "2024-11-04/23:30:56 UTC+3",
"developer": {
"website": "https://apitools.pages.dev"
},
"source": "Weather API",
"data": {
"city": "string",
"country": "string",
"temperature": "string",
"feels_like": "string",
"weather": "string",
"humidity": "string",
"wind_speed": "string",
"cloud_coverage": "string"
},
"processingTime": "string"
}
}
The response includes the following information:
- City: The name of the city.
- Country: The name of the country and its flag emoji.
- Temperature: The current temperature in degrees Celsius.
- Feels Like: The temperature that feels like, factoring in additional weather conditions.
- Weather: A description of the current weather condition.
- Humidity: The current humidity level as a percentage.
- Wind Speed: The current wind speed in meters per second.
- Cloud Coverage: The percentage of the sky covered by clouds.
Error Responses (400, 404, 500)
If there is an issue with the request, the API may return the following error messages:
API Request Example:
https://skyweather.pages.dev/
{
"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"
}
}
}
BAD REQUEST (400)
This error occurs when the city parameter is missing from the request. Ensure you include the city name in the query string as specified in the API usage documentation.
API Request Example:
https://skyweather.pages.dev/?city=AAAAA
{
"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"
}
}
}
BAD REQUEST (404)
This error indicates that the city name provided in the request could not be found. Please ensure that the city name is spelled correctly and is a valid city.
API Request Example:
https://skyweather.pages.dev/?city=Mogadishu
{
"success": false,
"timestamp": "2024-11-09/21:50:19 UTC+3",
"developer": {
"website": "https://apitools.pages.dev"
},
"source": "Weather API",
"data": {
"error": "Server Error"
}
}
}
SERVER ERROR (500)
This error indicates an issue with the server processing the request. If you encounter this error, please try again later. If the problem persists, contact the API provider.