191 lines
6.1 KiB
JSON
191 lines
6.1 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "REST API for the SoftwEng course in MSE",
|
|
"title": "Swagger SoftwEng API",
|
|
"contact": {},
|
|
"version": "1.0"
|
|
},
|
|
"host": "rest.mse.kb28.ch",
|
|
"basePath": "/",
|
|
"paths": {
|
|
"/ping": {
|
|
"get": {
|
|
"description": "get ping response",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"ping"
|
|
],
|
|
"summary": "Ping test endpoint",
|
|
"responses": {
|
|
"200": {
|
|
"description": "pong",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/raclette": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BasicAuth": []
|
|
}
|
|
],
|
|
"description": "Request data from InfluxDB for a specific device in a room",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"request"
|
|
],
|
|
"summary": "Request Influx data",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"example": "remi",
|
|
"description": "User name",
|
|
"name": "user",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"example": "Bedroom",
|
|
"description": "Room name",
|
|
"name": "room",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"example": "DoorSensor",
|
|
"description": "Device name",
|
|
"name": "device",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Returns a map of field names to their latest values.",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/gin.H"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BasicAuth": []
|
|
}
|
|
],
|
|
"description": "Publish a command to a specific device in a room",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"commands"
|
|
],
|
|
"summary": "Publish command",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"example": "remi",
|
|
"description": "User name",
|
|
"name": "user",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"example": "Bedroom",
|
|
"description": "Room name",
|
|
"name": "room",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"example": "DoorSensor",
|
|
"description": "Device name",
|
|
"name": "device",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Command to publish",
|
|
"name": "command",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/main.Command"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "status:ok",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/gin.H"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"gin.H": {
|
|
"type": "object",
|
|
"additionalProperties": {}
|
|
},
|
|
"main.Command": {
|
|
"description": "Command structure for publishing",
|
|
"type": "object",
|
|
"required": [
|
|
"command"
|
|
],
|
|
"properties": {
|
|
"command": {
|
|
"type": "string",
|
|
"example": "MEASURE_NEW"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securityDefinitions": {
|
|
"BasicAuth": {
|
|
"type": "basic"
|
|
}
|
|
}
|
|
} |