WeatherAPI.com provides access to weather and geo data via a JSON/XML restful API. It allows developers to create desktop, web and mobile applications using this data very easy.
We provide following data through our API:
- Real-time weather
- 14 day weather forecast
- Historical Weather
- Marine Weather and Tide Data
- Future Weather (Upto 365 days ahead)
- Daily and hourly intervals
- 15 min interval (Enterprise only)
- Astronomy
- Time zone
- Location data
- Sports
- Search or Autocomplete API
- Weather Alerts
- Air Quality Data
- Bulk Request
You need to signup and then you can find your API key under your account, and start using API right away!
Try our weather API by using interactive API Explorer.
We also have SDK for popular framework/languages available on Github for quick integrations.
If you find any features missing or have any suggestions, please contact us.
API access to the data is protected by an API key. If at anytime, you find the API key has become vulnerable, please regenerate the key using Regenerate button next to the API key.
Authentication to the WeatherAPI.com API is provided by passing your API key as request parameter through an API .
key=YOUR API KEY
- .NET 4.0 or later
- Windows Phone 7.1 (Mango)
- RestSharp - 105.1.0 or later
- Json.NET - 7.0.0 or later
- JsonSubTypes - 1.2.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742
Run the following command to generate the DLL
- [Mac/Linux]
/bin/sh build.sh
- [Windows]
build.bat
Then include the DLL (under the bin
folder) in the C# project, and use the namespaces:
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
A .nuspec
is included with the project. You can follow the Nuget quickstart to create and publish packages.
This .nuspec
uses placeholders from the .csproj
, so build the .csproj
directly:
nuget pack -Build -OutputDirectory out IO.Swagger.csproj
Then, publish to a local feed or other host and consume the new package via Nuget as usual.
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure API key authorization: ApiKeyAuth
Configuration.Default.ApiKey.Add("key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("key", "Bearer");
var apiInstance = new APIsApi();
var q = q_example; // string | Pass US Zipcode, UK Postcode, Canada Postalcode, IP address, Latitude/Longitude (decimal degree) or city name. Visit [request parameter section](https://www.weatherapi.com/docs/#intro-request) to learn more.
var dt = 2013-10-20; // DateTime? | Date on or after 1st Jan, 2015 in yyyy-MM-dd format
try
{
// Astronomy API
Object result = apiInstance.Astronomy(q, dt);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling APIsApi.Astronomy: " + e.Message );
}
}
}
}
All URIs are relative to https://api.weatherapi.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
APIsApi | Astronomy | GET /astronomy.json | Astronomy API |
APIsApi | ForecastWeather | GET /forecast.json | Forecast API |
APIsApi | FutureWeather | GET /future.json | Future API |
APIsApi | HistoryWeather | GET /history.json | History API |
APIsApi | IpLookup | GET /ip.json | IP Lookup API |
APIsApi | MarineWeather | GET /marine.json | Marine Weather API |
APIsApi | RealtimeWeather | GET /current.json | Realtime API |
APIsApi | SearchAutocompleteWeather | GET /search.json | Search/Autocomplete API |
APIsApi | TimeZone | GET /timezone.json | Time Zone API |
- Model.Alerts
- Model.AlertsAlert
- Model.ArrayOfSearch
- Model.Astronomy
- Model.AstronomyAstro
- Model.Current
- Model.CurrentAirQuality
- Model.CurrentCondition
- Model.Error400
- Model.Error401
- Model.Error403
- Model.Forecast
- Model.ForecastAstro
- Model.ForecastCondition
- Model.ForecastDay
- Model.ForecastDayCondition
- Model.ForecastForecastday
- Model.ForecastHour
- Model.Ip
- Model.Location
- Model.Marine
- Model.MarineForecastday
- Model.MarineHour
- Model.Search
- Type: API key
- API key parameter name: key
- Location: URL query string