Learn how to call the Current Weather Data API.
The Current Weather Data API provides access to weather data for any location worldwide. In this tutorial, you will make your first call to the Current Weather Data API.
To get started with the Current Weather Data API, you need to create a personal account.
Once your email address has been successfully confirmed, you can sign in to your account.
When your account is created, an API key is generated. You need this API key to call the Current Weather Data API.
Your API key is listed under the Key column.
Now that you have your API key, you are ready to make your first call to the Current Weather Data API.
The following example shows how to get the current weather in Paris, France, using cURL in a terminal.
API_KEY
with your API key from Step 2.
https://api.openweathermap.org/data/2.5/weather
is the endpoint for the Current Weather Data API.lat
and lon
parameters specify the geographic coordinates for the location you want to retrieve weather data for. In this example, we’re using the coordinates for Paris, France.appid
parameter is where you need to provide your API key.The JSON response should look something like this:
Let’s look at the response:
coord
object includes the longitude (lon
) and latitude (lat
) of the location.weather
array includes:
id
: Weather condition identifier. For more information, see the Weather condition codes.main
: Group of weather parameters.description
: Weather condition description.icon
: Related weather icon. For more information, see Weather conditions and icons.main
object includes:
temp
: Current temperature in Kelvin.feels_like
: Perceived temperature.temp_min
and temp_max
: Minimum and maximum temperatures at the moment. These are only available for large megalopolises and urban areas.
At the time of the API call, 289.28
is the Kelvin temperature (main.temp
).wind
object includes:
speed
: Wind speed in meters/second.deg
: Wind direction in degrees.clouds
object shows the cloudiness percentage (all
).sys
object includes:
country
: The location’s country code.sunrise
: Sunrise time in Unix time (seconds since Jan 1, 1970, UTC).sunset
: Sunset time in Unix time (seconds since Jan 1, 1970, UTC).For a detailed description of the API response, see the API reference documentation.
You’ve successfully made your first call to the Current Weather Data API. You can now explore more features offered by the API, such as:
Learn how to call the Current Weather Data API.
The Current Weather Data API provides access to weather data for any location worldwide. In this tutorial, you will make your first call to the Current Weather Data API.
To get started with the Current Weather Data API, you need to create a personal account.
Once your email address has been successfully confirmed, you can sign in to your account.
When your account is created, an API key is generated. You need this API key to call the Current Weather Data API.
Your API key is listed under the Key column.
Now that you have your API key, you are ready to make your first call to the Current Weather Data API.
The following example shows how to get the current weather in Paris, France, using cURL in a terminal.
API_KEY
with your API key from Step 2.
https://api.openweathermap.org/data/2.5/weather
is the endpoint for the Current Weather Data API.lat
and lon
parameters specify the geographic coordinates for the location you want to retrieve weather data for. In this example, we’re using the coordinates for Paris, France.appid
parameter is where you need to provide your API key.The JSON response should look something like this:
Let’s look at the response:
coord
object includes the longitude (lon
) and latitude (lat
) of the location.weather
array includes:
id
: Weather condition identifier. For more information, see the Weather condition codes.main
: Group of weather parameters.description
: Weather condition description.icon
: Related weather icon. For more information, see Weather conditions and icons.main
object includes:
temp
: Current temperature in Kelvin.feels_like
: Perceived temperature.temp_min
and temp_max
: Minimum and maximum temperatures at the moment. These are only available for large megalopolises and urban areas.
At the time of the API call, 289.28
is the Kelvin temperature (main.temp
).wind
object includes:
speed
: Wind speed in meters/second.deg
: Wind direction in degrees.clouds
object shows the cloudiness percentage (all
).sys
object includes:
country
: The location’s country code.sunrise
: Sunrise time in Unix time (seconds since Jan 1, 1970, UTC).sunset
: Sunset time in Unix time (seconds since Jan 1, 1970, UTC).For a detailed description of the API response, see the API reference documentation.
You’ve successfully made your first call to the Current Weather Data API. You can now explore more features offered by the API, such as: