curl --request GET \
--url 'https://api.openweathermap.org/data/2.5/weather?appid='import requests
url = "https://api.openweathermap.org/data/2.5/weather?appid="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.openweathermap.org/data/2.5/weather?appid=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openweathermap.org/data/2.5/weather?appid=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.openweathermap.org/data/2.5/weather?appid="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.openweathermap.org/data/2.5/weather?appid=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openweathermap.org/data/2.5/weather?appid=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"coord": {
"lon": 123,
"lat": 123
},
"weather": [
{
"id": 123,
"main": "<string>",
"description": "<string>",
"icon": "<string>"
}
],
"base": "<string>",
"main": {
"temp": 123,
"feels_like": 123,
"pressure": 123,
"humidity": 123,
"temp_min": 123,
"temp_max": 123,
"sea_level": 123,
"grnd_level": 123
},
"visibility": 123,
"wind": {
"speed": 123,
"deg": 123,
"gust": 123
},
"clouds": {
"all": 123
},
"rain": {
"1h": 123,
"3h": 123
},
"snow": {
"1h": 123,
"3h": 123
},
"dt": 123,
"sys": {
"type": 123,
"id": 123,
"message": 123,
"country": "<string>",
"sunrise": 123,
"sunset": 123
},
"timezone": 123,
"id": 123,
"name": "<string>",
"cod": 123
}{
"cod": 400,
"message": "Nothing to geocode"
}{
"cod": 401,
"message": "Invalid API key. Please see https://openweathermap.org/faq#error401 for more info."
}{
"cod": 123,
"message": "<string>"
}Current Weather Data API
Reference for the Current Weather Data API endpoint.
curl --request GET \
--url 'https://api.openweathermap.org/data/2.5/weather?appid='import requests
url = "https://api.openweathermap.org/data/2.5/weather?appid="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.openweathermap.org/data/2.5/weather?appid=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openweathermap.org/data/2.5/weather?appid=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.openweathermap.org/data/2.5/weather?appid="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.openweathermap.org/data/2.5/weather?appid=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openweathermap.org/data/2.5/weather?appid=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"coord": {
"lon": 123,
"lat": 123
},
"weather": [
{
"id": 123,
"main": "<string>",
"description": "<string>",
"icon": "<string>"
}
],
"base": "<string>",
"main": {
"temp": 123,
"feels_like": 123,
"pressure": 123,
"humidity": 123,
"temp_min": 123,
"temp_max": 123,
"sea_level": 123,
"grnd_level": 123
},
"visibility": 123,
"wind": {
"speed": 123,
"deg": 123,
"gust": 123
},
"clouds": {
"all": 123
},
"rain": {
"1h": 123,
"3h": 123
},
"snow": {
"1h": 123,
"3h": 123
},
"dt": 123,
"sys": {
"type": 123,
"id": 123,
"message": 123,
"country": "<string>",
"sunrise": 123,
"sunset": 123
},
"timezone": 123,
"id": 123,
"name": "<string>",
"cod": 123
}{
"cod": 400,
"message": "Nothing to geocode"
}{
"cod": 401,
"message": "Invalid API key. Please see https://openweathermap.org/faq#error401 for more info."
}{
"cod": 123,
"message": "<string>"
}Authorizations
Query Parameters
API key for authentication
Latitude of the desired location
-90 <= x <= 90Longitude of the desired location
-180 <= x <= 180Response format.
Default is json if you don't use the mode parameter.
html, json, xml Units of measurement:
standard: Kelvin for temperature, meters per second for wind speed and wind gustmetric: Celsius for temperature, meters per second for wind speed and wind gustimperial: Fahrenheit for temperature, miles per hour for wind speed and wind gust
Default is standard if you don't use the units parameter.
standard, metric, imperial Output language for weather description (weather.description) and city name (name) fields in the API response.
Available options:
sq: Albanianaf: Afrikaansar: Arabicaz: Azerbaijanieu: Basquebe: Belarusianbg: Bulgarianca: Catalanzh_cn: Chinese Simplifiedzh_tw: Chinese Traditionalhr: Croatiancz: Czechda: Danishnl: Dutchen: Englishfi: Finnishfr: Frenchgl: Galiciande: Germanel: Greekhe: Hebrewhi: Hindihu: Hungarianis: Icelandicid: Indonesianit: Italianja: Japanesekr: Koreanku: Kurmanji (Kurdish)la: Latvianlt: Lithuanianmk: Macedonianno: Norwegianfa: Persian (Farsi)pl: Polishpt: Portuguesept_br: Português Brasilro: Romanianru: Russiansr: Serbiansk: Slovaksl: Sloveniansp,es: Spanishsv,se: Swedishth: Thaitr: Turkishua,uk: Ukrainianvi: Vietnamesezu: Zulu
Default is English if you don't use the lang parameter.
Response
Successful response - Current weather data
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Internal parameter
Show child attributes
Show child attributes
Visibility (meters)
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Time of data calculation, in Unix time (UTC)
Show child attributes
Show child attributes
Shift in seconds from UTC
City identifier
City name
API response status code