source: apis/deviceservice.yaml@ f30ecc5

debian/bullseye
Last change on this file since f30ecc5 was dae7d73, checked in by Joachim Langenbach <joachim.langenbach@…>, 7 years ago
  • Moved API descriptions to a higher level folder api
    • Configure script
      • renamed from code_generator to configure
      • transferred to python
      • Added the mapservice_client generation
  • Property mode set to 100644
File size: 18.9 KB
Line 
1openapi: 3.0.0
2info:
3 title: GNUBoat Device API
4 contact:
5 name: EngSaS - Engineering Solutions and Services Langenbach
6 url: 'http://www.engsas.com'
7 email: info@engsas.de
8 license:
9 name: GPL 3
10 url: 'https://www.gnu.org/licenses/gpl-3.0.en.html'
11 version: v1
12 description: API for GNUBoat devices
13servers:
14 - url: 'http://gnuboat/deviceservice/{version}'
15 description: The production API server
16 variables:
17 version:
18 default: v1
19 - url: 'http://localhost:8090/deviceservice/{version}'
20 description: The local flask development url
21 variables:
22 version:
23 default: v1
24paths:
25 '/instrumentdata':
26 get:
27 description: The current dates like speed, water depth, ...
28 tags:
29 - device
30 operationId: instrumentDataGet
31 responses:
32 '200':
33 description: OK
34 content:
35 application/json:
36 schema:
37 $ref: '#/components/schemas/InstrumentData'
38 '404':
39 description: Returned, if there is no current, valid dataset
40 $ref: '#/components/responses/NotFound'
41 '500':
42 $ref: '#/components/responses/InternalServerError'
43 '/track':
44 get:
45 description: The track with dates like speed, water depth, ...
46 tags:
47 - device
48 operationId: trackGet
49 responses:
50 '200':
51 description: OK
52 content:
53 application/json:
54 schema:
55 $ref: '#/components/schemas/Track'
56 '500':
57 $ref: '#/components/responses/InternalServerError'
58 '/shutdown':
59 get:
60 description: Shutdown the device
61 tags:
62 - device
63 operationId: shutdown
64 responses:
65 '204':
66 description: Shutdown initiated
67 '500':
68 $ref: '#/components/responses/InternalServerError'
69 '/logfiles':
70 get:
71 description: List of local logfiles
72 tags:
73 - deviceLogs
74 operationId: logfilesGet
75 responses:
76 '200':
77 description: OK
78 content:
79 application/json:
80 schema:
81 $ref: '#/components/schemas/Logfiles'
82 '500':
83 $ref: '#/components/responses/InternalServerError'
84 '/logfiles/{name}':
85 get:
86 description: Download local logfiles
87 tags:
88 - deviceLogs
89 operationId: logsGet
90 parameters:
91 - name: name
92 in: path
93 description: Logfiles to download
94 required: true
95 schema:
96 type: string
97 style: simple
98 explode: true
99 example: 'test-1.log,test-2.log'
100 responses:
101 '200':
102 description: OK
103 content:
104 text/plain:
105 schema:
106 type: string
107 application/zip:
108 schema:
109 type: string
110 format: byte
111 '404':
112 $ref: '#/components/responses/NotFound'
113 '500':
114 $ref: '#/components/responses/InternalServerError'
115 '/logfiles/{name}/track':
116 get:
117 description: Get the logfile as a track
118 tags:
119 - deviceLogs
120 operationId: logsTrackGet
121 parameters:
122 - name: name
123 in: path
124 description: Logfiles to download
125 required: true
126 schema:
127 type: string
128 example: 'test-1.log'
129 responses:
130 '200':
131 description: OK
132 content:
133 application/json:
134 schema:
135 $ref: '#/components/schemas/Track'
136 '404':
137 $ref: '#/components/responses/NotFound'
138 '500':
139 $ref: '#/components/responses/InternalServerError'
140 '/maps':
141 get:
142 description: Get a list of currently installed maps
143 tags:
144 - deviceMaps
145 operationId: mapsGet
146 responses:
147 '200':
148 description: OK
149 content:
150 application/json:
151 schema:
152 $ref: '#/components/schemas/Maps'
153 '500':
154 $ref: '#/components/responses/InternalServerError'
155 post:
156 description: Upload a new mbtiles file as a new map
157 tags:
158 - deviceMaps
159 operationId: mapsUpload
160 requestBody:
161 required: true
162 content:
163 application/octet-stream:
164 schema:
165 type: string
166 format: byte
167 responses:
168 '201':
169 description: OK
170 content:
171 application/json:
172 schema:
173 $ref: '#/components/schemas/Maps'
174 '400':
175 $ref: '#/components/responses/BadRequest'
176 '413':
177 $ref: '#/components/responses/PayloadToLarge'
178 '500':
179 $ref: '#/components/responses/InternalServerError'
180 '/maps/{mapname}/{zoom}/{x_tile}/{y_tile}.png':
181 get:
182 description: Get tiles of a map with help of it's tiles urls
183 tags:
184 - deviceMaps
185 operationId: mapsTileGet
186 parameters:
187 - name: mapname
188 in: path
189 description: Map basename
190 required: true
191 schema:
192 type: string
193 example: '7f92508911d84ff957acc862fd38bdafddbaae14ce508dda2aa6857e73863318'
194 - name: zoom
195 in: path
196 description: Zoomlevel
197 required: true
198 schema:
199 type: integer
200 example: 15
201 - name: x_tile
202 in: path
203 description: Number of the tile in x dimension
204 required: true
205 schema:
206 type: integer
207 example: 17298
208 - name: y_tile
209 in: path
210 description: Number of the tile in y dimension
211 required: true
212 schema:
213 type: integer
214 example: 21435
215 responses:
216 '200':
217 description: OK
218 content:
219 image/*:
220 schema:
221 type: string
222 format: binary
223 #contentEncoding: base64
224 #contentMediaType: image/png
225 '400':
226 $ref: '#/components/responses/BadRequest'
227 '404':
228 $ref: '#/components/responses/NotFound'
229 '500':
230 $ref: '#/components/responses/InternalServerError'
231 '/mapservice':
232 get:
233 description: The status of the mapservice connection
234 tags:
235 - mapservice
236 operationId: mapserviceStatus
237 responses:
238 '200':
239 description: OK
240 content:
241 application/json:
242 schema:
243 $ref: '#/components/schemas/MapserviceStatus'
244 '500':
245 $ref: '#/components/responses/InternalServerError'
246 '502':
247 $ref: '#/components/responses/BadGatewayError'
248 '504':
249 description: Mapservice has not answered and connection timed out
250 content:
251 application/json:
252 schema:
253 $ref: '#/components/schemas/MapserviceStatus'
254 '/mapservice/waters':
255 get:
256 description: Search waters on mapservice
257 tags:
258 - mapservice
259 summary: Find own waters
260 operationId: watersGet
261 parameters:
262 - name: name
263 in: query
264 schema:
265 $ref: '#/components/schemas/itemName'
266 example: Test
267 - $ref: '#/components/parameters/orderBy'
268 - $ref: '#/components/parameters/offset'
269 - $ref: '#/components/parameters/limit'
270 responses:
271 '200':
272 description: OK
273 content:
274 application/json:
275 schema:
276 $ref: '#/components/schemas/Waters'
277 '400':
278 $ref: '#/components/responses/BadRequest'
279 '401':
280 $ref: '#/components/responses/Unauthorized'
281 '404':
282 $ref: '#/components/responses/NotFound'
283 '500':
284 $ref: '#/components/responses/InternalServerError'
285 '502':
286 $ref: '#/components/responses/BadGatewayError'
287 '504':
288 description: Mapservice has not answered and connection timed out
289 content:
290 application/json:
291 schema:
292 $ref: '#/components/schemas/MapserviceStatus'
293 '/mapservice/log':
294 post:
295 description: Upload log to the mapservice
296 tags:
297 - mapservice
298 summary: Add a new log
299 operationId: logCreate
300 requestBody:
301 content:
302 application/json:
303 schema:
304 $ref: '#/components/schemas/LogCreation'
305 responses:
306 '204':
307 description: Log created
308 '400':
309 $ref: '#/components/responses/BadRequest'
310 '401':
311 $ref: '#/components/responses/Unauthorized'
312 '404':
313 $ref: '#/components/responses/NotFound'
314 '502':
315 $ref: '#/components/responses/BadGatewayError'
316 '500':
317 $ref: '#/components/responses/InternalServerError'
318components:
319 schemas:
320 point:
321 title: 'Point of type [longitude, latitude] in decimal degrees'
322 type: array
323 maxItems: 2
324 minItems: 2
325 items:
326 type: number
327 speedOverGround:
328 title: Speed over Ground in m/s
329 type: number
330 format: float
331 speedThroughWater:
332 title: Speed through the water in m/s
333 type: number
334 format: float
335 courseOverGround:
336 title: Course over the ground in degree
337 type: number
338 format: float
339 minimum: 0
340 maximum: 360
341 waterDepth:
342 title: Water depth in m
343 type: number
344 format: float
345 waterTemperature:
346 title: Water temperature in degree celsius
347 type: number
348 format: float
349 gpsFix:
350 title: Status of GPS fix
351 type: string
352 enum:
353 - '-'
354 - '2D'
355 - '3D'
356 InstrumentData:
357 title: Data displayed in the instrument section
358 type: object
359 properties:
360 speedThroughWater:
361 $ref: '#/components/schemas/speedThroughWater'
362 speedOverGround:
363 $ref: '#/components/schemas/speedOverGround'
364 courseOverGround:
365 $ref: '#/components/schemas/courseOverGround'
366 waterDepth:
367 $ref: '#/components/schemas/waterDepth'
368 waterTemperature:
369 $ref: '#/components/schemas/waterTemperature'
370 position:
371 $ref: '#/components/schemas/point'
372 gpsFix:
373 $ref: '#/components/schemas/gpsFix'
374 required:
375 - speedOverGround
376 - courseOverGround
377 - waterDepth
378 - position
379 - gpsFix
380 Track:
381 title: List of InstrumentData sorted by time
382 type: object
383 additionalProperties:
384 type: object
385 properties:
386 code:
387 type: integer
388 format: int64
389 text:
390 $ref: '#/components/schemas/InstrumentData'
391 Logfile:
392 title: A logfile
393 type: string
394 Logfiles:
395 title: Array of logfiles
396 type: array
397 items:
398 $ref: '#/components/schemas/Logfile'
399 map:
400 title: Represents a Map
401 description: Following the tilejson specification https://github.com/mapbox Version 2.0.0
402 type: object
403 properties:
404 tilejson:
405 description: Version number of the tilejson spec (semver.org style)
406 type: string
407 name:
408 description: Name describing the tileset
409 type: string
410 description:
411 type: string
412 version:
413 description: semver.org style version number of the map
414 type: string
415 attribution:
416 description: Attribution label of the map (could be interprated as HTML or literal text)
417 type: string
418 template:
419 description: Mustache tamplate for format data from grids
420 type: string
421 legend:
422 description: Legend to be displayed (could be treated as HTML or literal text)
423 type: string
424 schema:
425 description: The map tile scheme (xyz or tms). If missing xyz
426 type: string
427 enum:
428 - 'xyz'
429 - 'tms'
430 default: 'xyz'
431 tiles:
432 description: Url to get the tiles from. It must be at least one endpoint. If more than one endpoints given, all must return the same information for the same url. {z}, {y}, {x} should be replaced by zoomleve, y tile number and x tile number.
433 type: array
434 items:
435 type: string
436 minItems: 1
437 grids:
438 description: An array of interactivity endpoints
439 type: array
440 items:
441 type: string
442 data:
443 description: An array of data files in GeoJSON format
444 type: array
445 items:
446 type: string
447 minzoom:
448 type: integer
449 minimum: 0
450 maximum: 30
451 default: 0
452 maxzoom:
453 type: integer
454 minimum: 0
455 maximum: 30
456 default: 30
457 bounds:
458 description: The maximum extent of available map tiles at any zoomlevel, in WGS84 reference system. The bounds are given in the order left, bottom, right, top
459 type: array
460 items:
461 type: number
462 format: float
463 minItems: 4
464 maxItems: 4
465 center:
466 description: Initial values of longitude, latitude and zoomlevel
467 type: array
468 items:
469 type: number
470 format: float
471 minItems: 3
472 maxItems: 3
473 required:
474 - tilejson
475 - tiles
476 Maps:
477 title: List of Map
478 type: array
479 items:
480 $ref: '#/components/schemas/map'
481 MapserviceStatus:
482 type: string
483 enum:
484 - 'NO_API_KEY'
485 - 'NO_DEVICE'
486 - 'DEVICE_NOT_FOUND'
487 - 'NO_CONNECTION'
488 - 'OK'
489 itemName:
490 title: Item Name
491 type: string
492 itemId:
493 title: Item ID
494 type: integer
495 format: int64
496 comment:
497 title: Comment of an item
498 type: string
499 order:
500 title: order
501 enum:
502 - desc
503 - asc
504 type: string
505 default: asc
506 description: |
507 Sort order:
508 * `asc` - Ascending, from A to Z
509 * `desc` - Descending, from Z to A
510 example: asc
511 Water:
512 title: Water
513 type: object
514 properties:
515 waterId:
516 $ref: '#/components/schemas/itemId'
517 name:
518 $ref: '#/components/schemas/itemName'
519 gauges:
520 $ref: '#/components/schemas/Gauges'
521 required:
522 - waterId
523 - name
524 Waters:
525 title: A list of Water
526 type: array
527 items:
528 $ref: '#/components/schemas/Water'
529 ReferenceWaterLevelGaugeHeight:
530 title: Gauge Height of reference water level of a Gauge
531 description: The gauge height (stage) for reference water level. The reference water level is the water level, the depth on the map is shown at. Therefore, the water depth of a LogEntry is transformed to this referenceWaterLevel, with help of the gaugeHeight of the Log related to the LogEntry.
532 type: number
533 format: float
534 GaugeHeight:
535 title: 'Gauge height (stage) of the gauge, at the time of measuring'
536 type: number
537 format: float
538 Gauge:
539 title: Gauge
540 type: object
541 properties:
542 gaugeId:
543 $ref: '#/components/schemas/itemId'
544 name:
545 $ref: '#/components/schemas/itemName'
546 location:
547 $ref: '#/components/schemas/point'
548 referenceWaterLevelGaugeHeight:
549 $ref: '#/components/schemas/ReferenceWaterLevelGaugeHeight'
550 comment:
551 $ref: '#/components/schemas/comment'
552 required:
553 - gaugeId
554 - name
555 - location
556 - referenceWaterLevelGaugeHeight
557 Gauges:
558 title: Gauges
559 type: array
560 items:
561 $ref: '#/components/schemas/Gauge'
562 LogCreation:
563 title: Log for Creation
564 type: object
565 properties:
566 water:
567 $ref: '#/components/schemas/itemId'
568 gauge:
569 $ref: '#/components/schemas/itemId'
570 gaugeHeight:
571 $ref: '#/components/schemas/GaugeHeight'
572 comment:
573 $ref: '#/components/schemas/comment'
574 logfile:
575 $ref: '#/components/schemas/Logfile'
576 delete:
577 description: Delete the logfile locally after successfull upload
578 type: boolean
579 default: True
580 required:
581 - water
582 - gauge
583 - gaugeHeight
584 - logfile
585 example:
586 water: 1
587 gauge: 1
588 gaugeHeight: 66
589 logfile: test-1.log
590 comment: 'LogCreation for auto generated tests'
591 HttpError:
592 title: HTTP Error Response Object
593 type: object
594 properties:
595 type:
596 type: string
597 title:
598 type: string
599 detail:
600 type: string
601 instance:
602 type: string
603 required:
604 - type
605 - title
606 - detail
607 - instance
608 responses:
609 BadRequest:
610 description: Bad Request (400)
611 content:
612 application/problem+json:
613 schema:
614 $ref: '#/components/schemas/HttpError'
615 Unauthorized:
616 description: Unauthorized (401) acces to resource
617 content:
618 application/problem+json:
619 schema:
620 $ref: '#/components/schemas/HttpError'
621 NotFound:
622 description: Item with given Id not found
623 content:
624 application/problem+json:
625 schema:
626 $ref: '#/components/schemas/HttpError'
627 PayloadToLarge:
628 description: Uploaded file is to large (413)
629 content:
630 application/problem+json:
631 schema:
632 $ref: '#/components/schemas/HttpError'
633 InternalServerError:
634 description: Internal Server Error (HTTP Code 500)
635 content:
636 application/problem+json:
637 schema:
638 $ref: '#/components/schemas/HttpError'
639 BadGatewayError:
640 description: Bad Gateway (HTTP Code 502)
641 content:
642 application/problem+json:
643 schema:
644 $ref: '#/components/schemas/HttpError'
645 parameters:
646 orderBy:
647 name: order_by
648 in: query
649 description: 'Order by field: name'
650 schema:
651 type: string
652 default: name
653 example: name
654 order:
655 name: order
656 in: query
657 description: Order
658 schema:
659 $ref: '#/components/schemas/order'
660 example: ''
661 offset:
662 name: offset
663 in: query
664 description: >-
665 Skip over a number of elements by specifying an offset value for the
666 query
667 schema:
668 type: integer
669 format: int32
670 default: 0
671 example: 0
672 limit:
673 name: limit
674 in: query
675 description: Limit the number of elements on the response
676 style: form
677 explode: true
678 schema:
679 type: integer
680 format: int32
681 default: 10
682 example: 10
683tags:
684 - name: device
685 description: All actions related to the device functionality
686 - name: deviceLogs
687 description: All actions for handling logs on the local device
688 - name: deviceMaps
689 description: All actions for handlings maps on the local device
690 - name: mapservice
691 description: All actions used to interact with a GNUBoat mapservice
Note: See TracBrowser for help on using the repository browser.