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