-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
625 lines (607 loc) · 16.1 KB
/
openapi.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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
openapi: 3.0.0
info:
description: API specification for the eTrax|rescue app<->server interface
version: "1.0.0"
title: eTrax|rescue API
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: 'Bearer <base64 with 64 chars>'
responses:
UnauthorizedError:
description: Token invalid
MalformedRequestError:
description: Malformed request
Ok:
description: ok
schemas:
AppConfiguration:
type: object
required:
- locationUpdateInterval
- locationUpdateMinDistance
- infoUpdateInterval
properties:
locationUpdateInterval:
type: integer
description: Location update interval in seconds
example: 60
locationUpdateMinDistance:
type: integer
description: |
The minimal position change in meters a person has to move in order
to trigger an update
example: 50
infoUpdateInterval:
type: integer
description: |
Interval in seconds at which the mission info should be updated
example: 300
Organization:
type: object
required:
- id
- name
properties:
id:
type: string
description: OID
example: DEV
name:
type: string
description: \"bezeichnung\" field in the data json in the db
example: Rettungshunde
State:
type: object
required:
- id
- name
- description
properties:
id:
type: integer
example: 42
name:
type: string
example: "Anreise"
description:
type: string
example: "..."
QuickAction:
type: object
required:
- id
- name
- description
properties:
id:
type: integer
example: 42
name:
type: string
example: "Anreise"
description:
type: string
example: "..."
Role:
type: object
required:
- id
- name
- description
properties:
id:
type: integer
example: 42
name:
type: string
example: "Hundeführer*in"
description:
type: string
example: "..."
Mission:
type: object
required:
- id
- name
- start
- latitude
- longitude
properties:
id:
type: integer
example: 42
name:
type: string
example: Wien
start:
type: string
format: date-time
latitude:
type: number
example: 48.2206635
longitude:
type: number
example: 16.309849
LocationData:
type: object
required:
- timestamp
- latitude
- longitude
- accuracy
- altitude
- speed
properties:
timestamp:
description: milliseconds since 1970-01-01
type: integer
format: int64
latitude:
type: number
format: double
longitude:
type: number
format: double
accuracy:
type: number
format: float
altitude:
type: number
format: double
speed:
type: number
format: float
LonLat:
type: array
items:
oneOf:
- type: number
description: 'longitude'
example: 16.309849
- type: number
description: 'latitude'
example: 48.2206635
minItems: 2
maxItems: 2
SearchArea:
type: object
properties:
id:
type: string
example: 'SID-007'
label:
type: string
example: 'Group 2 search area'
description:
type: string
example: 'riverside'
color:
type: string
example: '0x00FF00'
coordinates:
type: array
items:
$ref: '#/components/schemas/LonLat'
paths:
/version:
get:
summary: server version
description: |
get the current version of the eTrax|rescue server. This endpoint is
used during the app connection process to verify that the server really
is an eTrax|rescue server.
responses:
'200':
description: ok
content:
application/json:
schema:
type: object
required:
- version
- magic
properties:
version:
type: string
example: "5.0.1"
magic:
type: string
example: "eTrax|rescue"
/organizations:
get:
summary: get the registered organizations
description: get a list of the organizations registered on the eTrax|rescue server
responses:
'200':
description: ok
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Organization'
/orglogo/{oid}:
get:
summary: get the logo of the organization
parameters:
- in: path
name: oid
schema:
type: string
example: "DEV"
required: true
description: ID of the organization of which the logo should be returned
responses:
'200':
description: ok
content:
image/jpeg:
schema:
type: string
format: binary
image/png:
schema:
type: string
format: binary
image/gif:
schema:
type: string
format: binary
image/bmp:
schema:
type: string
format: binary
/login:
post:
summary: login
description: logs the user in
requestBody:
description: Login information
content:
application/json:
schema:
type: object
required:
- organization_id
- username
- password
properties:
organization_id:
type: string
example: DEV
username:
type: string
example: demouser
password:
type: string
example: password
responses:
'200':
description: login successful
content:
application/json:
schema:
type: object
required:
- token
- issuingDate
properties:
token:
type: string
example: "0123456789ABCDEF"
issuingDate:
type: integer
format: timestamp
'401':
description: username, password or organization ID are incorrect
'429':
description: Too many requests
/logout:
get:
summary: log out
description: |
log the user out by sending the logout state to the BOS interface
security:
- bearerAuth: []
responses:
'200':
$ref: '#/components/responses/Ok'
'401':
$ref: '#/components/responses/UnauthorizedError'
/initialization:
get:
summary: retrieve initial data
description: |
receive initial app data. This includes configuration settings for the
location updates, available roles, states, quickactions and currently
active missions.
security:
- bearerAuth: []
responses:
'200':
description: ok
content:
application/json:
schema:
type: object
required:
- appSettings
- roles
- missions
properties:
appConfiguration:
$ref: '#/components/schemas/AppConfiguration'
roles:
type: array
items:
$ref: '#/components/schemas/Role'
states:
type: array
items:
$ref: '#/components/schemas/State'
actions:
type: array
items:
$ref: '#/components/schemas/QuickAction'
missions:
type: array
items:
$ref: '#/components/schemas/Mission'
'401':
$ref: '#/components/responses/UnauthorizedError'
/missionselect:
post:
summary: select a mission
description: |
allows the client to select a mission
security:
- bearerAuth: []
requestBody:
description: the ID of the selected missioni
content:
application/json:
schema:
type: object
required:
- mission_id
properties:
mission_id:
type: integer
example: 42
responses:
'200':
$ref: '#/components/responses/Ok'
'401':
$ref: '#/components/responses/UnauthorizedError'
'400':
$ref: '#/components/responses/MalformedRequestError'
/roleselect:
post:
summary: update user role
description: Update the user role
security:
- bearerAuth: []
requestBody:
description: the ID of the selected user role
content:
application/json:
schema:
type: object
required:
- role_id
properties:
role_id:
type: integer
example: 42
responses:
'200':
$ref: '#/components/responses/Ok'
'401':
$ref: '#/components/responses/UnauthorizedError'
'400':
$ref: '#/components/responses/MalformedRequestError'
/stateselect:
post:
summary: update user state
description: Update the user state
security:
- bearerAuth: []
requestBody:
description: Login information
content:
application/json:
schema:
type: object
required:
- state_id
properties:
state_id:
type: integer
example: 42
responses:
'200':
$ref: '#/components/responses/Ok'
'401':
$ref: '#/components/responses/UnauthorizedError'
'400':
$ref: '#/components/responses/MalformedRequestError'
/quickaction:
post:
summary: trigger a quickaction
description: Allows the client to trigger a quickaction
security:
- bearerAuth: []
requestBody:
description: Login information
content:
application/json:
schema:
type: object
required:
- action_id
properties:
action_id:
type: integer
example: 42
location:
$ref: '#/components/schemas/LocationData'
responses:
'200':
$ref: '#/components/responses/Ok'
'401':
$ref: '#/components/responses/UnauthorizedError'
'400':
$ref: '#/components/responses/MalformedRequestError'
/missiondetails:
get:
summary: get mission details
description: get detailed mission info
security:
- bearerAuth: []
responses:
'200':
description: ok
content:
application/json:
schema:
type: object
required:
- name
- lastSeen
- description
properties:
name:
type: string
example: "John Doe"
lastSeen:
type: string
format: date-time
description:
type: string
example: "Very average person"
'401':
$ref: '#/components/responses/UnauthorizedError'
/image/{eid}/{uid}:
get:
summary: get image
description: get the mission image
parameters:
- in: path
name: eid
schema:
type: integer
example: 1
required: true
description: ID of the current mission
- in: path
name: uid
schema:
type: string
example: "1234"
required: true
description: unique identifier of the image resource
security:
- bearerAuth: []
responses:
'200':
description: ok
content:
image/jpeg:
schema:
type: string
format: binary
'401':
$ref: '#/components/responses/UnauthorizedError'
/locationupdate:
post:
summary: send location data to server
description: |
Endpoint that receives the location updates from the client and inserts them
into the location database.
security:
- bearerAuth: []
requestBody:
description: List of location data to add to the
content:
application/json:
schema:
type: object
required:
- uid
- token
- rescue_mission_id
- data
properties:
mission_id:
type: string
example: "42"
data:
type: array
items:
$ref: '#/components/schemas/LocationData'
responses:
'201':
description: item created
'400':
$ref: '#/components/responses/MalformedRequestError'
'401':
$ref: '#/components/responses/UnauthorizedError'
/missionactive:
get:
summary: Check if mission is active
description: |
Checks if the selected mission of the user is still active
security:
- bearerAuth: []
responses:
'200':
$ref: '#/components/responses/Ok'
/uploadpoi:
post:
summary: upload a POI
description: |
The client can upload a Point of Interest (POI) consisting of a an image, corresponding location data and a short description
security:
- bearerAuth: []
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
description:
type: string
location_data:
$ref: '#/components/schemas/LocationData'
image:
description: jpg image
type: string
format: binary
responses:
'200':
$ref: '#/components/responses/Ok'
'400':
$ref: '#/components/responses/MalformedRequestError'
'401':
$ref: '#/components/responses/UnauthorizedError'
/searchareas:
get:
summary: get search areas
description: |
Returns a list of search aread for the selected mission.
security:
- bearerAuth: []
responses:
'200':
description: ok
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/SearchArea'
'401':
$ref: '#/components/responses/UnauthorizedError'