Skip to content

apayadfullscale-dev/TestWeatherAPI

Repository files navigation

WeatherAPI

WeatherAPI is a RESTful ASP.NET Core Web API that provides comprehensive weather data by integrating with WeatherAPI.com. It offers endpoints for current weather, forecasts, historical data, marine weather, astronomy, time zone, sports events, and more. The API is designed for easy integration with web, mobile, and desktop applications.

Features

  • Get current weather for any location
  • 1-14 day weather forecasts
  • Historical weather data
  • Marine weather information
  • Astronomy details (sunrise, sunset, moon phase, etc.)
  • Time zone and location info
  • Sports events by location
  • Weather alerts
  • IP-based weather lookup
  • Location search and autocomplete

API Endpoints

All endpoints are prefixed with /api/weather (e.g., /api/weather/current).

Endpoint Method Description Parameters
/current GET Get current weather q (location query)
/forecast GET Get weather forecast q (location), days (1-14)
/history GET Get historical weather q (location), dt (yyyy-MM-dd)
/alerts GET Get weather alerts q (location)
/marine GET Get marine weather q (location)
/future GET Get future weather q (location), dt (yyyy-MM-dd)
/search GET Search or autocomplete location q (location)
/iplookup GET IP lookup for weather and location info q (IP address or 'auto:ip')
/astronomy GET Get astronomy info q (location), dt (yyyy-MM-dd)
/timezone GET Get time zone info q (location)
/sports GET Get sports events q (location)

Example Request

GET /api/weather/current?q=London

Setup & Running Locally

  1. Clone the repository:
    git clone https://github.com/apayadfullscale-dev/WeatherAPI.git
    cd WeatherAPI
    
  2. Restore dependencies:
    dotnet restore
    
  3. Build the project:
    dotnet build
    
  4. Run the API:
    dotnet run
    
  5. Access Swagger UI at http://localhost:5000/swagger (or the port shown in your terminal).

Configuration

Set your WeatherAPI.com API key in appsettings.json:

{
  "WeatherApi": {
	 "ApiKey": "YOUR_API_KEY"
  }
}

Technologies Used

  • ASP.NET Core 9
  • C#
  • WeatherAPI.com
  • Swashbuckle (Swagger)

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages