This repository has been archived by the owner on Apr 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
AIR-QUALITY-FORECAST-API-BLUEPRINT.apib
287 lines (237 loc) · 11.1 KB
/
AIR-QUALITY-FORECAST-API-BLUEPRINT.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
FORMAT: 1A
HOST: https://air-quality-forecast.weather.mg/
# Air Quality Forecast Service
### Authentication
To access active-warning-service the request has to be authorised with a valid JWT bearer token.
The required scope (within the bearer token) is `air-quality-forecast`.
The documentation about how to authenticate against DTN Weather API with
OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md)
### Search air pollution forecasts for location [GET /pollution/search?locatedAt={locatedAt}&fields={fields}&timeZone={timeZone}]
The Air pollution index shows the 'Daily Air Quality Index' which is dependent on pollutant concentrations averaged over day.
The data for UK comes from UK DEFRA's public air pollution forecast feed and is generated from a regional model working on a 12km grid resolution.
The forecasts are only available in UK. Therefore if a query contains location outside UK, then the app throws error - 404 Not Found
Index Bands
1-3 : Low
4-6 : Moderate
7-9 : High
10 : Very High
+ Request
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Parameters
+ locatedAt: `-0.11,51.51` (string, required) - longitude,latitude;
+ fields: `airPollutionIndex,publishedAt` (string, required) - comma separated list of [airPollutionIndex,publishedAt] or single value;
+ timeZone: `Europe/London` (string, optional) - Time zone refers to the IANA Time Zone Database (TZDB).
+ Response 200 (application/json)
Returns air pollution forecasts for today + 4 days.
+ Body
{
"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"
}
]
}
### Returns all available locations of pollution forecasts in geo json format [GET /pollution/locations]
+ Request
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Response 200 (application/json)
+ Headers
Cache-Control: max-age=71697
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"lastModifiedDate": "2017-06-21T05:00:00Z",
"locationName": "SHAWBURY
},
"geometry": {
"type": "Point",
"coordinates": [
-2.3275,
53.7052
]
}
},
{
"type": "Feature",
"properties": {
"lastModifiedDate": "2017-06-21T05:00:00Z",
"locationName": "SCALLOWAY"
},
"geometry": {
"type": "Point",
"coordinates": [
-2.553,
55.05
]
}
},
...
}
#### Integrated resources
The source of all possible locations for which pollution data are provided: https://uk-air.defra.gov.uk/assets/rss/forecast.xml
### Search pollen forecasts for location [GET /pollen/search?locatedAt={locatedAt}&fields={fields}&timeZone={timeZone}]
Pollen forecast available only on United Kingdom and comes from Met Office data feed. When you try querying outside UK, you are receive response with status code `404 Not Found`.
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
+ Request
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Parameters
+ locatedAt: `-0.11,51.51` (string, required) - longitude,latitude;
+ fields: `pollenForecastRegionName,issuedAt,pollenIndex` (string, required) - comma separated list of [pollenForecastRegionName,issuedAt,pollenIndex] or single value;
+ timeZone: `Europe/London` (string, optional) - Time zone refers to the IANA Time Zone Database (TZDB).
+ Response 200 (application/json)
Returns pollen forecasts for today + 4 days.
+ Body
{
"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"
}
]
}
### Return GeoJson file with regions definitions [GET /pollen/regions.geojson]
This feature collection contains list of geometry shape like as `Polygon` and `MultiPolygon`, each has properties `regionId` and `region`
+ Request
+ Headers
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
+ Response 200 (application/vnd.geo+json)
+ Body
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"regionId": "TA",
"region": "Central, Tayside & Fife"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-2.871093749999943,
56.98291015625017
],
[
-2.808898925781193,
56.95727539062506
],
[
-2.751708984374943,
56.95452880859392
],
[
-2.871093749999943,
56.98291015625017
]
]
]
}
}
]
}