Overview
DTN Air Quality API can provide pollution data for specific location. As an additional for UK it also provides pollen data.
How is the request processed?
Formatting a request to the Air Quality API is different than the Point-Forecast or Observation API.
To retrieve pollution or pollen data you have to provide geo location point by latitude and longitude.
The data is then processed and returned to you, formatted in the JSON format. This makes it easy to use in your business.
Formatting
Pollution
A sample request using the Air Quality API for pollution looks like this:
https://air-quality-forecast.weather.mg/pollution/search?locatedAt=-0.11,51.51&fields=airPollutionIndex,publishedAt
Returns air pollution forecasts for today + 4 days.
The returned data will be formatted in JSON, and will look like this:
{
"forecasts": [
{
"period": "PT24H",
"validFrom": "2017-05-10T01:00:00+01:00",
"validUntil": "2017-05-11T01:00:00+01:00",
"forecastLocation": [ -0.1248, 51.5081 ],
"airPollutionIndex": 3,
"publishedAt": "2017-05-10T07:00:00+01:00"
},
{
"period": "PT24H",
"validFrom": "2017-05-11T01:00:00+01:00",
"validUntil": "2017-05-12T01:00:00+01:00",
"forecastLocation": [ -0.1248, 51.5081 ],
"airPollutionIndex": 5,
"publishedAt": "2017-05-10T07:00:00+01:00"
},
{
"period": "PT24H",
"validFrom": "2017-05-12T01:00:00+01:00",
"validUntil": "2017-05-13T01:00:00+01:00",
"forecastLocation": [ -0.1248, 51.5081 ],
"airPollutionIndex": 3,
"publishedAt": "2017-05-10T07:00:00+01:00"
},
{
"period": "PT24H",
"validFrom": "2017-05-13T01:00:00+01:00",
"validUntil": "2017-05-14T01:00:00+01:00",
"forecastLocation": [ -0.1248, 51.5081 ],
"airPollutionIndex": 3,
"publishedAt": "2017-05-10T07:00:00+01:00"
},
{
"period": "PT24H",
"validFrom": "2017-05-14T01:00:00+01:00",
"validUntil": "2017-05-15T01:00:00+01:00",
"forecastLocation": [ -0.1248, 51.5081 ],
"airPollutionIndex": 3,
"publishedAt": "2017-05-10T07:00:00+01:00"
}
]
}
Pollen
Pollen forecast available only on United Kingdom. When you try querying outside UK, you are receive response with status code 400 Bad Request.
Available pollen forecast separated on 16 regions. The pollenForecastRegion and pollenForecastRegionName parameters refers on table, see below:
Id | Name |
---|---|
DG | SW Scotland, Lothian Borders |
EE | East of England |
EM | East Midlands |
GR | Grampian |
HE | Highlands & Eilean Siar |
NE | North East England |
NI | Northern Ireland |
NW | North West England |
OS | Orkney & Shetland |
SE | London & South East England |
ST | Strathclyde |
SW | South West England |
TA | Central, Tayside & Fife |
WL | Wales |
WM | West Midlands |
YH | Yorkshire & Humber |
The pollenIndex parameters can be one of the following levels: Low, Moderate, High, Veryhigh
A sample request using the Air Quality API for pollen looks like this:
https://air-quality-forecast.weather.mg/pollen/search?locatedAt=-0.11,51.51&fields=pollenForecastRegionName,issuedAt,pollenIndex
Returns polen forecasts for today + 4 days.
The returned data will be formatted in JSON, and will look like this:
{
"forecasts": [
{
"period": "PT24H",
"validFrom": "2017-05-10T01:00:00+01:00",
"validUntil": "2017-05-11T01:00:00+01:00",
"pollenForecastRegion": "SE",
"pollenForecastRegionName": "London & South East England",
"pollenIndex": "Moderate",
"issuedAt": "2017-05-10T06:45:57+01:00"
},
{
"period": "PT24H",
"validFrom": "2017-05-11T01:00:00+01:00",
"validUntil": "2017-05-12T01:00:00+01:00",
"pollenForecastRegion": "SE",
"pollenForecastRegionName": "London & South East England",
"pollenIndex": "Moderate",
"issuedAt": "2017-05-10T06:45:57+01:00"
},
{
"period": "PT24H",
"validFrom": "2017-05-12T01:00:00+01:00",
"validUntil": "2017-05-13T01:00:00+01:00",
"pollenForecastRegion": "SE",
"pollenForecastRegionName": "London & South East England",
"pollenIndex": "Moderate",
"issuedAt": "2017-05-10T06:45:57+01:00"
},
{
"period": "PT24H",
"validFrom": "2017-05-13T01:00:00+01:00",
"validUntil": "2017-05-14T01:00:00+01:00",
"pollenForecastRegion": "SE",
"pollenForecastRegionName": "London & South East England",
"pollenIndex": "Moderate",
"issuedAt": "2017-05-10T06:45:57+01:00"
},
{
"period": "PT24H",
"validFrom": "2017-05-14T01:00:00+01:00",
"validUntil": "2017-05-15T01:00:00+01:00",
"pollenForecastRegion": "SE",
"pollenForecastRegionName": "London & South East England",
"pollenIndex": "Moderate",
"issuedAt": "2017-05-10T06:45:57+01:00"
}
]
}
Authentication
All endpoints are secured using OAuth2 authorization protocol with transmitting data over HTTPS. The authorization flows are described here: authorization flow
For detailed instructions on how to obtain the necessary authorization information, please refer to the technical documentation on GitHub.
Nitty-Gritty
For more detailed information on this API, check us out on GitHub.