Back to data catalog
Weather API
Global weather forecasts and information about sunrise and sunset
OpenAPI Spec
Specification of all endpoints available in the weather api.
Github
Explore the source code behind the weather api.
More info
Data sources
The data for this Weather API is exclusively retrieved from https://api.met.no, renowned for its comprehensive and accurate meteorological data. This source provides users with dependable weather forecasts and precise information on sunrise and sunset times. Unless specified otherwise, all data and products are licensed under the Norwegian Licence for Open Government Data (NLOD) 2.0 and Creative Commons 4.0 BY International licences.
Processing
The data obtained from the Norwegian Meteorological Institute is presented as is, without any further processing or modification.
Examples
Example 1
Retrieving weather forecast for a given location for the next 9 days.
const response = await fetch(
"https://api.openepi.io/weather/locationforecast?lat=52.520008&lon=13.404954"
)
const json = await response.json()
// Get the instant air temperature
const airTemperature =
json.properties.timeseries[0].data.instant.details.air_temperature
console.log(`Air temperature: ${airTemperature}`)
from httpx import Client
with Client() as client:
response = client.get(
url="https://api.openepi.io/weather/locationforecast",
params={"lat": 52.520008, "lon": 13.404954},
)
# Get the instant air temperature
json = response.json()
air_temperature = json["properties"]["timeseries"][0]["data"]["instant"]["details"][
"air_temperature"
]
print(f"Air temperature: {air_temperature}")
import io.openepi.weather.api.WeatherApi;
import io.openepi.weather.model.METJSONForecast;
import io.openepi.common.ApiException;
import java.math.BigDecimal;
public class Main {
public static void main(String[] args) {
BigDecimal lat = new BigDecimal("52.52");
BigDecimal lon = new BigDecimal("13.40");
WeatherApi api = new WeatherApi();
try {
METJSONForecast response = api.getForecastLocationforecastGet(lat, lon, null);
// Get the instant air temperature
BigDecimal airTemperature = response.getProperties().getTimeseries().get(0).getData().getInstant().getDetails().getAirTemperature();
System.out.println("Air temperature: " + airTemperature);
} catch (ApiException e) {
System.err.println("Exception when calling WeatherApi#getForecastLocationforecastGet");
e.printStackTrace();
}
}
}