METOC Server Application Programming Interface

METOC forecast information can be accessed using a web application programming interface (API). We have opted for a simple and user friendly solution using the HyperText Transfer Protocol (HTTP) and Javascript Object Notation.

Most modern programming languages have facilities to access internet URLs using the HTTP protocol and to convert JSON to native data structures (see json.org for libraries for this). Since your browser uses the HTTP protocol as well you can simply try out the examples below in your browser by clicking on them (we only use GET requests).

Information requests

/info/parameters
Returns list of available forecast parameters:
[par1, par2, par3,...]
Example: http://metoc.fcoo.dk/webapi/info/parameters

/info/timerange
Returns minimum and maximum time (YYYY-MM-DDThh:mm:ss) for a given parameter:
[tmin, tmax]
Required arguments:
  • p=<parameter>: Forecast parameter
Example: http://metoc.fcoo.dk/webapi/info/timerange?p=Temperature

/info/area
Returns area for which we have forecasts for a given parameter:
[tmin, tmax]
Required arguments:
  • p=<parameter>: Forecast parameter
Example: http://metoc.fcoo.dk/webapi/info/area?p=Temperature

Plot requests

/plot/timeseries
Returns a plot of a timeseries at a geographical location:
Required arguments:
  • p=<parameter>: Forecast parameter
  • x=<longitude>: Longitude of point
  • y=<latitude>: Latitude of point
Example: http://metoc.fcoo.dk/webapi/plot/timeseries?p=Wind&x=10.5&y=58

/plot/profile
Returns a plot of a profile at a geographical location:
Required arguments:
  • p=<parameter>: Forecast parameter
  • x=<longitude>: Longitude of point
  • y=<latitude>: Latitude of point
  • t=<time>: Time
  • nx=<xsize>: Png size (pixels) in x direction
  • ny=<xsize>: Png size (pixels) in y direction
Example: http://metoc.fcoo.dk/webapi/plot/profile?p=Temperature&x=10.5&y=58&t=2024-12-26T18:24:28&nx=800&ny=800

/plot/timeseries_profile
Returns a plot of a timeseries profile at a geographical location:
Required arguments:
  • p=<parameter>: Forecast parameter
  • x=<longitude>: Longitude of point
  • y=<latitude>: Latitude of point
  • nx=<xsize>: Png size (pixels) in x direction
  • ny=<xsize>: Png size (pixels) in y direction
Example: http://metoc.fcoo.dk/webapi/plot/timeseries_profile?p=Temperature&x=10.5&y=58&nx=800&ny=800

Data requests

It is also possible to request data directly instead of plots using an interface which is similar to the one used for plots. This feature is somewhat more advanced and has not been tested as much as the other features and the API is not completely stable. If you would like to use it you should therefore contact us so that we can discuss the possibilites.

Error handling

The FCOO METOC Server uses HTTP status codes to signal errors. If you for example request an unavailable resource or request data from an invalid geographical position the server will return a HTTP status code and message that tells you what has happened. These errors will normally cause the HTTP library that you are using to throw an error. It is then your responsibility to catch the error and decide what to do with it. Follow the link to read more about HTTP return codes.

The FCOO METOC Server uses the standard status codes with code 500 for (unexpected) internal server errors. When no data are available for a given request an error code of 404 (Not Found) is returned. When code 404 or code 500 is returned it will always be accompanied by a JSON response in the following format describing the error:

{"message": "Text describing the type of error"}