OpenWeather Connector

A comprehensive overview of how to integrate the OpenWeather API, including API call formats, parameters, and expected responses

How to Start

To get started with OpenWeather, follow these steps:

  1. Sign Up: If you haven't already, sign up for the OpenWeather service to obtain your OpenWeather API key.
  2. Pricing Information: Visit the pricing page to learn about the subscription details and costs.
  3. One Call API 3.0: This API is available under a separate subscription and allows you to pay only for the number of API calls made. By default, when you subscribe to One Call API 3.0, you get 2000 API calls per day. You can adjust this limit by visiting the "Billing plans" tab in your personal account. For more details, consult the FAQ section.
  4. Select Data Type: Choose the desired type of weather data (e.g., current and forecasted weather, daily aggregation, etc.) and make an API call according to the relevant technical documentation.

Making an API Call

To access the weather data, you can use the following API call format:

bash
Copy code
https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&exclude={part}&appid={API key}

Parameters

  • lat (required): Latitude of the location (decimal, -90 to 90). For automatic conversion of city names and zip codes to geo-coordinates, use the Geocoding API.
  • lon (required): Longitude of the location (decimal, -180 to 180). For automatic conversion of city names and zip codes to geo-coordinates, use the Geocoding API.
  • appid (required): Your unique API key (found on your account page under the "API key" tab).
  • exclude (optional): Comma-separated list of data parts to exclude from the API response (e.g., current, minutely, hourly, daily, alerts).
  • units (optional): Units of measurement. Available options include standard, metric, and imperial. If not specified, standard units are applied by default.
  • lang (optional): Specify the output language using this parameter.

Example API Calls

  • API Call without Exclusions:

    bash
    Copy code
    https://api.openweathermap.org/data/3.0/onecall?lat=33.44&lon=-94.04&appid={API key}
  • API Call with Exclusions:

    bash
    Copy code
    https://api.openweathermap.org/data/3.0/onecall?lat=33.44&lon=-94.04&exclude=hourly,daily&appid={API key}

Example of API Response

Here is an example of what a typical API response might look like:

json
Copy code
{
"lat": 33.44,
"lon": -94.04,
"timezone": "America/Chicago",
"timezone_offset": -18000,
"current": {
"dt": 1684929490,
"sunrise": 1684926645,
"sunset": 1684977332,
"temp": 292.55,
"feels_like": 292.87,
"pressure": 1014,
"humidity": 89,
"weather": [{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04d"
}]
},
...
}

Fields in API Response

  • lat: Latitude of the location.
  • lon: Longitude of the location.
  • timezone: Timezone name for the requested location.
  • current: Current weather data, including temperature, pressure, humidity, and weather conditions.

Weather Data for a Timestamp

To access weather data for any specific timestamp (from January 1, 1979, to four days ahead), use the following API call format:

css
Copy code
https://api.openweathermap.org/data/3.0/onecall/timemachine?lat={lat}&lon={lon}&dt={time}&appid={API key}

Parameters

  • lat (required): Latitude of the location (decimal, -90 to 90).
  • lon (required): Longitude of the location (decimal, -180 to 180).
  • dt (required): Timestamp (Unix time, UTC time zone).
  • appid (required): Your unique API key.
  • units (optional): Units of measurement (standard, metric, imperial).
  • lang (optional): Output language.

Example API Call

bash
Copy code
https://api.openweathermap.org/data/3.0/onecall/timemachine?lat=39.099724&lon=-94.578331&dt=1643803200&appid={API key}

Example API Response

json
Copy code
{
"lat": 52.2297,
"lon": 21.0122,
"timezone": "Europe/Warsaw",
"timezone_offset": 3600,
"data": [{
"dt": 1645888976,
"temp": 279.13,
"feels_like": 276.44,
"pressure": 1029,
"humidity": 64,
"weather": [{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}]
}]
}

Daily Aggregation

To access aggregated weather data for a particular date, use the following API call format:

bash
Copy code
https://api.openweathermap.org/data/3.0/onecall/day_summary?lat={lat}&lon={lon}&date={date}&appid={API key}

Parameters

  • lat (required): Latitude of the location (decimal, -90 to 90).
  • lon (required): Longitude of the location (decimal, -180 to 180).
  • date (required): Date in YYYY-MM-DD format.
  • appid (required): Your unique API key.
  • units (optional): Units of measurement.
  • lang (optional): Output language.
  • tz (optional): Specify the correct timezone manually if needed.

Example API Call

bash
Copy code
https://api.openweathermap.org/data/3.0/onecall/day_summary?lat=60.45&lon=-38.67&date=2023-03-30&appid={API key}

Example API Response

json
Copy code
{
"lat": 33,
"lon": 35,
"tz": "+02:00",
"date": "2020-03-04",
"cloud_cover": {
"afternoon": 0
},
"temperature": {
"min": 286.48,
"max": 299.24,
"afternoon": 296.15
},
...
}

Weather Overview

To get a human-readable weather summary for today and tomorrow's forecast, use the following API call format:

bash
Copy code
https://api.openweathermap.org/data/3.0/onecall/overview?lat={lat}&lon={lon}&appid={API key}

Parameters

  • lat (required): Latitude of the location (decimal, -90 to 90).
  • lon (required): Longitude of the location (decimal, -180 to 180).
  • appid (required): Your unique API key.
  • date (optional): Date for which the weather summary is requested.
  • units (optional): Units of measurement.

Example API Call

bash
Copy code
https://api.openweathermap.org/data/3.0/onecall/overview?lon=-11.8092&lat=51.509865&appid={API key}

Example API Response

json
Copy code
{
"lat": 51.509865,
"lon": -0.118092,
"tz": "+01:00",
"date": "2024-05-13",
"weather_overview": "The current weather is overcast with a temperature of 16°C..."
}

Additional Features

Units of Measurement

You can specify the units of measurement for temperature and wind speed using the units parameter. The options include:

  • Standard: Kelvin
  • Metric: Celsius
  • Imperial: Fahrenheit

Multilingual Support

You can use the lang parameter to receive output in your preferred language. A comprehensive list of supported languages is available.

List of National Weather Alerts Sources

OpenWeather provides national weather alerts from various agencies worldwide. A detailed list of these agencies is available in the OpenWeather API documentation.


This knowledge base document provides a comprehensive overview of how to integrate the OpenWeather API, including API call formats, parameters, and expected responses. Let me know if you need any further adjustments or additional information!