OpenWeather
How to get current weather from OpenWeather
Use the Current Weather API for conditions at a set of coordinates. If your application subscribes to One Call, its version 4.0 current endpoint also returns details such as dew point and UV index.
Documentation reviewed · 2 methods with sources
Ways to do it
API
GET /data/2.5/weather
Retrieve current conditions for coordinates with optional units and language.
Read source: OpenWeather Current Weather Data- Requirements
- An OpenWeather API key supplied as appid. Latitude and longitude identify the location.
- Limitations
- The endpoint returns one current-condition object. Temperature defaults to Kelvin. Set units=metric for Celsius or units=imperial for Fahrenheit.
Example shell
curl --fail --get 'https://api.openweathermap.org/data/2.5/weather' \
--data-urlencode 'lat=44.34' \
--data-urlencode 'lon=10.99' \
--data-urlencode 'units=metric' \
--data-urlencode "appid=$OPENWEATHER_API_KEY"API
GET /data/4.0/onecall/current
Retrieve one current-conditions record from One Call 4.0 for coordinates.
Read source: OpenWeather One Call API 4.0- Requirements
- An OpenWeather API key supplied as appid, plus latitude and longitude. One Call 4.0 access requires the separate One Call API subscription.
- Limitations
- The current endpoint returns one record per request. The subscription includes 1,000 free calls per day and starts with a daily request cap of 2,000.
Example shell
curl --fail --get 'https://api.openweathermap.org/data/4.0/onecall/current' \
--data-urlencode 'lat=52.2297' \
--data-urlencode 'lon=21.0122' \
--data-urlencode 'units=metric' \
--data-urlencode "appid=$OPENWEATHER_API_KEY"