{ "swagger" : "2.0", "info" : { "description" : "This is the alfred brain API doc", "version" : "1.0.0", "title" : "Alfred API", "termsOfService" : "", "contact" : { "email" : "clement.dessoude@gmail.com" }, "license" : { "name" : "Apache 2.0", "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" } }, "tags" : [ { "name" : "Chiros", "description" : "Smart object endpoints" }, { "name" : "AlfredBrain", "description" : "The Custom Server API" }, { "name" : "action", "description" : "Actions saved in the database" }, { "name" : "categoryType", "description" : "Categories saved in the database" }, { "name" : "dataPoints", "description" : "Objets' data points saved in the database" }, { "name" : "dataPollingType", "description" : "Polling type saved in the database" }, { "name" : "dataSource", "description" : "Objets' data sources saved in the database" }, { "name" : "dataType", "description" : "Types of data exchanged with objects (boolean, image, etc.)" }, { "name" : "performedActions", "description" : "Actions performed on smart objects" }, { "name" : "smartObject", "description" : "Smart objects connected to Alfred" } ], "schemes" : [ "https", "http" ], "paths" : { "/config" : { "get" : { "tags" : [ "Chiros" ], "summary" : "Get the object config", "description" : "Get the object config", "operationId" : "", "consumes" : [ ], "produces" : [ "application/json" ], "parameters" : [ ], "responses" : { "200" : { "description" : "Object config in json format", "schema" : { "$ref" : "#/definitions/SmartObjectConfig" } }, "400" : { "description" : "Bad Request" } }, "security" : [ ] } }, "/configServer" : { "get" : { "tags" : [ "Chiros" ], "summary" : "Set the server config", "description" : "Set the server config", "operationId" : "", "consumes" : [ ], "parameters" : [ { "$ref" : "#/definitions/ServerConfig" } ], "produces" : [ "application/json" ], "responses" : { "200" : { "description" : "Success" }, "400" : { "description" : "Bad Request" } }, "security" : [ ] } }, "/objectState" : { "get" : { "tags" : [ "AlfredBrain" ], "summary" : "Get an object state", "description" : "Get an object state", "produces" : [ "application/json" ], "parameters" : [ { "in" : "query", "name" : "data_source_id", "type" : "string", "description" : "The id of the data source to be fetched", "required" : true } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/DataPoint" } } }, "400" : { "description" : "Invalid Order" } } } }, "/latestDataPointFromDataSource" : { "get" : { "tags" : [ "AlfredBrain" ], "summary" : "Get latest datapoint in the DB", "description" : "Get latest datapoint in the DB", "produces" : [ "application/json" ], "parameters" : [ { "in" : "query", "name" : "data_source_id", "type" : "string", "description" : "The id of the data source to be fetched", "required" : true } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/DataPoint" } } }, "400" : { "description" : "Bad Request" } }, "security" : [ ] } }, "/api/login" : { "post" : { "tags" : [ "AlfredBrain" ], "summary" : "Get a token to allow auth", "description" : "", "operationId" : "", "consumes" : [ "application/json" ], "produces" : [ "string" ], "parameters" : [ { "in" : "body", "name" : "login information", "description" : "Login information.", "schema" : { "type" : "object", "required" : [ "username", "password" ], "properties" : { "username" : { "description" : "A username", "type" : "string", "example" : "alfred" }, "password" : { "description" : "The username password", "type" : "string", "example" : "alfred" } } } } ], "responses" : { "200" : { "description" : "Success", "schema" : { "type" : "object", "properties" : { "token" : { "type" : "string", "example" : "71315f47188819d298ffa0a8457124a01df3d1b4" } } } }, "400" : { "description" : "Bad Request" } }, "security" : [ ] } }, "/performAction" : { "post" : { "tags" : [ "AlfredBrain" ], "summary" : "Perform an action on an object", "description" : "Perform an action on an object", "produces" : [ "string" ], "parameters" : [ { "in" : "query", "name" : "action_id", "type" : "string", "description" : "The id of the action to be performed", "required" : true } ], "responses" : { "200" : { "description" : "successful operation" }, "400" : { "description" : "Bad Request" } }, "security" : [ ] } }, "/registerDevice" : { "post" : { "tags" : [ "AlfredBrain" ], "summary" : "Register a new device", "description" : "", "operationId" : "", "consumes" : [ "application/json" ], "produces" : [ "string" ], "parameters" : [ { "in" : "body", "name" : "device", "description" : "device information", "schema" : { "type" : "object", "required" : [ "address_ip", "port", "name" ], "properties" : { "address_ip" : { "description" : "The IP adress of the device", "type" : "string" }, "port" : { "description" : "The port used by the device", "type" : "number" }, "name" : { "type" : "string", "description" : "Name of the device" } } } } ], "responses" : { "400" : { "description" : "Bad Request" } }, "security" : [ ] } }, "/saveDataPoint" : { "post" : { "tags" : [ "AlfredBrain" ], "summary" : "Add a datapoint in the DB", "description" : "Add a datapoint in the DB", "produces" : [ "string" ], "parameters" : [ { "in" : "body", "name" : "datapoint", "description" : "datapoint information", "schema" : { "type" : "object", "required" : [ "data_source_id", "value" ], "properties" : { "data_source_id" : { "description" : "The id of the source attached", "type" : "string" }, "value" : { "description" : "Value to save (can be any form of data)" } } } } ], "responses" : { "200" : { "description" : "successful operation" }, "400" : { "description" : "Bad Request" } }, "security" : [ ] } }, "/action/" : { "get" : { "operationId" : "action_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/Action" } } } }, "parameters" : [ ], "tags" : [ "action" ] } }, "/action/{id}/" : { "get" : { "operationId" : "action_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/Action" } } }, "parameters" : [ { "name" : "id", "required" : true, "in" : "path", "description" : "A UUID string identifying this action.", "type" : "string" } ], "tags" : [ "action" ] } }, "/categoryType/" : { "get" : { "operationId" : "categoryType_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/CategoryType" } } } }, "parameters" : [ ], "tags" : [ "categoryType" ] } }, "/categoryType/{name}/" : { "get" : { "operationId" : "categoryType_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/CategoryType" } } }, "parameters" : [ { "name" : "name", "required" : true, "in" : "path", "description" : "A unique value identifying this category type.", "type" : "string" } ], "tags" : [ "categoryType" ] } }, "/dataPoints/" : { "get" : { "operationId" : "dataPoints_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/DataPoint" } } } }, "parameters" : [ ], "tags" : [ "dataPoints" ] } }, "/dataPoints/{id}/" : { "get" : { "operationId" : "dataPoints_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/DataPoint" } } }, "parameters" : [ { "name" : "id", "required" : true, "in" : "path", "description" : "A UUID string identifying this data point.", "type" : "string" } ], "tags" : [ "dataPoints" ] } }, "/dataPollingType/" : { "get" : { "operationId" : "dataPollingType_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/DataPollingType" } } } }, "parameters" : [ ], "tags" : [ "dataPollingType" ] } }, "/dataPollingType/{name}/" : { "get" : { "operationId" : "dataPollingType_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/DataPollingType" } } }, "parameters" : [ { "name" : "name", "required" : true, "in" : "path", "description" : "A unique value identifying this data polling type.", "type" : "string" } ], "tags" : [ "dataPollingType" ] } }, "/dataSource/" : { "get" : { "operationId" : "dataSource_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/DataSource" } } } }, "parameters" : [ ], "tags" : [ "dataSource" ] } }, "/dataSource/{id}/" : { "get" : { "operationId" : "dataSource_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/DataSource" } } }, "parameters" : [ { "name" : "id", "required" : true, "in" : "path", "description" : "A UUID string identifying this data source.", "type" : "string" } ], "tags" : [ "dataSource" ] } }, "/dataType/" : { "get" : { "operationId" : "dataType_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/DataType" } } } }, "parameters" : [ ], "tags" : [ "dataType" ] } }, "/dataType/{name}/" : { "get" : { "operationId" : "dataType_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/DataType" } } }, "parameters" : [ { "name" : "name", "required" : true, "in" : "path", "description" : "A unique value identifying this data type.", "type" : "string" } ], "tags" : [ "dataType" ] } }, "/performedActions/" : { "get" : { "operationId" : "performedActions_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/PerformedAction" } } } }, "parameters" : [ ], "tags" : [ "performedActions" ] } }, "/performedActions/{id}/" : { "get" : { "operationId" : "performedActions_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/PerformedAction" } } }, "parameters" : [ { "name" : "id", "required" : true, "in" : "path", "description" : "A UUID string identifying this performed action.", "type" : "string" } ], "tags" : [ "performedActions" ] } }, "/smartObject/" : { "get" : { "operationId" : "smartObject_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/SmartObject" } } } }, "parameters" : [ ], "tags" : [ "smartObject" ] } }, "/smartObject/{id}/" : { "get" : { "operationId" : "smartObject_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/SmartObject" } } }, "parameters" : [ { "name" : "id", "required" : true, "in" : "path", "description" : "A UUID string identifying this smart object.", "type" : "string" } ], "tags" : [ "smartObject" ] } }, "/scenario/" : { "get" : { "operationId" : "scenario_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/Scenario" } } } }, "parameters" : [ ], "tags" : [ "scenario" ] } }, "/scenario/{id}/" : { "get" : { "operationId" : "scenario_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/Scenario" } } }, "parameters" : [ { "name" : "id", "required" : true, "in" : "path", "description" : "A UUID string identifying this scenario.", "type" : "string" } ], "tags" : [ "scenario" ] } }, "/operator/" : { "get" : { "operationId" : "operator_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/Operator" } } } }, "parameters" : [ ], "tags" : [ "operator" ] } }, "/operator/{id}/" : { "get" : { "operationId" : "operator_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/Operator" } } }, "parameters" : [ { "name" : "id", "required" : true, "in" : "path", "description" : "A UUID string identifying this operator.", "type" : "string" } ], "tags" : [ "operator" ] } }, "/condition/" : { "get" : { "operationId" : "condition_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/Condition" } } } }, "parameters" : [ ], "tags" : [ "condition" ] } }, "/condition/{id}/" : { "get" : { "operationId" : "condition_read", "responses" : { "200" : { "description" : "", "schema" : { "$ref" : "#/definitions/Condition" } } }, "parameters" : [ { "name" : "id", "required" : true, "in" : "path", "description" : "A UUID string identifying this condition.", "type" : "string" } ], "tags" : [ "condition" ] } }, "/actionScenario/" : { "get" : { "operationId" : "actionScenario_list", "responses" : { "200" : { "description" : "", "schema" : { "type" : "array", "items" : { "$ref" : "#/definitions/ActionScenario" } } } }, "parameters" : [ ], "tags" : [ "scenario" ] } } }, "securityDefinitions" : { "petstore_auth" : { "type" : "oauth2", "authorizationUrl" : "https://petstore.swagger.io/oauth/authorize", "flow" : "implicit", "scopes" : { "write:pets" : "modify pets in your account", "read:pets" : "read your pets" } }, "api_key" : { "type" : "apiKey", "name" : "api_key", "in" : "header" } }, "definitions" : { "ServerConfig" : { "type" : "object", "properties" : { "data-source-ids" : { "type" : "object", "properties" : { "state" : { "type" : "string", "example" : "bc937372-e728-461f-8043-2254693d8474" } } }, "id" : { "type" : "string", "example" : "364bcf1c-6320-47ac-bd57-502f4efb7632" }, "port" : { "type" : "string", "example" : "8000" }, "url" : { "type" : "string", "example" : "127.0.0.1" } } }, "SmartObjectConfig" : { "type" : "object", "properties" : { "name" : { "type" : "string", "example" : "coolObject" }, "type" : { "type" : "string", "example" : "lamp" }, "actions" : { "type" : "array", "items" : { "$ref" : "#/definitions/Action" } }, "data-source" : { "type" : "array", "items" : { "$ref" : "#/definitions/DataSource" } } } }, "Action" : { "type" : "object", "properties" : { "name" : { "type" : "string", "format" : "string", "example" : "switch" }, "command" : { "type" : "string", "format" : "string", "description" : "path to trigger the action", "example" : "/switch" }, "payload" : { "type" : "object", "properties" : { "name" : { "type" : "string", "example" : "switch" }, "type" : { "type" : "boolean", "example" : true } } } } }, "CategoryType" : { "type" : "object", "properties" : { "name" : { "type" : "string", "example" : "Lamp" } } }, "DataType" : { "type" : "object", "properties" : { "name" : { "type" : "string", "example" : "boolean" } } }, "DataPollingType" : { "type" : "object", "properties" : { "name" : { "type" : "string", "example" : "ON_REQUEST" } } }, "DataSource" : { "type" : "object", "properties" : { "name" : { "type" : "string", "example" : "state" }, "description" : { "type" : "string", "example" : "return the state" }, "endpoint" : { "type" : "string", "example" : "/state" }, "data-type" : { "type" : "string", "example" : "boolean" }, "data-polling-type" : { "type" : "string", "example" : "ON_REQUEST" } } }, "DataPoint" : { "type" : "object", "properties" : { "id" : { "type" : "string", "example" : "0777bb07-660d-45ec-9930-81c48e9d83fb" }, "value" : { "type" : "object", "example" : "d0fbbQsdMkA=" }, "data_source" : { "type" : "string", "example" : "02959166-92dc-45fe-8860-e103bd469201" }, "timestamp" : { "type" : "string", "example" : "2019-02-10T10:57:46.669171Z" } } }, "Operator" : { "type" : "object", "properties" : { "id" : { "type" : "string", "example" : "0777bb07-660d-45ec-9930-81c48e9d83fb" }, "name" : { "type" : "object", "example" : "GTE" }, "allowed_types" : { "$ref" : "#/definitions/DataType" } } }, "SmartObject" : { "type" : "object", "properties" : { "id" : { "type" : "string", "example" : "0777bb07-660d-45ec-9930-81c48e9d83fb" }, "name" : { "type" : "object", "example" : "coolObject" }, "address_ip" : { "type" : "string", "example" : "127.0.0.1" }, "port" : { "type" : "string", "example" : 9800 }, "category" : { "$ref" : "#/definitions/CategoryType" } } }, "Scenario" : { "type" : "object", "properties" : { "id" : { "type" : "string", "example" : "0777bb07-660d-45ec-9930-81c48e9d83fb" }, "name" : { "type" : "object", "example" : "Motion Sensor" } } }, "PerformedAction" : { "type" : "object", "properties" : { "id" : { "type" : "string", "example" : "0777bb07-660d-45ec-9930-81c48e9d83fb" }, "action" : { "$ref" : "#/definitions/Action" }, "timestamp" : { "type" : "string", "example" : "2019-02-10T10:57:46.669171Z" } } }, "Condition" : { "type" : "object", "properties" : { "id" : { "type" : "string", "example" : "0777bb07-660d-45ec-9930-81c48e9d83fb" }, "value" : { "type" : "string", "example" : "d0fbbQsdMkA=" }, "data_source" : { "$ref" : "#/definitions/DataSource" }, "operator" : { "$ref" : "#/definitions/Operator" }, "scenario" : { "$ref" : "#/definitions/Scenario" } } }, "ActionScenario" : { "type" : "object", "properties" : { "action" : { "$ref" : "#/definitions/Action" }, "scenario" : { "$ref" : "#/definitions/Scenario" }, "payload" : { "type" : "string", "example" : "d0fbbQsdMkA=" } } } }, "externalDocs" : { "description" : "Find out more about Swagger", "url" : "http://swagger.io" }, "host" : "virtserver.swaggerhub.com", "basePath" : "/clement26695/Alfred/1.0.0" }