177 lines
3.3 KiB
YAML
177 lines
3.3 KiB
YAML
---
|
|
servers:
|
|
- url: https://final-iot-backend.herokuapp.com/
|
|
description: Heroku deployed app for testing
|
|
|
|
basePath: ""
|
|
|
|
definitions:
|
|
|
|
username:
|
|
type: string
|
|
description: User's name in the system
|
|
default: testusername
|
|
|
|
id:
|
|
type: integer
|
|
description: ID
|
|
default: 1
|
|
|
|
datetime:
|
|
type: string
|
|
description: Time
|
|
|
|
devicetypename:
|
|
type: string
|
|
description: Name of device type
|
|
default: STANDARD
|
|
|
|
devicename:
|
|
type: string
|
|
description: Name of device
|
|
default: My device
|
|
|
|
devicetype:
|
|
type: int
|
|
description: Type of device
|
|
default: 1
|
|
|
|
email:
|
|
type: string
|
|
format: email
|
|
description: User's registered email
|
|
default: user@test.com
|
|
|
|
password:
|
|
type: string
|
|
format: password
|
|
description: User's password
|
|
default: TestPassword1234
|
|
|
|
status:
|
|
type: string
|
|
description: Status of request
|
|
|
|
message:
|
|
type: string
|
|
description: Descriptive message
|
|
|
|
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'
|
|
|
|
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
|
|
default: '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'
|
|
|
|
UnauthorizedError:
|
|
type: object
|
|
required:
|
|
- status
|
|
- message
|
|
properties:
|
|
status:
|
|
$ref: '#/definitions/status'
|
|
default: error
|
|
message:
|
|
$ref: '#/definitions/message'
|
|
default: Unauthorized
|
|
|
|
Error:
|
|
type: object
|
|
required:
|
|
- status
|
|
- message
|
|
properties:
|
|
status:
|
|
$ref: '#/definitions/status'
|
|
default: error
|
|
message:
|
|
$ref: '#/definitions/message'
|
|
default: 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.0.1
|
|
swagger: '2.0'
|