📅  最后修改于: 2023-12-03 14:48:25.016000             🧑  作者: Mango
WeatherAPI is a powerful and easy-to-use API that provides accurate and up-to-date weather data for any location around the world. With WeatherAPI, developers can integrate real-time weather information into their applications, websites, or services with just a few lines of code.
To get started with WeatherAPI, follow these steps:
GET /current?location={LOCATION}&apiKey={YOUR_API_KEY}
Example Request:
GET /current?location=London&apiKey=YOUR_API_KEY
Example Response:
{
"location": "London",
"temperature": 21.5,
"humidity": 60,
"wind_speed": 10.5,
"description": "Partly cloudy"
}
GET /forecast?location={LOCATION}&apiKey={YOUR_API_KEY}
Example Request:
GET /forecast?location=Paris&apiKey=YOUR_API_KEY
Example Response:
{
"location": "Paris",
"forecast": [
{
"date": "2022-03-10",
"temperature": 15.2,
"humidity": 75,
"wind_speed": 8.2,
"description": "Light rain"
},
{
"date": "2022-03-11",
"temperature": 14.5,
"humidity": 70,
"wind_speed": 7.5,
"description": "Cloudy"
},
...
]
}
GET /historical?location={LOCATION}&date={DATE}&apiKey={YOUR_API_KEY}
Example Request:
GET /historical?location=New%20York&date=2022-02-28&apiKey=YOUR_API_KEY
Example Response:
{
"location": "New York",
"date": "2022-02-28",
"temperature": 10.6,
"humidity": 55,
"wind_speed": 5.8,
"description": "Sunny"
}
WeatherAPI is an excellent choice for developers who need reliable and accurate weather data in their applications. Its easy integration, extensive coverage, and multiple data formats make it a developer-friendly API. Start using WeatherAPI today and enhance your applications with real-time weather information.