Professional Documents
Culture Documents
1.
Home
2.
API
3.
Historical data
By city ID
Description:
Call historical data by city ID. API responds with exact result.
List of city ID city.list.json.gz can be downloaded
here http://bulk.openweathermap.org/sample/
API call:
http://history.openweathermap.org/data/2.5/history/city?
id={id}&type=hour&start={start}&end={end}
http://history.openweathermap.org/data/2.5/history/city?
id={id}&type=hour&start={start}&cnt={cnt}
Parameters:
id city ID
type type of the call, keep this parameter in the API call as 'hour'
start start date (unix time, UTC time zone), e.g. start=1369728000
end end date (unix time, UTC time zone), e.g. end=1369789200
cnt amount of returned data (one per hour, can be used instead of 'end')
Examples of API calls:
http://history.openweathermap.org/data/2.5/history/city?id=2885679&type=hour
By city name
Description:
Call historical data by city name.
API call:
http://history.openweathermap.org/data/2.5/history/city?q={city ID},{country
code}&type=hour&start={start}&end={end}
http://history.openweathermap.org/data/2.5/history/city?q={city ID},{country
code}&type=hour&start={start}&cnt={cnt}
Parameters:
q city name and country code divided by comma, use ISO 3166 country codes
type type of the call, keep this parameter in the API call as 'hour'
start start date (unix time, UTC time zone), e.g. start=1369728000
end end date (unix time, UTC time zone), e.g. end=1369789200
cnt amount of returned data (one per hour, can be used instead of 'end')
Exmaples of API calls:
http://history.openweathermap.org/data/2.5/history/city?q=London,UK
By geographic coordinates
Description:
Call historical data by city name.
API call:
http://history.openweathermap.org/data/2.5/history/city?
lat={lat}&lon={lon}&type=hour&start={start}&end={end}
http://history.openweathermap.org/data/2.5/history/city?
lat={lat}&lon={lon}&type=hour&start={start}&cnt={cnt}
Parameters:
lat, lon coordinates of the location of your interest
type type of the call, keep this parameter in the API call as 'hour'
start start date (unix time, UTC time zone), e.g. start=1369728000
end end date (unix time, UTC time zone), e.g. end=1369789200
cnt amount of returned data (one per hour, can be used instead of 'end')
Examples of API calls:
http://history.openweathermap.org/data/2.5/history/city?lat=41.85&lon=-87.65
JSON
Example of API response:
{"coord":
{"lon":145.77,"lat":-16.92},
"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],
"base":"cmc stations",
"main":
{"temp":293.25,"pressure":1019,"humidity":83,"temp_min":289.82,"temp_max":29
5.37},
"wind":{"speed":5.1,"deg":150},
"clouds":{"all":75},
"rain":{"3h":3},
"dt":1435658272,
"sys":
{"type":1,"id":8166,"message":0.0166,"country":"AU","sunrise":1435610796,"sunse
t":1435650870},
"id":2172797,
"name":"Cairns",
"cod":200}
Parameters:
coord
main
main.temp Temperature. Unit Default: Kelvin, Metric: Celsius, Imperial:
Fahrenheit.
main.pressure Atmospheric pressure (on the sea level, if there is no
main.humidity Humidity, %
wind
wind.speed Wind speed. Unit Default: meter/sec, Metric: meter/sec,
Imperial: miles/hour.
o
clouds
rain
clouds.all Cloudiness, %
snow
id City ID
},