source: src/mapservice/openapi.yaml@ fc99a86

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

Gauges could be added now

  • Property mode set to 100644
File size: 19.7 KB
Line 
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:
25 '/user':
26 get:
27 description: Returns information of current/authorized user
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:
83 application/json: {}
84 '/user/apikey_create':
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'
100 example: NewApiKey4711
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'
121 example: DelApiKey4711
122 responses:
123 '200':
124 description: OK
125 content:
126 application/json:
127 schema:
128 $ref: '#/components/schemas/apiKeys'
129 example: ApiKey4711
130 '400':
131 $ref: '#/components/responses/BadRequest'
132 '401':
133 $ref: '#/components/responses/Unauthorized'
134 '404':
135 $ref: '#/components/responses/NotFound'
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'
150 example: dac9630aec642a428cd73f4be0a03569
151 responses:
152 '302':
153 description: OK or not OK
154 headers:
155 Location:
156 schema:
157 type: string
158 description: 'URL to the website, showing the result of the activation'
159 '/waters':
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
168 in: query
169 schema:
170 $ref: '#/components/schemas/itemName'
171 example: Missi
172 - name: manager
173 in: query
174 schema:
175 $ref: '#/components/schemas/username'
176 example: jane
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'
190 '404':
191 $ref: '#/components/responses/NotFound'
192 post:
193 description: Adds a new water to the database
194 tags:
195 - waters
196 summary: Add a new water
197 operationId: watersCreate
198 security:
199 - basicAuth: []
200 - apiKeyAuth: []
201 requestBody:
202 content:
203 application/json:
204 schema:
205 $ref: '#/components/schemas/WaterCreation'
206 example:
207 name: Rhein
208 osmId: 1756854
209 osmType: Relation
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
230 operationId: watersGetById
231 parameters:
232 - name: id
233 in: path
234 description: Item ID
235 required: true
236 schema:
237 $ref: '#/components/schemas/itemId'
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'
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'
379components:
380 securitySchemes:
381 basicAuth:
382 type: http
383 scheme: basic
384 x-basicInfoFunc: openapi_server.server_impl.security.Security.auth_basic
385 apiKeyAuth:
386 type: apiKey
387 in: header
388 name: X-API-KEY
389 x-apikeyInfoFunc: openapi_server.server_impl.security.Security.auth_api
390 schemas:
391 username:
392 title: Username
393 type: string
394 apiKey:
395 title: API Key
396 type: string
397 apiKeys:
398 title: Array of API keys
399 type: array
400 items:
401 $ref: '#/components/schemas/apiKey'
402 activationCode:
403 title: Activation code for a User
404 type: string
405 itemId:
406 title: Item ID
407 type: integer
408 format: int32
409 itemName:
410 title: Item Name
411 type: string
412 order:
413 title: order
414 enum:
415 - desc
416 - asc
417 type: string
418 default: asc
419 description: |
420 Sort order:
421 * `asc` - Ascending, from A to Z
422 * `desc` - Descending, from Z to A
423 example: asc
424 osmType:
425 title: OSM type of item (N|W|R)
426 type: string
427 enum:
428 - Node
429 - Way
430 - Relation
431 comment:
432 title: Comment of an item
433 type: string
434 point:
435 title: 'Point of type [longitude, latitude]'
436 type: array
437 maxItems: 2
438 minItems: 2
439 items:
440 type: number
441 geoJsonType:
442 title: Type of GeoJSON objects
443 type: string
444 enum:
445 - Feature
446 - Point
447 geoJsonPoint:
448 type: object
449 description: GeoJSon geometry
450 externalDocs:
451 url: 'http://geojson.org/geojson-spec.html#id2'
452 properties:
453 type:
454 type: string
455 coordinates:
456 $ref: '#/components/schemas/point'
457 User:
458 title: User
459 type: object
460 properties:
461 username:
462 $ref: '#/components/schemas/username'
463 email:
464 type: string
465 firstName:
466 type: string
467 lastName:
468 type: string
469 activated:
470 type: boolean
471 apiKeys:
472 $ref: '#/components/schemas/apiKeys'
473 UserCreation:
474 title: User
475 type: object
476 properties:
477 username:
478 $ref: '#/components/schemas/username'
479 email:
480 type: string
481 firstName:
482 type: string
483 lastName:
484 type: string
485 password:
486 type: string
487 required:
488 - username
489 - email
490 - firstName
491 - lastName
492 - password
493 Water:
494 title: Water
495 type: object
496 properties:
497 waterId:
498 $ref: '#/components/schemas/itemId'
499 name:
500 $ref: '#/components/schemas/itemName'
501 manager:
502 $ref: '#/components/schemas/username'
503 osmId:
504 $ref: '#/components/schemas/itemId'
505 osmType:
506 $ref: '#/components/schemas/osmType'
507 gauges:
508 $ref: '#/components/schemas/Gauges'
509 required:
510 - waterId
511 - name
512 WaterCreation:
513 title: Water
514 type: object
515 properties:
516 name:
517 $ref: '#/components/schemas/itemName'
518 osmId:
519 $ref: '#/components/schemas/itemId'
520 osmType:
521 $ref: '#/components/schemas/osmType'
522 required:
523 - name
524 waters:
525 title: waters
526 type: array
527 items:
528 $ref: '#/components/schemas/Water'
529 Gauge:
530 title: Gauge
531 type: object
532 properties:
533 gaugeId:
534 $ref: '#/components/schemas/itemId'
535 name:
536 $ref: '#/components/schemas/itemName'
537 manager:
538 $ref: '#/components/schemas/username'
539 location:
540 $ref: '#/components/schemas/point'
541 comment:
542 $ref: '#/components/schemas/comment'
543 required:
544 - gaugeId
545 - name
546 - location
547 GaugeCreation:
548 title: Gauge for Creation
549 type: object
550 properties:
551 name:
552 $ref: '#/components/schemas/itemName'
553 location:
554 $ref: '#/components/schemas/point'
555 comment:
556 $ref: '#/components/schemas/comment'
557 required:
558 - name
559 - location
560 Gauges:
561 title: Gauges
562 type: array
563 items:
564 $ref: '#/components/schemas/Gauge'
565 GaugeGeoJson:
566 title: Gauge
567 type: object
568 properties:
569 type:
570 $ref: '#/components/schemas/geoJsonType'
571 geometry:
572 $ref: '#/components/schemas/geoJsonPoint'
573 properties:
574 type: object
575 properties:
576 name:
577 $ref: '#/components/schemas/itemName'
578 manager:
579 $ref: '#/components/schemas/username'
580 comment:
581 $ref: '#/components/schemas/comment'
582 required:
583 - name
584 required:
585 - type
586 - geometry
587 - properties
588 GaugesGeoJson:
589 title: Gauges in GeoJson format
590 type: array
591 items:
592 $ref: '#/components/schemas/GaugeGeoJson'
593 HttpError:
594 title: HTTP Error Response Object
595 type: object
596 properties:
597 code:
598 type: integer
599 message:
600 type: string
601 required:
602 - code
603 - message
604 parameters:
605 orderBy:
606 name: orderBy
607 in: query
608 description: 'Order by field: name'
609 schema:
610 type: string
611 default: name
612 example: name
613 order:
614 name: order
615 in: query
616 description: Order
617 schema:
618 $ref: '#/components/schemas/order'
619 example: ''
620 offset:
621 name: offset
622 in: query
623 description: >-
624 Skip over a number of elements by specifying an offset value for the
625 query
626 schema:
627 type: integer
628 format: int32
629 default: 0
630 example: 0
631 limit:
632 name: limit
633 in: query
634 description: Limit the number of elements on the response
635 style: form
636 explode: true
637 schema:
638 type: integer
639 format: int32
640 default: 10
641 example: 10
642 examples:
643 User:
644 value:
645 username: jane
646 email: jane@example.org
647 firstName: Jane
648 lastName: Doe
649 activated: true
650 apiKeys:
651 - ApiKey4701
652 UserCreation:
653 value:
654 username: richard
655 email: richard@examle.org
656 firstName: Richard
657 lastName: Roe
658 password: sdfl.1238_ASDkeil?
659 Water:
660 value:
661 waterId: 1
662 name: Mississippi
663 osmId: 1756854
664 osmType: R
665 summary: A water example object
666 WaterCreation:
667 value:
668 name: Mississippi
669 osmId: 1756854
670 osmType: Relation
671 summary: A water example object for creation of a water
672 waters:
673 value:
674 - waterId: 1
675 name: Mississippi
676 osmId: 1756854
677 osmType: Relation
678 - waterId: 2
679 name: Bodensee
680 summary: A sample list with waters
681 Gauge:
682 value:
683 gaugeId: 1
684 name: New Orleans
685 manager: jane
686 location:
687 - 90.136111
688 - 29.934722
689 comment: Gauge for Mississippi in New Orleans
690 Gauges:
691 value:
692 - gaugeId: 1
693 name: New Orleans
694 manager: jane
695 location:
696 - 90.136111
697 - 29.934722
698 summary: A sample list of gauges
699 GaugeGeoJson:
700 value:
701 type: Feature
702 geometry:
703 type: Point
704 coordinates:
705 - 90.136111
706 - 29.934722
707 properties:
708 name: New Orleans
709 manager: jane
710 comment: Gauge for Mississippi in New Orleans
711 GaugesGeoJson:
712 value:
713 - type: Feature
714 geometry:
715 type: Point
716 coordinates:
717 - 90.136111
718 - 29.934722
719 properties:
720 name: New Orleans
721 manager: jane
722 comment: Gauge for Mississippi in New Orleans
723 summary: A sample list of gauges in GeoJson format
724 HttpError:
725 value:
726 code: 404
727 message: Water with id 999999 not found
728 responses:
729 BadRequest:
730 description: Bad Request (400)
731 content:
732 application/json:
733 schema:
734 $ref: '#/components/schemas/HttpError'
735 examples:
736 HttpError:
737 $ref: '#/components/examples/HttpError'
738 Unauthorized:
739 description: Unauthorized (401) acces to resource
740 content:
741 application/json:
742 schema:
743 $ref: '#/components/schemas/HttpError'
744 examples:
745 HttpError:
746 $ref: '#/components/examples/HttpError'
747 NotFound:
748 description: Water with given Id not found
749 content:
750 application/json:
751 schema:
752 $ref: '#/components/schemas/HttpError'
753 examples:
754 HttpError:
755 $ref: '#/components/examples/HttpError'
756tags:
757 - name: waters
758 description: >-
759 A water is a river (like Mississippi, lake (Lake Ontario), or a sea (North
760 Sea)
761 - name: users
762 description: All actions used to manage users and api keys
Note: See TracBrowser for help on using the repository browser.