Using API References To Construct Requests

Example: Find the weather element identity (id)

The easiest way to find the element id is using the (1) online element table. Alternatively you can use the (2) API Reference forms:

  1. You can search for any term in the online element table with respect to element codes, element identities, names etc. Columns are also sortable.
    https://frost.met.no/elementtable 

    Link to this table is found in the API's documentation from: https://frost.met.no/concepts#elementids
  2. If you know the old element code, e.g. GD17_I  (interpolated heating degree days with base 17 'C) you can alternatively  find the new element identities (ids) using the API Reference form
    https://frost.met.no/reference#!/elements/getElements 

    Type "GD17_I" in the field "oldElementCodes"

    Use the button "Try it out" which generates the corresponding url-request: https://frost.met.no/elements/v0.jsonld?oldElementCodes=GD17,GD17_I&lang=en-US 

    It retrieves data and display them in the field "Response body". The response has json format. The corresponding element ids to "GD17_I" is found in the variable "id"
      ...
       "data" : [ {
        "id" : "integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0)",
      ...
        "id" : "integral_of_deficit_interpolated(mean(air_temperature P1D) P1Y 17.0)",
      ...
    

NB: Some element ids may not have available time series yet.

Example: Check which and when stations have time series of a specific weather element id

Use the API Reference form
https://frost.met.no/reference#!/observations/timeSeries

Type the element id in the field "elements", e.g.  integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0). Hit the button "Try it out" which generates the url-request:

https://frost.met.no/observations/availableTimeSeries/v0.jsonld?elements=integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0) 

It retrieves data and display them in the field "Response body":

 ...
  "data" : [ {
    "sourceId" : "SN180:0",
    "validFrom" : "1961-01-01T00:00:00.000Z",
    "validTo" : "2004-12-31T00:00:00.000Z",
 ...
 
  

The times series are available from the stations with station numbers given in the variable "sourceId", for the time period given in "validFrom" and "validTo". The ":0" in "<sourceId>:0" means default (main) sensor, while ":1" and ":2" mean parallel sensor 1 and 2.

Example: Get real observation data of a given weather element id for a certain time period

Use the API Reference form
https://frost.met.no/reference#!/observations/observations 

Insert station number, e.g. SN180, in the field sources, reference time period e.g. 2004-12-31T00:00:00/2004-12-31T00:00:00, and element id e.g. integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0)

Hit the button "Try it out" which generates the url-request:

https://frost.met.no/observations/v0.jsonld?sources=SN180&referencetime=2004-01-01T00:00:00/2004-12-31T00:00:00&elements=integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0) 

It retrieves data and display it in the field "Response body"

 ...
"data": [ {
      "sourceId": "SN180:0",
      "referenceTime": "2004-01-01T00:00:00.000Z",
      "observations": [
        {
          "elementId": "integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0)",
          "value": 837.3,
 ... 
  

Example: Check available climate normals

Use the API Reference form:
https://frost.met.no/reference#!/climatenormals/getAvailable 

If you leave all fields empty, you get all available normals for all stations. You can also use wild card search in the "elements" field e.g. *integral_of_deficit*17*, or a specific element id.

Request examples:
https://frost.met.no/climatenormals/available/v0.jsonld?elements=*integral_of_deficit*17* 

https://frost.met.no/climatenormals/available/v0.jsonld?elements=integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0) 

Example of response body field:

 ...
  "data" : [ {
    "sourceId" : "SN10000",
    "elementId" : "integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0)",
    "period" : "1961/1990"
 ...


Example: Retrieve data values of a climate normal element

Use the form
https://frost.met.no/reference#!/climatenormals/getClimateNormals 

Include e.g. the field values from the response body of the example above.

This gives the request:
https://frost.met.no/climatenormals/v0.jsonld?sources=SN10000&elements=integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0)&period=1961/1990 

Output in the field "Response body":

 ...
  "data" : [ {
    "sourceId" : "SN10000",
    "elementId" : "integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0)",
    "period" : "1961/1990",
    "month" : 1,
    "normal" : 896.7
  }, {
    "sourceId" : "SN10000",
    "elementId" : "integral_of_deficit_interpolated(mean(air_temperature P1D) P1M 17.0)",
    "period" : "1961/1990",
    "month" : 2,
    "normal" : 771.3
 ...