source: src/mapservice/openapi.yaml@ 1e7f556

debian/bullseye
Last change on this file since 1e7f556 was 041e464, checked in by Joachim Langenbach <joachim.langenbach@…>, 8 years ago

Adding waters is working

  • Property mode set to 100644
File size: 12.5 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:
[be25db1]25 '/user':
26 get:
27 description: Returns information for a 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 - apiKeyAuth: []
94 responses:
95 '200':
96 description: OK
97 content:
98 application/json:
99 schema:
100 $ref: '#/components/schemas/apiKeys'
101 example: 'NewApiKey4711'
102 '400':
103 $ref: '#/components/responses/BadRequest'
104 '401':
105 $ref: '#/components/responses/Unauthorized'
106 '/user/{api_key}':
107 delete:
108 description: Deletes given API key and returns remaining API keys of the user
109 tags:
110 - users
111 summary: Deletes API key
112 operationId: usersApiKeyDelete
113 security:
114 - basicAuth: []
115 - apiKeyAuth: []
116 parameters:
117 - name: api_key
118 in: path
119 description: API key
120 required: true
121 schema:
122 $ref: '#/components/schemas/apiKey'
123 example: 'DelApiKey4711'
124 responses:
125 '200':
126 description: OK
127 content:
128 application/json:
129 schema:
130 $ref: '#/components/schemas/apiKeys'
131 example: 'ApiKey4711'
132 '400':
133 $ref: '#/components/responses/BadRequest'
134 '401':
135 $ref: '#/components/responses/Unauthorized'
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
[3a89adb]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
[be25db1]168 in: query
[3a89adb]169 schema:
[041e464]170 $ref: '#/components/schemas/itemName'
[be25db1]171 example: 'Missi'
[3a89adb]172 - name: manager
[be25db1]173 in: query
[3a89adb]174 schema:
175 $ref: '#/components/schemas/username'
[be25db1]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'
190 post:
191 description: Adds a new water to the database
192 tags:
193 - waters
194 summary: Add a new water
[be25db1]195 operationId: watersCreate
[3a89adb]196 security:
197 - basicAuth: []
198 - apiKeyAuth: []
199 requestBody:
200 content:
201 application/json:
202 schema:
203 $ref: '#/components/schemas/WaterCreation'
[041e464]204 example:
205 name: Rhein
206 osmId: 1756854
207 osmType: 'Relation'
[3a89adb]208 responses:
209 '201':
210 description: Water created
211 content:
212 application/json:
213 schema:
214 $ref: '#/components/schemas/Water'
215 examples:
216 Water:
217 $ref: '#/components/examples/Water'
218 '400':
219 $ref: '#/components/responses/BadRequest'
220 '401':
221 $ref: '#/components/responses/Unauthorized'
222 '/waters/{id}':
223 get:
224 description: Returns the water identified by id
225 tags:
226 - waters
227 summary: Represents a water
228 operationId: waterGetById
229 parameters:
230 - name: id
231 in: path
232 description: Item ID
233 required: true
234 schema:
[041e464]235 $ref: '#/components/schemas/itemId'
[3a89adb]236 responses:
237 '200':
238 description: OK
239 content:
240 application/json:
241 schema:
242 $ref: '#/components/schemas/Water'
243 examples:
244 Water:
245 $ref: '#/components/examples/Water'
246 '404':
247 $ref: '#/components/responses/NotFound'
248components:
249 securitySchemes:
250 basicAuth:
251 type: http
252 scheme: basic
253 x-basicInfoFunc: openapi_server.server_impl.security.Security.auth_basic
254 apiKeyAuth:
255 type: apiKey
256 in: header
257 name: X-API-KEY
258 x-apikeyInfoFunc: openapi_server.server_impl.security.Security.auth_api
259 schemas:
260 username:
261 title: Username
262 type: string
[be25db1]263 apiKey:
264 title: API Key
265 type: string
266 apiKeys:
267 title: Array of API keys
268 type: array
269 items:
270 $ref: '#/components/schemas/apiKey'
271 activationCode:
272 title: Activation code for a User
273 type: string
[041e464]274 itemId:
[3a89adb]275 title: Item ID
276 type: integer
277 format: int32
[041e464]278 itemName:
[3a89adb]279 title: Item Name
280 type: string
[be25db1]281 osmType:
[041e464]282 title: OSM type of item (N|W|R)
[3a89adb]283 type: string
[041e464]284 enum:
285 - Node
286 - Way
287 - Relation
[be25db1]288 User:
289 title: User
290 type: object
291 properties:
292 username:
293 $ref: '#/components/schemas/username'
294 email:
295 type: string
296 firstName:
297 type: string
298 lastName:
299 type: string
300 activated:
301 type: boolean
302 apiKeys:
303 $ref: '#/components/schemas/apiKeys'
304 UserCreation:
305 title: User
306 type: object
307 properties:
308 username:
309 $ref: '#/components/schemas/username'
310 email:
311 type: string
312 firstName:
313 type: string
314 lastName:
315 type: string
316 password:
317 type: string
318 required:
319 - username
320 - email
321 - firstName
322 - lastName
323 - password
[3a89adb]324 Water:
325 title: Water
326 type: object
327 properties:
[be25db1]328 waterId:
[041e464]329 $ref: '#/components/schemas/itemId'
[3a89adb]330 name:
[041e464]331 $ref: '#/components/schemas/itemName'
[3a89adb]332 manager:
333 $ref: '#/components/schemas/username'
[be25db1]334 osmId:
[041e464]335 $ref: '#/components/schemas/itemId'
[be25db1]336 osmType:
337 $ref: '#/components/schemas/osmType'
[3a89adb]338 required:
[be25db1]339 - waterId
[3a89adb]340 - name
341 WaterCreation:
342 title: Water
343 type: object
344 properties:
345 name:
[041e464]346 $ref: '#/components/schemas/itemName'
[be25db1]347 osmId:
[041e464]348 $ref: '#/components/schemas/itemId'
[be25db1]349 osmType:
350 $ref: '#/components/schemas/osmType'
[3a89adb]351 required:
352 - name
353 waters:
354 title: waters
355 type: array
356 items:
357 $ref: '#/components/schemas/Water'
358 order:
359 title: order
360 enum:
361 - desc
362 - asc
363 type: string
364 default: asc
365 description: |
366 Sort order:
367 * `asc` - Ascending, from A to Z
368 * `desc` - Descending, from Z to A
369 example: asc
370 HttpError:
371 title: HTTP Error Response Object
372 type: object
373 properties:
374 code:
375 type: integer
376 message:
377 type: string
378 required:
379 - code
380 - message
381 parameters:
382 orderBy:
383 name: orderBy
384 in: query
385 description: 'Order by field: name'
386 schema:
387 type: string
388 default: name
[be25db1]389 example: 'name'
[3a89adb]390 order:
391 name: order
392 in: query
393 description: Order
394 schema:
395 $ref: '#/components/schemas/order'
[be25db1]396 example: ''
[3a89adb]397 offset:
398 name: offset
399 in: query
400 description: >-
401 Skip over a number of elements by specifying an offset value for the
402 query
403 schema:
404 type: integer
405 format: int32
406 default: 0
407 example: 0
408 limit:
409 name: limit
410 in: query
411 description: Limit the number of elements on the response
412 style: form
413 explode: true
414 schema:
415 type: integer
416 format: int32
417 default: 10
418 example: 10
419 examples:
[be25db1]420 User:
421 value:
422 username: jane
423 email: jane@example.org
424 firstName: Jane
425 lastName: Doe
426 activated: true
427 apiKeys:
428 - ApiKey4701
429 UserCreation:
430 value:
431 username: richard
432 email: richard@examle.org
433 firstName: Richard
434 lastName: Roe
435 password: sdfl.1238_ASDkeil?
[3a89adb]436 Water:
437 value:
[be25db1]438 waterId: 1
[3a89adb]439 name: Mississippi
[be25db1]440 osmId: 1756854
441 osmType: R
[3a89adb]442 summary: A water example object
443 WaterCreation:
444 value:
445 name: Mississippi
[be25db1]446 osmId: 1756854
[041e464]447 osmType: 'Relation'
[3a89adb]448 summary: A water example object for creation of a water
449 waters:
450 value:
[be25db1]451 - waterId: 1
[041e464]452 name: 'Mississippi'
[be25db1]453 osmId: 1756854
[041e464]454 osmType: 'Relation'
[be25db1]455 - waterId: 2
[041e464]456 name: 'Bodensee'
[3a89adb]457 summary: A sample list with waters
458 HttpError:
459 value:
460 code: 404
461 message: Water with id 999999 not found
462 responses:
463 BadRequest:
464 description: Bad Request (400)
465 content:
466 application/json:
467 schema:
468 $ref: '#/components/schemas/HttpError'
469 examples:
470 HttpError:
471 $ref: '#/components/examples/HttpError'
472 Unauthorized:
473 description: Unauthorized (401) acces to resource
474 content:
475 application/json:
476 schema:
477 $ref: '#/components/schemas/HttpError'
478 examples:
479 HttpError:
480 $ref: '#/components/examples/HttpError'
481 NotFound:
482 description: Water with given Id not found
483 content:
484 application/json:
485 schema:
486 $ref: '#/components/schemas/HttpError'
487 examples:
488 HttpError:
489 $ref: '#/components/examples/HttpError'
490tags:
491 - name: waters
492 description: >-
493 A water is a river (like Mississippi, lake (Lake Ontario), or a sea (North
494 Sea)
[be25db1]495 - name: users
496 description: >-
497 All actions used to manage users and api keys
Note: See TracBrowser for help on using the repository browser.