Meteorologisk Institutt

Meteorologisk Institutt

Weather

Weather and climate data. This is version 3 of the MET Weather API. For a list of changes since version 2, see the Release Notes for v.3. The weather data API is loosely based on the REST style of web service programming. All queries are done via HTTP GET, and the results are returned as either XML or the binary format appropriate for the data, as documented by each module.

Visit API

📚 Documentation & Examples

Everything you need to integrate with Meteorologisk Institutt

🚀 Quick Start Examples

Meteorologisk Institutt Javascript Examplejavascript
// Meteorologisk Institutt API Example
const response = await fetch('https://api.met.no/weatherapi/documentation', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Using the MET Norway Weather API

The MET Norway Weather API is a publicly available API that offers data related to the weather in Norway. This API can be accessed using HTTP GET and POST requests, and it returns data in JSON and XML formats.

Getting Started

To use the MET Norway Weather API, you will need an API key. You can obtain an API key by registering on the API website.

Once you have an API key, you can start making requests to the API. You can use any programming language that supports HTTP requests and JSON/XML parsing, but for this tutorial, we will be using JavaScript.

Example Code

The following code shows how to make a basic weather forecast request using JavaScript:

const apiKey = 'YOUR_API_KEY';
const city = 'Oslo';

const requestUrl = `https://api.met.no/weatherapi/locationforecast/2.0/compact?latlon=${city}`;

const response = await fetch(requestUrl, {
  headers: { 'Authorization': `Bearer ${apiKey}` },
});

const data = await response.json();

console.log(data.properties.timeseries[0].data.instant.details.air_temperature);

In this example code, we first set our API key and the city we want to get a weather forecast for. We then construct the request URL by concatenating the base URL for the MET Norway Weather API with the latlon parameter set to our city.

We then use the fetch function to make the HTTP request to the API, passing in our API key as a bearer token in the Authorization header.

Finally, we parse the response as JSON using the json method of the response object, and we log the air temperature data for the current time in the city.

Conclusion

The MET Norway Weather API is a useful tool for obtaining weather-related data in Norway. With the code examples provided in this tutorial, you should be able to get started with making requests to this API using JavaScript.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 9Jun 11Jun 13Jun 15Jun 17Jun 19Jun 21Jun 23Jun 25Jun 27Jun 29Jul 1Jul 3Jul 5Jul 804008001440Minutes
Online
Offline

Related APIs in Weather