2018-05-07 14:13:07 +00:00
|
|
|
---
|
|
|
|
servers:
|
|
|
|
- url: https://final-iot-backend.herokuapp.com/
|
2018-10-08 20:40:25 +00:00
|
|
|
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
|
2018-05-07 14:13:07 +00:00
|
|
|
|
|
|
|
basePath: ""
|
|
|
|
|
|
|
|
definitions:
|
|
|
|
|
2018-09-23 11:56:41 +00:00
|
|
|
genericname:
|
|
|
|
type: string
|
|
|
|
description: name
|
2018-09-23 16:56:29 +00:00
|
|
|
example: name
|
2018-09-23 11:56:41 +00:00
|
|
|
|
2018-05-07 14:13:07 +00:00
|
|
|
username:
|
|
|
|
type: string
|
|
|
|
description: User's name in the system
|
2018-09-23 16:56:29 +00:00
|
|
|
example: user_name
|
2018-05-07 14:13:07 +00:00
|
|
|
|
2018-05-08 14:45:09 +00:00
|
|
|
id:
|
|
|
|
type: integer
|
|
|
|
description: ID
|
2018-09-23 16:56:29 +00:00
|
|
|
example: 1
|
2018-05-08 14:45:09 +00:00
|
|
|
|
|
|
|
datetime:
|
|
|
|
type: string
|
|
|
|
description: Time
|
2018-09-23 16:56:29 +00:00
|
|
|
example: 2018-09-19T17:50:24+00:00
|
2018-05-08 14:45:09 +00:00
|
|
|
|
2018-09-23 16:44:32 +00:00
|
|
|
timestamp:
|
|
|
|
type: integer
|
|
|
|
description: Time
|
2018-09-23 16:56:29 +00:00
|
|
|
example: 1537379424
|
2018-09-23 16:44:32 +00:00
|
|
|
|
2018-09-17 22:51:26 +00:00
|
|
|
devicetypename:
|
|
|
|
type: string
|
|
|
|
description: Name of device type
|
|
|
|
default: STANDARD
|
2018-09-23 16:56:29 +00:00
|
|
|
example: STANDARD
|
2018-09-17 22:51:26 +00:00
|
|
|
|
2018-05-08 14:45:09 +00:00
|
|
|
devicename:
|
|
|
|
type: string
|
|
|
|
description: Name of device
|
2018-09-23 16:56:29 +00:00
|
|
|
example: Temperature device
|
2018-05-08 14:45:09 +00:00
|
|
|
|
|
|
|
devicetype:
|
2018-09-23 16:44:32 +00:00
|
|
|
type: integer
|
2018-05-08 14:45:09 +00:00
|
|
|
description: Type of device
|
2018-09-23 16:56:29 +00:00
|
|
|
example: 1
|
2018-05-08 14:45:09 +00:00
|
|
|
|
2018-05-07 14:13:07 +00:00
|
|
|
email:
|
|
|
|
type: string
|
|
|
|
format: email
|
|
|
|
description: User's registered email
|
2018-09-23 16:56:29 +00:00
|
|
|
example: user@mail.com
|
2018-05-07 14:13:07 +00:00
|
|
|
|
|
|
|
password:
|
|
|
|
type: string
|
|
|
|
format: password
|
|
|
|
description: User's password
|
2018-09-23 16:56:29 +00:00
|
|
|
example: TestPassword1234
|
2018-05-07 14:13:07 +00:00
|
|
|
|
|
|
|
status:
|
|
|
|
type: string
|
|
|
|
description: Status of request
|
2018-09-23 16:56:29 +00:00
|
|
|
example: error
|
2018-05-07 14:13:07 +00:00
|
|
|
|
|
|
|
message:
|
|
|
|
type: string
|
|
|
|
description: Descriptive message
|
2018-09-23 16:56:29 +00:00
|
|
|
example: Long message
|
2018-05-07 14:13:07 +00:00
|
|
|
|
2018-09-19 22:23:22 +00:00
|
|
|
configuration:
|
|
|
|
type: string
|
|
|
|
description: Configuration
|
2018-09-23 16:56:29 +00:00
|
|
|
example: {}
|
2018-09-19 22:23:22 +00:00
|
|
|
|
2018-09-19 23:42:37 +00:00
|
|
|
dashboarddata:
|
2018-09-23 12:07:36 +00:00
|
|
|
type: object
|
2018-09-19 23:42:37 +00:00
|
|
|
description: Dashboard data
|
2018-09-23 16:56:29 +00:00
|
|
|
example: {}
|
2018-09-19 23:42:37 +00:00
|
|
|
|
2018-05-07 14:13:07 +00:00
|
|
|
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'
|
|
|
|
|
2018-09-23 11:56:41 +00:00
|
|
|
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'
|
|
|
|
|
2018-05-08 14:45:09 +00:00
|
|
|
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
|
2018-09-23 16:56:29 +00:00
|
|
|
example: '25 degrees'
|
2018-05-08 14:45:09 +00:00
|
|
|
|
2018-09-23 16:44:32 +00:00
|
|
|
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
|
2018-09-23 16:56:29 +00:00
|
|
|
example: '25 degrees'
|
2018-09-23 16:44:32 +00:00
|
|
|
|
2018-09-17 22:51:26 +00:00
|
|
|
DeviceType:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- id
|
|
|
|
- name
|
|
|
|
properties:
|
|
|
|
id:
|
|
|
|
$ref: '#/definitions/id'
|
|
|
|
name:
|
|
|
|
$ref: '#/definitions/devicetypename'
|
|
|
|
|
2018-05-08 14:45:09 +00:00
|
|
|
Device:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- id
|
|
|
|
- name
|
2018-09-17 22:51:26 +00:00
|
|
|
- device_type
|
2018-05-08 14:45:09 +00:00
|
|
|
properties:
|
|
|
|
id:
|
|
|
|
$ref: '#/definitions/id'
|
|
|
|
name:
|
|
|
|
$ref: '#/definitions/devicename'
|
2018-09-17 22:51:26 +00:00
|
|
|
device_type:
|
|
|
|
$ref: '#/definitions/DeviceType'
|
2018-05-08 14:45:09 +00:00
|
|
|
|
2018-09-19 22:23:22 +00:00
|
|
|
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'
|
|
|
|
|
2018-09-19 21:04:49 +00:00
|
|
|
DeviceCreation:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- name
|
|
|
|
- device_type_id
|
|
|
|
properties:
|
|
|
|
name:
|
|
|
|
$ref: '#/definitions/devicename'
|
|
|
|
device_type_id:
|
|
|
|
$ref: '#/definitions/id'
|
|
|
|
|
2018-09-19 23:42:37 +00:00
|
|
|
Dashboard:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- id
|
|
|
|
- dashboard_data
|
|
|
|
properties:
|
|
|
|
id:
|
|
|
|
$ref: '#/definitions/id'
|
|
|
|
dashboard_data:
|
|
|
|
$ref: '#/definitions/dashboarddata'
|
|
|
|
|
|
|
|
DashboardCreation:
|
|
|
|
type: object
|
|
|
|
required:
|
2018-10-15 17:51:51 +00:00
|
|
|
- active
|
2018-09-19 23:42:37 +00:00
|
|
|
- dashboard_data
|
|
|
|
properties:
|
|
|
|
dashboard_data:
|
|
|
|
$ref: '#/definitions/dashboarddata'
|
2018-10-15 17:51:51 +00:00
|
|
|
active:
|
|
|
|
type: boolean
|
2018-09-19 23:42:37 +00:00
|
|
|
|
2018-05-07 15:17:19 +00:00
|
|
|
UnauthorizedError:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- status
|
|
|
|
- message
|
|
|
|
properties:
|
|
|
|
status:
|
|
|
|
$ref: '#/definitions/status'
|
2018-09-23 16:56:29 +00:00
|
|
|
example: error
|
2018-05-07 15:17:19 +00:00
|
|
|
message:
|
|
|
|
$ref: '#/definitions/message'
|
2018-09-23 16:56:29 +00:00
|
|
|
example: Unauthorized
|
2018-05-07 15:17:19 +00:00
|
|
|
|
2018-05-07 14:13:07 +00:00
|
|
|
Error:
|
|
|
|
type: object
|
|
|
|
required:
|
|
|
|
- status
|
|
|
|
- message
|
|
|
|
properties:
|
|
|
|
status:
|
|
|
|
$ref: '#/definitions/status'
|
2018-09-23 16:56:29 +00:00
|
|
|
example: error
|
2018-05-07 14:13:07 +00:00
|
|
|
message:
|
|
|
|
$ref: '#/definitions/message'
|
2018-09-23 16:56:29 +00:00
|
|
|
example: Error message
|
2018-05-07 14:13:07 +00:00
|
|
|
|
2018-05-07 15:17:19 +00:00
|
|
|
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: []
|
|
|
|
|
2018-05-07 14:13:07 +00:00
|
|
|
info:
|
|
|
|
description: Python (Flask) backend for IoT sysyem made for master's degree final project
|
|
|
|
title: IoT Backend
|
2018-09-23 16:44:32 +00:00
|
|
|
version: 0.1.0
|
2018-05-07 14:13:07 +00:00
|
|
|
swagger: '2.0'
|