Skip to content
Snippets Groups Projects
Commit 5b7bccf0 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

cleanup

parent 0acc1f6d
No related branches found
No related tags found
No related merge requests found
openapi: 3.0.0
servers:
- description: StorageLeaf API
url: https://localhost/
info:
description: The StorageLeaf API
version: "2.7.0"
title: StorageLeaf API
paths:
/version:
get:
tags:
- general
summary: Gets information about the server version
operationId: version
responses:
'200':
description: The server version information
content:
application/json:
schema:
$ref: '#/components/schemas/Version'
/devices:
get:
tags:
- device
summary: Gets all devices
operationId: devices
responses:
'200':
description: All available devices
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Device'
/device/{deviceID}:
get:
tags:
- device
summary: Gets a specific device
operationId: device
parameters:
- in: path
name: deviceID
description: The device id
required: true
schema:
type: integer
responses:
'200':
description: The device
content:
application/json:
schema:
$ref: '#/components/schemas/Device'
delete:
tags:
- device
summary: Deletes a specific device. All correspondig sensors and measurements will be deleted too.
operationId: deleteDevice
security:
- bearerAuth: []
parameters:
- in: path
name: deviceID
description: The device id
required: true
schema:
type: integer
responses:
'200':
description: success response
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
default:
description: error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/device/{deviceID}/sensors:
get:
tags:
- device
summary: Gets all sensors for a specific device
operationId: deviceSensors
parameters:
- in: path
name: deviceID
description: The device id
required: true
schema:
type: integer
responses:
'200':
description: All available sensors
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Sensor'
/device:
post:
tags:
- device
summary: Adds a new device. If a device with the provided name already exists an error response is returned.
operationId: addDevice
security:
- bearerAuth: []
requestBody:
description: Device to add
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewDevice'
responses:
'200':
description: success response
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
default:
description: error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/sensors:
get:
tags:
- sensor
summary: Gets all sensors
operationId: sensors
responses:
'200':
description: All available sensors
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Sensor'
/sensor/{sensorID}:
get:
tags:
- sensor
summary: Gets a specific sensor
operationId: sensor
parameters:
- in: path
name: sensorID
description: The sensor id
required: true
schema:
type: integer
responses:
'200':
description: The sensor
content:
application/json:
schema:
$ref: '#/components/schemas/Sensor'
delete:
tags:
- sensor
summary: Deletes a specific sensor. All correspondig measurements will be deleted too.
operationId: deleteSensor
security:
- bearerAuth: []
parameters:
- in: path
name: sensorID
description: The sensor id
required: true
schema:
type: integer
responses:
'200':
description: success response
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
default:
description: error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/sensor/{sensorID}/measurements:
get:
tags:
- sensor
summary: Gets all measurements for a specific sensor (Number of results can be limited by specifying a date range).
operationId: sensorMeasurements
parameters:
- in: path
name: sensorID
description: The sensor id
required: true
schema:
type: integer
- in: query
name: startDateTime
description: The start date and time of the date range that should be taken into account.
required: false
schema:
type: string
example: '2020-01-20 18:15:22'
- in: query
name: endDateTime
description: The end date and time of the date range that should be taken into account.
required: false
schema:
type: string
example: '2020-01-20 19:15:22'
responses:
'200':
description: All available measurements
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Measurement'
/sensor/{sensorID}/measurements/latest:
get:
tags:
- sensor
summary: Gets the latest measurement for a specific sensor
operationId: sensorMeasurementsLatest
parameters:
- in: path
name: sensorID
description: The sensor id
required: true
schema:
type: integer
responses:
'200':
description: The latest measurement
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Measurement'
/sensor:
post:
tags:
- sensor
summary: Adds a new sensor. If a sensor with the provided name already exists for the given device id an error response is returned.
operationId: addSensor
security:
- bearerAuth: []
requestBody:
description: Sensor to add
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewSensor'
responses:
'200':
description: success response
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
default:
description: error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/measurements:
get:
tags:
- measurement
summary: Gets all measurements (Number of results can be limited by specifying a date range).
operationId: measurements
parameters:
- in: query
name: startDateTime
description: The start date and time of the date range that should be taken into account.
required: false
schema:
type: string
example: '2020-01-20 18:15:22'
- in: query
name: endDateTime
description: The end date and time of the date range that should be taken into account.
required: false
schema:
type: string
example: '2020-01-20 19:15:22'
responses:
'200':
description: All available measurements
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Measurement'
post:
tags:
- measurement
summary: Adds multiple measurements. Non-existent device and sensors will be created automatically.
operationId: addMeasurements
security:
- bearerAuth: [ ]
requestBody:
description: Measurements to add
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewDeviceMeasurement'
responses:
'200':
description: success response
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
default:
description: error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/measurements/minMax:
get:
tags:
- measurement
summary: Gets the minimum and maximum values for the given sensor ids.
operationId: measurementsMinMax
parameters:
- in: query
name: sensorIds
description: The sensor ids to calculate the min and max value for.
required: true
style: form
explode: false
schema:
type: array
items:
type: integer
- in: query
name: startDateTime
description: The start date and time of the date range that should be taken into account.
required: true
schema:
type: string
example: '2020-01-20 18:15:22'
- in: query
name: endDateTime
description: The end date and time of the date range that should be taken into account.
required: true
schema:
type: string
example: '2020-01-20 19:15:22'
responses:
'200':
description: All available measurements
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Measurement'
/measurement/{measurementID}:
get:
tags:
- measurement
summary: Gets a specific measurement
operationId: measurement
parameters:
- in: path
name: measurementID
description: The measurement id
required: true
schema:
type: integer
responses:
'200':
description: The measurement
content:
application/json:
schema:
$ref: '#/components/schemas/Measurement'
delete:
tags:
- measurement
summary: Deletes a specific measurement
operationId: deleteMeasurement
security:
- bearerAuth: []
parameters:
- in: path
name: measurementID
description: The measurement id
required: true
schema:
type: integer
responses:
'200':
description: success response
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
default:
description: error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/measurement:
post:
tags:
- measurement
summary: Adds a new measurement for the given sensor.
operationId: addMeasurement
security:
- bearerAuth: []
requestBody:
description: Measurement to add
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewMeasurement'
responses:
'200':
description: success response
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
default:
description: error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
securitySchemes:
bearerAuth:
type: apiKey
name: apiKey
in: header
schemas:
Version:
type: object
required:
- code
- name
- date
properties:
code:
type: integer
example: 1
name:
type: string
example: "v1.0.0"
date:
type: string
format: date
example: "30.05.19"
Device:
type: object
required:
- id
- name
properties:
id:
type: integer
example: 1
name:
type: string
example: "My Device"
Sensor:
type: object
required:
- id
- device_id
- name
- type
properties:
id:
type: integer
example: 1
device_id:
type: integer
example: 1
name:
type: string
example: "My Sensor"
type:
type: string
example: "temperature"
Measurement:
type: object
required:
- id
- sensor_id
- value
- timestamp
properties:
id:
type: integer
example: 1
sensor_id:
type: integer
example: 1
value:
type: string
example: "20.15"
timestamp:
type: string
format: date-time
example: "2020-09-23 20:58:00"
NewDeviceMeasurement:
type: object
required:
- device
- sensors
properties:
device:
type: string
example: "myDevice"
sensors:
type: array
items:
allOf:
- $ref: '#/components/schemas/NewSensorMeasurement'
- type: object
NewSensorMeasurement:
type: object
required:
- name
- type
- value
properties:
name:
type: string
example: "mySensor"
type:
type: string
example: "temperature"
value:
type: string
example: "20.15"
NewMeasurement:
type: object
required:
- sensor_id
- value
properties:
sensor_id:
type: integer
example: 1
value:
type: string
example: "20.15"
NewDevice:
type: object
required:
- device
properties:
device:
type: string
example: "myDevice"
NewSensor:
type: object
required:
- device_id
- name
- type
properties:
device_id:
type: integer
example: 1
name:
type: string
example: "My Sensor"
type:
type: string
example: "temperature"
SuccessResponse:
required:
- success
properties:
success:
type: boolean
ErrorResponse:
required:
- success
- msg
properties:
success:
type: boolean
msg:
type: string
\ No newline at end of file
This diff is collapsed.
[tool.poetry]
name = "StorageLeaf"
version = "1.5.0"
description = "Accepts sensor data and saves them into a database. The saved data can be accessed via api."
authors = ["TheCodeLabs <spam@thecodelabs.com>"]
[[tool.poetry.source]]
name = "TheCodeLabs"
url = "https://pypi.thecodelabs.de"
secondary = true
[tool.poetry.dependencies]
python = "^3.7"
flask = "^1.1.2"
gevent = "^20.9.0"
TheCodeLabs-BaseUtils = "*"
TheCodeLabs-FlaskUtils = "*"
pyyaml = "^5.3.1"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ appName }} API</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.22.2/swagger-ui.css" >
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body {
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.22.2/swagger-ui-bundle.js"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.22.2/swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
var spec = {{ openApiSpecification|safe }};
// Build a system
const ui = SwaggerUIBundle({
spec: spec,
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis
]
})
window.ui = ui
}
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment