university-final-iot-backend/app/swagger/template.yaml

290 lines
5.6 KiB
YAML

---
servers:
- url: https://final-iot-backend.herokuapp.com/
description: Heroku deployed app for production usage
- url: https://final-iot-backend-staging.herokuapp.com/
description: Heroku staging app for pre-release testing
- url: https://final-iot-backend-test.herokuapp.com/
description: Heroku test app
basePath: ""
definitions:
genericname:
type: string
description: name
example: name
username:
type: string
description: User's name in the system
example: user_name
id:
type: integer
description: ID
example: 1
datetime:
type: string
description: Time
example: 2018-09-19T17:50:24+00:00
timestamp:
type: integer
description: Time
example: 1537379424
devicetypename:
type: string
description: Name of device type
default: STANDARD
example: STANDARD
devicename:
type: string
description: Name of device
example: Temperature device
devicetype:
type: integer
description: Type of device
example: 1
email:
type: string
format: email
description: User's registered email
example: user@mail.com
password:
type: string
format: password
description: User's password
example: TestPassword1234
status:
type: string
description: Status of request
example: error
message:
type: string
description: Descriptive message
example: Long message
configuration:
type: string
description: Configuration
example: {}
dashboarddata:
type: object
description: Dashboard data
example: {}
Credentials:
type: object
required:
- username
- password
properties:
username:
$ref: '#/definitions/username'
password:
$ref: '#/definitions/password'
User:
type: object
required:
- username
- password
- email
properties:
username:
$ref: '#/definitions/username'
password:
$ref: '#/definitions/password'
email:
$ref: '#/definitions/email'
Role:
type: object
required:
- id
- display_name
- permissions
properties:
id:
$ref: '#/definitions/id'
display_name:
$ref: '#/definitions/genericname'
permissions:
type: array
items:
$ref: '#definitions/genericname'
Recording:
type: object
required:
- recorded_at
- record_type
- record_value
properties:
recorded_at:
$ref: '#/definitions/datetime'
record_type:
$ref: '#/definitions/id'
record_value:
type: string
description: Value of the recording
example: '25 degrees'
RecordingCreation:
type: object
required:
- recorded_at
- record_type
- record_value
properties:
recorded_at:
$ref: '#/definitions/timestamp'
record_type:
$ref: '#/definitions/id'
record_value:
type: string
description: Value of the recording
example: '25 degrees'
DeviceType:
type: object
required:
- id
- name
properties:
id:
$ref: '#/definitions/id'
name:
$ref: '#/definitions/devicetypename'
Device:
type: object
required:
- id
- name
- device_type
properties:
id:
$ref: '#/definitions/id'
name:
$ref: '#/definitions/devicename'
device_type:
$ref: '#/definitions/DeviceType'
DeviceWithConfig:
type: object
required:
- id
- name
- device_type
- configuration
properties:
id:
$ref: '#/definitions/id'
name:
$ref: '#/definitions/devicename'
device_type:
$ref: '#/definitions/DeviceType'
configuration:
$ref: '#/definitions/configuration'
DeviceCreation:
type: object
required:
- name
- device_type_id
properties:
name:
$ref: '#/definitions/devicename'
device_type_id:
$ref: '#/definitions/id'
Dashboard:
type: object
required:
- id
- active
- dashboard_data
- name
properties:
id:
$ref: '#/definitions/id'
dashboard_data:
$ref: '#/definitions/dashboarddata'
DashboardCreation:
type: object
required:
- active
- dashboard_data
- name
properties:
dashboard_data:
$ref: '#/definitions/dashboarddata'
active:
type: boolean
UnauthorizedError:
type: object
required:
- status
- message
properties:
status:
$ref: '#/definitions/status'
example: error
message:
$ref: '#/definitions/message'
example: Unauthorized
Error:
type: object
required:
- status
- message
properties:
status:
$ref: '#/definitions/status'
example: error
message:
$ref: '#/definitions/message'
example: Error message
securityDefinitions:
Bearer:
type: apiKey
name: Authorization
in: header
description: |
For accessing the API a valid JWT token must be passed in all the queries in
the 'Authorization' header as Bearer token.
A valid JWT token is generated by the API and returned as answer of a call
to the route /login giving a valid user & password.
The following syntax must be used in the 'Authorization' header :
Bearer xxxxxx.yyyyyyy.zzzzzz
security:
- Bearer: []
info:
description: Python (Flask) backend for IoT sysyem made for master's degree final project
title: IoT Backend
version: 0.1.0
swagger: '2.0'