Weather forecast REST API

Last revision: 2015-05-19

This API allows to access Meteo France weather forecast data for places in several european countries, in a unified JSON format ready for use in client applications. JSONP is also available.


Available requests

There are three forms of request, to access different types of data:

  1. The next available forecast for multiple places, selected by a variety of criteria
  2. Extended forecasts on a single place, selected by identifier
  3. Extended forecasts on a single place, selected by location

Next forecast on multiple places (optionally limited to an area/countries)

Url template

~/places?bbox={bbox}&countries={countries}&lvl={lvl}

Parameters

Note: All the parameters are optional.

Result

An array of places matching the criteria. Each place object contains a forecasts array with one element only, the next available forecast for this place.

Example for http://weatherforecasts.mediamobile.com/places/?lvl=1&bbox=48.5,2.0,49,3.0

[
    {
        "id": -91200,
        "name": "Dourdan",
        "country": "fr",
        "lat": 48.5333,
        "lng": 2.01667,
        "lvl": 1,
        "forecasts": [
            {
                "desc": "Pluies éparses",
                "dt": "2014-02-11T16:00:00.0000000",
                "picto": "pj27",
                "temp": 8,
                "windir": 200,
                "winstr": 8
            }
        ]
    },
    {
        "id": -77288,
        "name": "Melun",
        "country": "fr",
        "lat": 48.5333,
        "lng": 2.66667,
        "lvl": 1,
        "forecasts": [
            {
                "desc": "Pluies éparses",
                "dt": "2014-02-11T16:00:00.0000000",
                "picto": "pj27",
                "temp": 8,
                "windir": 200,
                "winstr": 8
            }
        ]
    },
    {
        "id": -77284,
        "name": "Meaux",
        "country": "fr",
        "lat": 48.95,
        "lng": 2.86667,
        "lvl": 1,
        "forecasts": [
            {
                "desc": "Pluies éparses",
                "dt": "2014-02-11T16:00:00.0000000",
                "picto": "pj27",
                "temp": 8,
                "windir": 200,
                "winstr": 8
            }
        ]
    }
]

Next forecasts for a single place, by id

Url template

~/places/{id}?dt={dt}&n={n}

Parameters

Note: all the parameters are optional.

Result

A single place object, with a forecasts array containing at most the n next ordered forecasts, starting from dt.

Example for http://weatherforecasts.mediamobile.com/places/1001?n=5

{
    "id": 1001,
    "name": "Jan Mayen",
    "country": "no",
    "lat": 70.9333333333,
    "lng": -8.66666666667,
    "lvl": 0,
    "forecasts": [
        {
            "desc": "Couvert",
            "dt": "2014-02-11T18:00:00.0000000",
            "picto": "pj03",
            "temp": -3,
            "windir": 15,
            "winstr": -3
        },
        {
            "desc": "Couvert",
            "dt": "2014-02-11T21:00:00.0000000",
            "picto": "pn03",
            "temp": -3,
            "windir": 15,
            "winstr": -3
        },
        {
            "desc": "Couvert",
            "dt": "2014-02-12T00:00:00.0000000",
            "picto": "pn03",
            "temp": -3,
            "windir": 10,
            "winstr": -3
        },
        {
            "desc": "Couvert",
            "dt": "2014-02-12T03:00:00.0000000",
            "picto": "pn03",
            "temp": -2,
            "windir": 10,
            "winstr": -2
        },
        {
            "desc": "Couvert",
            "dt": "2014-02-12T06:00:00.0000000",
            "picto": "pj03",
            "temp": -2,
            "windir": 25,
            "winstr": -2
        }
    ]
}

Next forecasts for a single place, by position

Instead of using ids to get place details, it's possible to use a position. The returned place will be the closest one from the latitude/longitude coordinates.

Url template

~/places/closest/{lat},{lng}?dt={dt}&n={n}

Parameters

Same as previous request.

Result

Same as previous request.

Result description

The place object

the forecast object

Localization

The API has built-in support for multiple languages, to save client apps from having to manage it. Thus, the desc field included in each forecast will be translated in the specified language.

A list of the currently supported languages can be obtained by making the request: ~/languages.

As of March 2014, the result of this request is:

[
    "en",
    "fr",
    "da",
    "pl",
    "sv",
    "fi",
    "no"
]

The first one (english) is the default language.

Specifying the language

There are two different ways of specifying the result language:

If the lang parameter is used, the Accept-Language value is ignored.

If the language specified is not supported (example: request coming from a browser in japanese or using the lang=ja parameter), the default language will be used.

JSONP

All the requests support the JSONP mechanism, to allow requests from JavaScript code not compliant with the same-origin policy.

Requests are returned as JSONP if and only if the url includes a callback parameter, specifying the name of the JavaScript callback function to use. JSONP-formatted result are returned with the application/x-javascript content type.

Pictograms

The picto field of forecast objects refer to one of the icons used to represent a weather condition.

An icon url can be obtained from the service at ~/pictos/{picto}.png, but for real applications it is better to work localy with the whole icon set.

Zip file of the pictogram set.