-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openAPI-docu.yaml
423 lines (404 loc) · 12.8 KB
/
openAPI-docu.yaml
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# SPDX-FileCopyrightText: Nucleus <nucleus-ffm@posteo.de>
# SPDX-License-Identifier: AGPL-3.0-or-later
openapi: 3.1.0
info:
title: "FOSS Public Alert Server API"
version: '1.0.0'
description: 'This is the API for the FOSS Public Alert Server. The server is in an early testing phase, and the API may change in the near future.'
termsOfService: 'https://invent.kde.org/webapps/foss-public-alert-server/-/wikis/Terms-of-Service'
contact:
name: FOSS Public Alert Server
url: https://invent.kde.org/webapps/foss-public-alert-server/
email: nucleus-ffm@posteo.de, vkrause@kde.org
servers:
- url: https://todo.de
tags:
- name: Subscription
- name: Alerts
- name: Alert Sources
paths:
/subscription/subscribe:
post:
summary: Subscribe for a new area
description: Subscribe a client to a UnifiedPush endpoint for an area defined by a bounding box with coordinates.
tags:
- Subscription
requestBody:
description: Register a new client
content:
application/json:
schema:
$ref: '#/components/schemas/new_subscription'
required: true
responses:
'200':
description: "Client successfully subscribed"
content:
application/json:
schema:
type: object
properties:
token:
type: string
example: "successfully subscribed"
id:
type: string
description: The ID of the subscription to allow the client to unsubscribe. This ID should be stored by the client.
example: "exampleSubscriptionID"
'400':
description: "Invalid input"
'422':
description: "Validation exception"
/subscription/unsubscribe:
post:
summary: Unsubscribe from an area
description: Unsubscribe a client from an area.
tags:
- Subscription
requestBody:
description: Remove the client from the area
content:
application/json:
schema:
$ref: '#/components/schemas/delete_subscription'
required: true
responses:
'200':
description: "Client successfully removed"
content:
application/json:
schema:
type: object
properties:
token:
type: string
example: "successfully unsubscribed"
'400':
description: "Invalid input"
'422':
description: "Validation exception"
/subscription/heartbeat:
post:
summary: Client's heartbeat
description: The client should send a heartbeat every day. If the client fails to send a heartbeat for a week, the registration will be deleted. If the client sends a heartbeat but its data has already been deleted, the server returns a 410 code, and the client must register again. Clients can also check with this request if the server is still online.
tags:
- Subscription
requestBody:
description: Send heartbeat
content:
application/json:
schema:
$ref: '#/components/schemas/heartbeat'
required: true
responses:
'200':
description: "Subscription still active and renewed"
content:
application/json:
schema:
type: object
properties:
token:
type: string
example: "Subscription successfully renewed"
'400':
description: "Invalid input"
'410':
description: "The server no longer has data for this subscription_id"
'422':
description: "Validation exception"
/alert/{UUID}:
get:
summary: Get one alert
description: Retrieve a specific alert using the provided alert ID. The alert follows the Common Alerting Protocol (CAP) Version 1.2.
tags:
- Alerts
parameters:
- in: path
name: UUID
required: true
schema:
type: string
responses:
'200':
description: "CAP alert data"
content:
application/xml:
schema:
$ref: '#/components/schemas/alert_response'
'400':
description: "Invalid input"
'422':
description: "Validation exception"
/alert/all:
post:
summary: Get all alerts for a subscription ID
description: Retrieve all alerts for a given subscription ID.
tags:
- Alerts
requestBody:
description: Request alerts for the given subscription ID
content:
application/json:
schema:
$ref: '#/components/schemas/all_alerts_request'
required: true
responses:
'200':
description: "All CAP alerts for the subscription"
content:
application/json:
schema:
$ref: '#/components/schemas/all_alert_response'
'400':
description: "No valid subscription"
'422':
description: "Validation exception"
/alert/area:
post:
summary: Get all alerts for an area
description: Retrieve all alerts for a specified area defined by four coordinates.
tags:
- Alerts
requestBody:
description: Request alerts for a specific area
content:
application/json:
schema:
$ref: '#/components/schemas/alert_area_request'
required: true
responses:
'200':
description: "All CAP alerts for the area"
content:
application/json:
schema:
$ref: '#/components/schemas/all_alert_response'
'400':
description: "No valid subscription"
'422':
description: "Validation exception"
/source/area_status:
post:
summary: Area status check
description: Check which feeds the server has for a list of country codes.
tags:
- Alert Sources
requestBody:
description: Request for area status based on country codes.
content:
application/json:
schema:
$ref: '#/components/schemas/area_status'
required: true
responses:
'200':
description: "List of all feeds for the country codes"
content:
application/json:
schema:
$ref: '#/components/schemas/area_status_response'
'400':
description: "Invalid input"
'422':
description: "Validation exception"
components:
schemas:
new_subscription:
description: New subscription
properties:
distributor_url:
type: string
description: "The URL of the UnifiedPush server for sending alert notifications"
example: "https://example.de"
min_lat:
type: number
format: float
description: "The minimum latitude"
example: -90.0
max_lat:
type: number
format: float
description: "The maximum latitude"
example: 90.0
min_lon:
type: number
format: float
description: "The minimum longitude"
example: -180.0
max_lon:
type: number
format: float
description: "The maximum longitude"
example: 180.0
delete_subscription:
description: Unsubscribe from a location
properties:
subscription_id:
type: string
description: "The ID of the subscription to be removed"
heartbeat:
description: "A heartbeat to indicate the client is still online"
properties:
subscription_id:
type: string
description: "The subscription ID to check"
example: "subscription_id"
alert_request:
description: "Request a specific alert by ID"
properties:
alert_id:
type: string
description: "The UUID of the alert"
example: "ExampleAlertUUID"
alert_area_request:
description: "a bounding box with four coordinates"
properties:
min_lat:
type: number
format: float
description: "The minimum latitude"
example: -90.0
max_lat:
type: number
format: float
description: "The maximum latitude"
example: 90.0
min_lon:
type: number
format: float
description: "The minimum longitude"
example: -180.0
max_lon:
type: number
format: float
description: "The maximum longitude"
example: 180.0
alert_response:
type: object
properties:
identifier:
type: string
example: "urn:oid:2.49.0.1.4.0.2011.2.2.8.37.9"
sender:
type: string
example: "geomag@usgs.gov"
sent:
type: string
format: date-time
example: "2011-02-02T08:37:09-00:00"
status:
type: string
example: "Test"
msgType:
type: string
example: "Alert"
scope:
type: string
example: "Public"
info:
type: object
properties:
language:
type: string
example: "en"
category:
type: string
example: "Met"
event:
type: string
example: "Geomagnetic Storm"
urgency:
type: string
example: "Expected"
severity:
type: string
example: "Moderate"
certainty:
type: string
example: "Likely"
senderName:
type: string
example: "USGS Geomagnetism Program"
headline:
type: string
example: "Geomagnetic Storm Alert"
description:
type: string
example: "The U.S. Geological Survey (USGS) is bracing for the likely arrival of a major geomagnetic storm..."
instruction:
type: string
example: "While geomagnetic storms give rise to the beautiful Northern lights..."
web:
type: string
example: "http://www.usgs.gov/public/press/public_affairs/press_releases/pr1241m.html"
contact:
type: string
example: "Jill Caldwell 1-303-273-8486"
resource:
type: object
properties:
resourceDesc:
type: string
example: "Image file"
mimeType:
type: string
example: "image/jpeg"
uri:
type: string
example: "http://geomag.usgs.gov/realtime.html"
area:
type: object
properties:
areaDesc:
type: string
example: "Plots of the data from USGS observatories can be seen on-line at..."
polygon:
type: string
example: "45,-179.99 45,179.99 89.99,179.99 89.99,-179.99 45,-179.99"
area_status:
description: "A list of country codes in ISO 3166-1 format"
properties:
country_code:
type: array
items:
type: string
example: ["de", "fr"]
area_status_response:
type: object
properties:
results:
type: array
items:
type: object
properties:
name:
type: string
example: "Deutschland: Landeshochwasserportal"
source_is_official:
type: boolean
example: true
cap_alert_feed_status:
type: string
example: "operating"
authorityCountry:
type: string
example: "de"
register_url:
type: string
example: "https://alertingauthority.wmo.int/authorities.php?recId=53"
latest_published_alert_datetime:
type: string
example: "2024-12-10T05:00:44Z"
all_alerts_request:
description: "Request all alerts for a specific subscription"
properties:
subscription_id:
type: string
description: "The ID of the subscription"
example: "example-subscription-id"
all_alert_response:
description: "All alerts for the given subscription"
type: array
items:
$ref: '#/components/schemas/alert_response'