API/2.0/JSON API

From OpenWeatherMap
Jump to: navigation, search

Contents

Getting Data from JSON version 2.0

All data can be obtained in JSON format. The following interfaces for data obtaining have already developed and available for everybody:

  • Weather Stations with last data
  • Cities with the current weather data
  • History of measurement for each weather station

When using data from this web-site please comply the conditions of the CC-BY-SA license

Previous versions of API API/1.0/JSON API



Find

This API group let you receive actual data from weather stations and currect weather in cities all over the world. You can choose different searching ways:

  • Choose a rectangle shaped area boarded by geographic coordiates. As a result you get list of weather stations existed within the chosen area.
  • Choose coordinates of a geo point and receive list of the nearest weather stations.
  • Choose a geo point and max distance to it. As a result you get all geo points that lay within the chosen max distance.



Find around point

Example

Choose a geo point and max weather station quantity. As a result you get a list of weather stations that lay arount the geo point.

The same is for the list of current weather in cities


Parametrs

To find weather stations

Parametr Description
lat latitude
lon longitude
cnt Limit the number of points in the selection
callback functionName for JSONP calback. http://en.wikipedia.org/wiki/JSONP
cluster Use server clustering of points. Possible values ​​are [yes, no]
lang Language [ru, en, de, fr, es, it] if is posible

Result

Weather

{"message":"type=cityModel:GFS-OWM, zoom=5","cod":"200","calctime":0.0141,"cnt":42,"list":[

{"id":88319,"dt":1345284000,"name":"Benghazi",
    "coord":{"lat":32.12,"lon":20.07},
    "main":{"temp":306.15,"pressure":1013,"humidity":44,"temp_min":306,"temp_max":306},
    "wind":{"speed":1,"deg":-7},
    "clouds":{"all":0},
    "rain":{"3h":0}},
,...

More about data API/2.0/Weather_Data

Stations

{"message":"type=station, fetch=0.0495, allcnt=842","cod":"200","calctime":0.6788,"cnt":682,"list":[

{"id":5995,"dt":1345280400,"rang":50,"cluster":2,"name":"Sibiu","type":1,
    "coord":{"lat":45.7858,"lon":24.0856},
    "main":{"temp":297.15,"pressure":1021,"humidity":44},
    "wind":{"speed":3.1,"deg":360}},
....

More about data API/2.0/Station_Data



Bounding Box find

JSON query returns the data from cities or weather stations that have meteorological information and whose geographic coordinates lay within the rectangle BBOX

Example

Parametrs

To find stations

Parametr Description
bbox Bounding Box
callback javascript functionName
cluster Use server clustering of points. Possible values ​​are [yes, no]
lang Language [ru, en ... ]


Result

Like a center find More about data



Find City via name

Find city via its name. The inquiry retunes list of cities that match search substring. http://openweathermap.org/data/2.0/find/name?q=london


City

City list

All citys at system http://openweathermap.org/help/city_list.txt


Current weather at the city

You can get current weather in concrete chosen city. For that you need to know city ID. You can get data as JSON or HTML code.

openweathermap.org/data/2.0/weather/city/{CITY_ID}?type={json|html}

example


City forecast

Weather forecast in the city for the next 5 days.

http://openweathermap.org/data/2.0/forecast/city/{CITY_ID}

http://openweathermap.org/data/2.0/forecast/city/524901

{"message":"","cod":"200","calctime":0.0189,"list":[
{"dt":1345251600,
    "main":{"temp":286.6,"humidity":98,"pressure":1002,"temp_min":286,"temp_max":287},
    "wind":{"speed":0,"deg":-2},
    "rain":{"3h":2},
    "clouds":{"all":56},
....



Stations current

Last measures made by weather station with ID = STATION_ID You can get data as JSON or HTML code.

openweathermap.org/data/2.0/weather/station/{STATION_ID}?type={json|html}

example


Stations history

Set of requests let you get weather station measured data.

Parametr Description
type [tick, hour, day ]
start Data start (unix time)
end Data end (unix time)


history tick

List of several measurements made by weather station.

{"message":"millis 0","cod":"200","type":"tick","station_id":39419,"calctime":" find=0.0091 sort=0.0092 fetch=0.0103 total=0.0108","cnt":30,"list":[

{"dt":1345291920,
    "main":{"temp":291.55,"humidity":95,"pressure":1009.3},
    "wind":{"speed":0,"gust":0.3},
    "rain":{"1h":0.6,"today":2.7},
    "calc":{"dewpoint":17.6} }
...

API/2.0/Station_Data

history hours

Measurements grouped by hours.

{"message":"millis 0","cod":"200","type":"hour","station_id":39419,"calctime":" find=0.0091 fetch=0.0109 total=0.011","cnt":27,"list":[

{"dt":1345190400,
   "rain":{
       "1h":{"v":0,"c":6,"mi":0,"ma":0},
       "today":{"v":0.9,"c":6,"mi":0.9,"ma":0.9}},
   "calc":{
       "dewpoint":{"v":16.35,"c":6,"mi":16.1,"ma":16.8}},
   "wind":{
       "speed":{"v":0,"c":6,"mi":0,"ma":0},
       "gust":{"v":0.62,"c":6,"mi":0.3,"ma":1.4}},
   "main":{
       "humidity":{"v":71.67,"c":6,"mi":68,"ma":74},
       "temp":{"v":294.87,"c":6,"mi":294.15,"ma":295.45},
       "pressure":{"v":1009.97,"c":6,"mi":1009.9,"ma":1010}}},
.....


history days

Measurements grouped by days.


Restrictions

Please treat with understanding to the limited capabilities of our servers. If you send more than 2,000 requests per hour we can limit the speed of response to your requests or even refuse to service them. Anyway if you need a large volume of data please contact us. We do the best to find appropriate solution.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox