source: src/mapservice/openapi.yaml@ ec8d5d0

debian/bullseye
Last change on this file since ec8d5d0 was ec8d5d0, checked in by Joachim Langenbach <joachim.langenbach@…>, 7 years ago

Added devices to service

  • Property mode set to 100644
File size: 23.7 KB
RevLine 
[3a89adb]1openapi: 3.0.0
2info:
3 title: GNUBoat Mapservice 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 to upload log files with water depth to GNUBoat server
13servers:
14 - url: 'https://gnuboat.engsas.com/mapservice/{version}'
15 description: The production API server
16 variables:
17 version:
18 default: v1
19 - url: 'http://localhost:8080/mapservice/{version}'
20 description: The local flask development url
21 variables:
22 version:
23 default: v1
24paths:
[ec8d5d0]25 /user:
[be25db1]26 get:
[28198a1]27 description: Returns information of current/authorized user
[be25db1]28 tags:
29 - users
30 summary: Returns info of a user
31 operationId: usersGet
32 security:
33 - basicAuth: []
34 - apiKeyAuth: []
35 responses:
36 '200':
37 description: OK
38 content:
39 application/json:
40 schema:
41 $ref: '#/components/schemas/User'
42 examples:
43 User:
44 $ref: '#/components/examples/User'
45 '400':
46 $ref: '#/components/responses/BadRequest'
47 '401':
48 $ref: '#/components/responses/Unauthorized'
49 post:
50 description: Registers a new user
51 tags:
52 - users
53 summary: Registers a new user
54 operationId: usersRegister
55 requestBody:
56 content:
57 application/json:
58 schema:
59 $ref: '#/components/schemas/UserCreation'
60 examples:
61 Water:
62 $ref: '#/components/examples/UserCreation'
63 responses:
64 '201':
65 description: Userr created
66 content:
67 application/json:
68 schema:
69 $ref: '#/components/schemas/User'
70 examples:
71 Water:
72 $ref: '#/components/examples/User'
73 '400':
74 $ref: '#/components/responses/BadRequest'
75 options:
76 description: Used by CORS preflight
77 tags:
78 - users
79 responses:
80 '200':
81 description: CORS prefilght requests should return 200 as status code
82 content:
[13cbe66]83 application/json: {}
[ec8d5d0]84 /user/apikey_create:
[be25db1]85 get:
86 description: Generates and returns a new API key for current user
87 tags:
88 - users
89 summary: Returns a new API key
90 operationId: usersApiKeyCreate
91 security:
92 - basicAuth: []
93 responses:
94 '200':
95 description: OK
96 content:
97 application/json:
98 schema:
99 $ref: '#/components/schemas/apiKeys'
[13cbe66]100 example: NewApiKey4711
[be25db1]101 '400':
102 $ref: '#/components/responses/BadRequest'
103 '401':
104 $ref: '#/components/responses/Unauthorized'
105 '/user/{api_key}':
106 delete:
107 description: Deletes given API key and returns remaining API keys of the user
108 tags:
109 - users
110 summary: Deletes API key
111 operationId: usersApiKeyDelete
112 security:
113 - basicAuth: []
114 parameters:
115 - name: api_key
116 in: path
117 description: API key
118 required: true
119 schema:
120 $ref: '#/components/schemas/apiKey'
[13cbe66]121 example: DelApiKey4711
[be25db1]122 responses:
123 '200':
124 description: OK
125 content:
126 application/json:
127 schema:
128 $ref: '#/components/schemas/apiKeys'
[13cbe66]129 example: ApiKey4711
[be25db1]130 '400':
131 $ref: '#/components/responses/BadRequest'
132 '401':
133 $ref: '#/components/responses/Unauthorized'
[13cbe66]134 '404':
135 $ref: '#/components/responses/NotFound'
[be25db1]136 '/user/activate/{activation_code}':
137 get:
138 description: Activates a user account
139 tags:
140 - users
141 summary: Activates a user account
142 operationId: usersActivate
143 parameters:
144 - name: activation_code
145 in: path
146 description: Activation code
147 required: true
148 schema:
149 $ref: '#/components/schemas/activationCode'
[13cbe66]150 example: dac9630aec642a428cd73f4be0a03569
[be25db1]151 responses:
152 '302':
153 description: OK or not OK
154 headers:
155 Location:
156 schema:
157 type: string
[13cbe66]158 description: 'URL to the website, showing the result of the activation'
[ec8d5d0]159 /waters:
[3a89adb]160 get:
161 description: Returns all waters
162 tags:
163 - waters
164 summary: Find waters by id
165 operationId: watersGet
166 parameters:
167 - name: name
[be25db1]168 in: query
[3a89adb]169 schema:
[041e464]170 $ref: '#/components/schemas/itemName'
[13cbe66]171 example: Missi
[3a89adb]172 - name: manager
[be25db1]173 in: query
[3a89adb]174 schema:
175 $ref: '#/components/schemas/username'
[13cbe66]176 example: jane
[3a89adb]177 - $ref: '#/components/parameters/orderBy'
178 - $ref: '#/components/parameters/offset'
179 - $ref: '#/components/parameters/limit'
180 responses:
181 '200':
182 description: OK
183 content:
184 application/json:
185 schema:
186 $ref: '#/components/schemas/waters'
187 examples:
188 Waters:
189 $ref: '#/components/examples/waters'
[13cbe66]190 '404':
191 $ref: '#/components/responses/NotFound'
[3a89adb]192 post:
193 description: Adds a new water to the database
194 tags:
195 - waters
196 summary: Add a new water
[be25db1]197 operationId: watersCreate
[3a89adb]198 security:
199 - basicAuth: []
200 - apiKeyAuth: []
201 requestBody:
202 content:
203 application/json:
204 schema:
205 $ref: '#/components/schemas/WaterCreation'
[13cbe66]206 example:
[041e464]207 name: Rhein
208 osmId: 1756854
[13cbe66]209 osmType: Relation
[3a89adb]210 responses:
211 '201':
212 description: Water created
213 content:
214 application/json:
215 schema:
216 $ref: '#/components/schemas/Water'
217 examples:
218 Water:
219 $ref: '#/components/examples/Water'
220 '400':
221 $ref: '#/components/responses/BadRequest'
222 '401':
223 $ref: '#/components/responses/Unauthorized'
224 '/waters/{id}':
225 get:
226 description: Returns the water identified by id
227 tags:
228 - waters
229 summary: Represents a water
[13cbe66]230 operationId: watersGetById
[3a89adb]231 parameters:
232 - name: id
233 in: path
234 description: Item ID
235 required: true
236 schema:
[041e464]237 $ref: '#/components/schemas/itemId'
[3a89adb]238 responses:
239 '200':
240 description: OK
241 content:
242 application/json:
243 schema:
244 $ref: '#/components/schemas/Water'
245 examples:
246 Water:
247 $ref: '#/components/examples/Water'
248 '404':
249 $ref: '#/components/responses/NotFound'
[13cbe66]250 '/waters/{water_id}/gauges':
251 get:
252 description: Returns all gauges of water waterId
253 tags:
254 - waters
255 summary: Find gauges of water waterId by gaugeId
256 operationId: watersGaugesGet
257 parameters:
258 - name: water_id
259 in: path
260 description: Water ID
261 required: true
262 schema:
263 $ref: '#/components/schemas/itemId'
264 - name: name
265 in: query
266 schema:
267 $ref: '#/components/schemas/itemName'
268 example: Missi
269 - name: manager
270 in: query
271 schema:
272 $ref: '#/components/schemas/username'
273 example: jane
274 - $ref: '#/components/parameters/orderBy'
275 - $ref: '#/components/parameters/offset'
276 - $ref: '#/components/parameters/limit'
277 responses:
278 '200':
279 description: OK
280 content:
281 application/json:
282 schema:
283 $ref: '#/components/schemas/Gauges'
284 examples:
285 Gauges:
286 $ref: '#/components/examples/Gauges'
287 application/geo+json:
288 schema:
289 $ref: '#/components/schemas/GaugesGeoJson'
290 examples:
291 Gauge:
292 $ref: '#/components/examples/GaugesGeoJson'
293 post:
294 description: Adds a new gauge for water waterId to the database
295 tags:
296 - waters
297 summary: Add a new water
298 operationId: watersGaugeCreate
299 parameters:
300 - name: water_id
301 in: path
302 description: Water ID
303 required: true
304 schema:
305 $ref: '#/components/schemas/itemId'
306 security:
307 - basicAuth: []
308 - apiKeyAuth: []
309 requestBody:
310 content:
311 application/json:
312 schema:
313 $ref: '#/components/schemas/GaugeCreation'
314 example:
315 name: New Orleans
316 location:
317 - 90.136111
318 - 29.934722
319 responses:
320 '201':
321 description: Gauge created
322 content:
323 application/json:
324 schema:
325 $ref: '#/components/schemas/Gauge'
326 examples:
327 Gauge:
328 $ref: '#/components/examples/Gauge'
329 application/geo+json:
330 schema:
331 $ref: '#/components/schemas/GaugeGeoJson'
332 examples:
333 Gauge:
334 $ref: '#/components/examples/GaugeGeoJson'
335 '400':
336 $ref: '#/components/responses/BadRequest'
337 '401':
338 $ref: '#/components/responses/Unauthorized'
339 '/waters/{water_id}/gauges/{gauge_id}':
340 get:
341 description: Returns the gauge identified by id
342 tags:
343 - waters
344 summary: Represents a gauge
345 operationId: watersGaugeGetById
346 parameters:
347 - name: water_id
348 in: path
349 description: Water ID
350 required: true
351 schema:
352 $ref: '#/components/schemas/itemId'
353 - name: gauge_id
354 in: path
355 description: Gauge ID
356 required: true
357 schema:
358 $ref: '#/components/schemas/itemId'
359 responses:
360 '200':
361 description: OK
362 content:
363 application/json:
364 schema:
365 $ref: '#/components/schemas/Gauge'
366 examples:
367 Gauge:
368 $ref: '#/components/examples/Gauge'
369 application/geo+json:
370 schema:
371 $ref: '#/components/schemas/GaugeGeoJson'
372 examples:
373 Gauge:
374 $ref: '#/components/examples/GaugeGeoJson'
375 '400':
376 $ref: '#/components/responses/BadRequest'
377 '404':
378 $ref: '#/components/responses/NotFound'
[ec8d5d0]379 '/devices':
380 get:
381 description: Returns all devices of user
382 tags:
383 - devices
384 summary: Find devices by id
385 operationId: devicesGet
386 security:
387 - basicAuth: []
388 - apiKeyAuth: []
389 parameters:
390 - name: name
391 in: query
392 schema:
393 $ref: '#/components/schemas/itemName'
394 example: Love
395 - $ref: '#/components/parameters/orderBy'
396 - $ref: '#/components/parameters/offset'
397 - $ref: '#/components/parameters/limit'
398 responses:
399 '200':
400 description: OK
401 content:
402 application/json:
403 schema:
404 $ref: '#/components/schemas/devices'
405 examples:
406 Devices:
407 $ref: '#/components/examples/devices'
408 '404':
409 $ref: '#/components/responses/NotFound'
410 post:
411 description: Adds a new device to the database
412 tags:
413 - devices
414 summary: Add a new device
415 operationId: devicesCreate
416 security:
417 - basicAuth: []
418 - apiKeyAuth: []
419 parameters:
420 - name: user_id
421 in: path
422 description: User ID
423 required: true
424 schema:
425 $ref: '#/components/schemas/itemId'
426 requestBody:
427 content:
428 application/json:
429 schema:
430 $ref: '#/components/schemas/DeviceCreation'
431 example:
432 name: "Lovely Boat"
433 sensorDepth: 2
434 responses:
435 '201':
436 description: Device created
437 content:
438 application/json:
439 schema:
440 $ref: '#/components/schemas/Device'
441 examples:
442 Device:
443 $ref: '#/components/examples/Device'
444 '400':
445 $ref: '#/components/responses/BadRequest'
446 '401':
447 $ref: '#/components/responses/Unauthorized'
448 '/devices/{id}':
449 get:
450 description: Returns the device identified by id
451 tags:
452 - devices
453 summary: Represents a device
454 operationId: devicesGetById
455 security:
456 - basicAuth: []
457 - apiKeyAuth: []
458 parameters:
459 - name: id
460 in: path
461 description: Item ID
462 required: true
463 schema:
464 $ref: '#/components/schemas/itemId'
465 responses:
466 '200':
467 description: OK
468 content:
469 application/json:
470 schema:
471 $ref: '#/components/schemas/Device'
472 examples:
473 Water:
474 $ref: '#/components/examples/Device'
475 '404':
476 $ref: '#/components/responses/NotFound'
[3a89adb]477components:
478 securitySchemes:
479 basicAuth:
480 type: http
481 scheme: basic
482 x-basicInfoFunc: openapi_server.server_impl.security.Security.auth_basic
483 apiKeyAuth:
484 type: apiKey
485 in: header
486 name: X-API-KEY
487 x-apikeyInfoFunc: openapi_server.server_impl.security.Security.auth_api
488 schemas:
489 username:
490 title: Username
491 type: string
[be25db1]492 apiKey:
493 title: API Key
494 type: string
495 apiKeys:
496 title: Array of API keys
497 type: array
498 items:
499 $ref: '#/components/schemas/apiKey'
500 activationCode:
501 title: Activation code for a User
502 type: string
[041e464]503 itemId:
[3a89adb]504 title: Item ID
505 type: integer
506 format: int32
[041e464]507 itemName:
[3a89adb]508 title: Item Name
509 type: string
[13cbe66]510 order:
511 title: order
512 enum:
513 - desc
514 - asc
515 type: string
516 default: asc
517 description: |
518 Sort order:
519 * `asc` - Ascending, from A to Z
520 * `desc` - Descending, from Z to A
521 example: asc
[be25db1]522 osmType:
[041e464]523 title: OSM type of item (N|W|R)
[3a89adb]524 type: string
[041e464]525 enum:
526 - Node
527 - Way
528 - Relation
[13cbe66]529 comment:
530 title: Comment of an item
531 type: string
532 point:
533 title: 'Point of type [longitude, latitude]'
534 type: array
535 maxItems: 2
536 minItems: 2
537 items:
538 type: number
539 geoJsonType:
540 title: Type of GeoJSON objects
541 type: string
542 enum:
543 - Feature
544 - Point
545 geoJsonPoint:
546 type: object
547 description: GeoJSon geometry
548 externalDocs:
549 url: 'http://geojson.org/geojson-spec.html#id2'
550 properties:
551 type:
552 type: string
553 coordinates:
554 $ref: '#/components/schemas/point'
[ec8d5d0]555 sensorDepth:
556 type: number
557 title: 'Depth of sensor beneath water level in cm (positive means below water)'
558 minimum: 0
[be25db1]559 User:
560 title: User
561 type: object
562 properties:
563 username:
564 $ref: '#/components/schemas/username'
565 email:
566 type: string
567 firstName:
568 type: string
569 lastName:
570 type: string
571 activated:
572 type: boolean
573 apiKeys:
574 $ref: '#/components/schemas/apiKeys'
575 UserCreation:
576 title: User
577 type: object
578 properties:
579 username:
580 $ref: '#/components/schemas/username'
581 email:
582 type: string
583 firstName:
584 type: string
585 lastName:
586 type: string
587 password:
588 type: string
589 required:
590 - username
591 - email
592 - firstName
593 - lastName
594 - password
[3a89adb]595 Water:
596 title: Water
597 type: object
598 properties:
[be25db1]599 waterId:
[041e464]600 $ref: '#/components/schemas/itemId'
[3a89adb]601 name:
[041e464]602 $ref: '#/components/schemas/itemName'
[3a89adb]603 manager:
604 $ref: '#/components/schemas/username'
[be25db1]605 osmId:
[041e464]606 $ref: '#/components/schemas/itemId'
[be25db1]607 osmType:
608 $ref: '#/components/schemas/osmType'
[13cbe66]609 gauges:
610 $ref: '#/components/schemas/Gauges'
[3a89adb]611 required:
[be25db1]612 - waterId
[3a89adb]613 - name
614 WaterCreation:
[ec8d5d0]615 title: Water for Creation
[3a89adb]616 type: object
617 properties:
618 name:
[041e464]619 $ref: '#/components/schemas/itemName'
[be25db1]620 osmId:
[041e464]621 $ref: '#/components/schemas/itemId'
[be25db1]622 osmType:
623 $ref: '#/components/schemas/osmType'
[3a89adb]624 required:
625 - name
626 waters:
627 title: waters
628 type: array
629 items:
630 $ref: '#/components/schemas/Water'
[13cbe66]631 Gauge:
632 title: Gauge
633 type: object
634 properties:
635 gaugeId:
636 $ref: '#/components/schemas/itemId'
637 name:
638 $ref: '#/components/schemas/itemName'
639 manager:
640 $ref: '#/components/schemas/username'
641 location:
642 $ref: '#/components/schemas/point'
643 comment:
644 $ref: '#/components/schemas/comment'
645 required:
646 - gaugeId
647 - name
648 - location
649 GaugeCreation:
650 title: Gauge for Creation
651 type: object
652 properties:
653 name:
654 $ref: '#/components/schemas/itemName'
655 location:
656 $ref: '#/components/schemas/point'
657 comment:
658 $ref: '#/components/schemas/comment'
659 required:
660 - name
661 - location
662 Gauges:
663 title: Gauges
664 type: array
665 items:
666 $ref: '#/components/schemas/Gauge'
667 GaugeGeoJson:
668 title: Gauge
669 type: object
670 properties:
671 type:
672 $ref: '#/components/schemas/geoJsonType'
673 geometry:
674 $ref: '#/components/schemas/geoJsonPoint'
675 properties:
676 type: object
677 properties:
678 name:
679 $ref: '#/components/schemas/itemName'
680 manager:
681 $ref: '#/components/schemas/username'
682 comment:
683 $ref: '#/components/schemas/comment'
684 required:
685 - name
686 required:
687 - type
688 - geometry
689 - properties
690 GaugesGeoJson:
691 title: Gauges in GeoJson format
692 type: array
693 items:
694 $ref: '#/components/schemas/GaugeGeoJson'
[ec8d5d0]695 Device:
696 title: Device
697 type: object
698 properties:
699 deviceId:
700 $ref: '#/components/schemas/itemId'
701 name:
702 $ref: '#/components/schemas/itemName'
703 sensorDepth:
704 $ref: '#/components/schemas/sensorDepth'
705 comment:
706 $ref: '#/components/schemas/comment'
707 required:
708 - deviceId
709 - name
710 - sensorDepth
711 DeviceCreation:
712 title: Device for Creation
713 type: object
714 properties:
715 name:
716 $ref: '#/components/schemas/itemName'
717 sensorDepth:
718 $ref: '#/components/schemas/sensorDepth'
719 comment:
720 $ref: '#/components/schemas/comment'
721 required:
722 - name
723 - sensorDepth
724 devices:
725 title: Devices
726 type: array
727 items:
728 $ref: '#/components/schemas/Device'
[3a89adb]729 HttpError:
730 title: HTTP Error Response Object
731 type: object
732 properties:
733 code:
734 type: integer
735 message:
736 type: string
737 required:
738 - code
739 - message
740 parameters:
741 orderBy:
742 name: orderBy
743 in: query
744 description: 'Order by field: name'
745 schema:
746 type: string
747 default: name
[13cbe66]748 example: name
[3a89adb]749 order:
750 name: order
751 in: query
752 description: Order
753 schema:
754 $ref: '#/components/schemas/order'
[be25db1]755 example: ''
[3a89adb]756 offset:
757 name: offset
758 in: query
759 description: >-
760 Skip over a number of elements by specifying an offset value for the
761 query
762 schema:
763 type: integer
764 format: int32
765 default: 0
766 example: 0
767 limit:
768 name: limit
769 in: query
770 description: Limit the number of elements on the response
771 style: form
772 explode: true
773 schema:
774 type: integer
775 format: int32
776 default: 10
777 example: 10
778 examples:
[be25db1]779 User:
780 value:
781 username: jane
782 email: jane@example.org
783 firstName: Jane
784 lastName: Doe
785 activated: true
786 apiKeys:
787 - ApiKey4701
788 UserCreation:
789 value:
790 username: richard
791 email: richard@examle.org
792 firstName: Richard
793 lastName: Roe
794 password: sdfl.1238_ASDkeil?
[3a89adb]795 Water:
796 value:
[be25db1]797 waterId: 1
[3a89adb]798 name: Mississippi
[be25db1]799 osmId: 1756854
800 osmType: R
[3a89adb]801 summary: A water example object
802 WaterCreation:
803 value:
804 name: Mississippi
[be25db1]805 osmId: 1756854
[13cbe66]806 osmType: Relation
[3a89adb]807 summary: A water example object for creation of a water
808 waters:
809 value:
[be25db1]810 - waterId: 1
[13cbe66]811 name: Mississippi
[be25db1]812 osmId: 1756854
[13cbe66]813 osmType: Relation
[be25db1]814 - waterId: 2
[13cbe66]815 name: Bodensee
[3a89adb]816 summary: A sample list with waters
[13cbe66]817 Gauge:
818 value:
819 gaugeId: 1
820 name: New Orleans
821 manager: jane
822 location:
823 - 90.136111
824 - 29.934722
825 comment: Gauge for Mississippi in New Orleans
826 Gauges:
827 value:
828 - gaugeId: 1
829 name: New Orleans
830 manager: jane
831 location:
832 - 90.136111
833 - 29.934722
834 summary: A sample list of gauges
835 GaugeGeoJson:
836 value:
837 type: Feature
838 geometry:
839 type: Point
840 coordinates:
841 - 90.136111
[ec8d5d0]842 - 29.934722
[13cbe66]843 properties:
844 name: New Orleans
845 manager: jane
846 comment: Gauge for Mississippi in New Orleans
847 GaugesGeoJson:
848 value:
849 - type: Feature
850 geometry:
851 type: Point
852 coordinates:
853 - 90.136111
[ec8d5d0]854 - 29.934722
[13cbe66]855 properties:
856 name: New Orleans
857 manager: jane
858 comment: Gauge for Mississippi in New Orleans
859 summary: A sample list of gauges in GeoJson format
[ec8d5d0]860 Device:
861 value:
862 deviceId: 1
863 name: Lovely Boat
864 sensorDepth: 0.2
865 comment: Really a pleasure to measure
866 summary: A sample device
867 devices:
868 value:
869 - deviceId: 1
870 name: Lovely Boat
871 sensorDepth: 0.2
872 comment: Really a pleasure to measure
[3a89adb]873 HttpError:
874 value:
875 code: 404
876 message: Water with id 999999 not found
877 responses:
878 BadRequest:
879 description: Bad Request (400)
880 content:
881 application/json:
882 schema:
883 $ref: '#/components/schemas/HttpError'
884 examples:
885 HttpError:
886 $ref: '#/components/examples/HttpError'
887 Unauthorized:
888 description: Unauthorized (401) acces to resource
889 content:
890 application/json:
891 schema:
892 $ref: '#/components/schemas/HttpError'
893 examples:
894 HttpError:
895 $ref: '#/components/examples/HttpError'
896 NotFound:
897 description: Water with given Id not found
898 content:
899 application/json:
900 schema:
901 $ref: '#/components/schemas/HttpError'
902 examples:
903 HttpError:
904 $ref: '#/components/examples/HttpError'
905tags:
906 - name: waters
907 description: >-
908 A water is a river (like Mississippi, lake (Lake Ontario), or a sea (North
909 Sea)
[be25db1]910 - name: users
[13cbe66]911 description: All actions used to manage users and api keys
[ec8d5d0]912 - name: devices
913 description: All actions used to manage devices of an user
Note: See TracBrowser for help on using the repository browser.