{ "info": { "title": "Equiwatt API", "version": "0.9" }, "openapi": "3.1.0", "servers": [ { "url": "/" } ], "paths": { "/assets": { "post": { "tags": [ "Assets" ], "summary": "Create asset", "description": "Create an asset", "operationId": "AssetsCreate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Asset" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Asset" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/assets/{asset_id}/baseline-at/{timestamp}": { "get": { "tags": [ "Assets" ], "summary": "Get baseline at", "description": "Get energy baseline for an asset at a given time", "operationId": "AssetsAssetIdBaselineAtTimestampGetBaseline", "parameters": [ { "name": "asset_id", "in": "path", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false }, { "name": "timestamp", "in": "path", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssetEnergyBaseline" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/assets/{asset_id}/baselines": { "get": { "tags": [ "Assets" ], "summary": "Get baselines", "description": "Get energy baselines for an asset in a given time duration", "operationId": "AssetsAssetIdBaselinesGetBaselines", "parameters": [ { "name": "asset_id", "in": "path", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false }, { "name": "start_ts", "in": "query", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false }, { "name": "end_ts", "in": "query", "schema": { "type": "integer" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/AssetEnergyBaseline" }, "type": "array" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/assets/{asset_id}/energy-consumption": { "post": { "tags": [ "Assets" ], "summary": "Save energy consumption", "description": "Save energy consumption of an asset", "operationId": "AssetsAssetIdEnergyConsumptionSaveConsumption", "parameters": [ { "name": "asset_id", "in": "path", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "requestBody": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/EnergyConsumption" }, "type": "array" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssetEnergyConsumption" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/energy-consumption": { "post": { "tags": [ "Energy Consumption" ], "summary": "Save energy consumption", "description": "Bulk save energy consumption", "operationId": "EnergyConsumptionCreateUser", "requestBody": { "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/AssetEnergyConsumption" }, "type": "array" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {} }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/events": { "get": { "tags": [ "Events" ], "summary": "List Events", "description": "Get all events", "operationId": "EventsGetEvents", "parameters": [ { "name": "scheme_type", "in": "query", "schema": { "type": "string" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/Event" }, "type": "array" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/events/{event_id}/portfolios": { "get": { "tags": [ "Events" ], "summary": "List Event Portfolios", "description": "Get all portfolios associated with an event", "operationId": "EventsEventIdPortfoliosGetEventPortfolios", "parameters": [ { "name": "event_id", "in": "path", "schema": { "type": "string", "format": "uuid" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/events/schemes": { "get": { "tags": [ "Events" ], "summary": "List Event Schemes", "description": "Get available event schemes", "operationId": "EventsSchemesGetEventSchemes", "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/EventScheme" }, "type": "array" } } } } }, "deprecated": false } }, "/portfolios/{portfolio_id}/assets": { "get": { "tags": [ "Portfolio" ], "summary": "Get Assets", "description": "List all assets under a portfolio", "operationId": "PortfoliosPortfolioIdAssetsList", "parameters": [ { "name": "portfolio_id", "in": "path", "schema": { "type": "string", "format": "uuid" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false }, "post": { "tags": [ "Portfolio" ], "summary": "Assign Assets", "description": "Move assets under a portfolio", "operationId": "PortfoliosPortfolioIdAssetsCreate", "parameters": [ { "name": "portfolio_id", "in": "path", "schema": { "type": "string", "format": "uuid" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {} }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/portfolios": { "get": { "tags": [ "Portfolio" ], "summary": "List portfolios", "description": "Get all portfolios", "operationId": "PortfoliosList", "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/Portfolio" }, "type": "array" } } } } }, "deprecated": false }, "post": { "tags": [ "Portfolio" ], "summary": "Create portfolio", "description": "Create a portfolio", "operationId": "PortfoliosCreate", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PortfolioIn" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Portfolio" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/webhooks": { "get": { "tags": [ "Webhooks" ], "summary": "List webhooks", "description": "Get all subscribed webhooks", "operationId": "WebhooksList", "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Webhook" } } } } }, "deprecated": false }, "post": { "tags": [ "Webhooks" ], "summary": "Create webhook", "description": "Subscribe to a webhook", "operationId": "WebhooksSubscribe", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookIn" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Webhook" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/webhooks/{webhook_id}": { "get": { "tags": [ "Webhooks" ], "summary": "Get webhook", "description": "Get details of a subscribed webhook", "operationId": "WebhooksWebhookIdGetWebhook", "parameters": [ { "name": "webhook_id", "in": "path", "schema": { "type": "string", "format": "uuid" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "200": { "description": "Request fulfilled, document follows", "headers": {}, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Webhook" } } } }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false }, "delete": { "tags": [ "Webhooks" ], "summary": "Delete webhook", "description": "Unsubscribe from a webhook", "operationId": "WebhooksWebhookIdUnsubscribe", "parameters": [ { "name": "webhook_id", "in": "path", "schema": { "type": "string", "format": "uuid" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "responses": { "204": { "description": "Request fulfilled, nothing follows", "headers": {} }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } }, "/webhooks/{webhook_id}/test": { "post": { "tags": [ "Webhooks" ], "summary": "Test webhook", "description": "\nSend a test payload to a subscribed webhook endpoint.\n\nFor each of the events listed in the request payload, a test payload would be sent to the webhook URL.\nThis can be used to test your endpoints while setting up the webhooks.\n", "operationId": "WebhooksWebhookIdTestTest", "parameters": [ { "name": "webhook_id", "in": "path", "schema": { "type": "string", "format": "uuid" }, "required": true, "deprecated": false, "allowEmptyValue": false, "allowReserved": false } ], "requestBody": { "content": { "application/json": { "schema": { "items": { "type": "string" }, "type": "array" } } }, "required": true }, "responses": { "201": { "description": "Document created, URL follows", "headers": {} }, "400": { "description": "Bad request syntax or unsupported method", "content": { "application/json": { "schema": { "properties": { "status_code": { "type": "integer" }, "detail": { "type": "string" }, "extra": { "additionalProperties": {}, "type": [ "null", "object", "array" ] } }, "type": "object", "required": [ "detail", "status_code" ], "description": "Validation Exception", "examples": [ { "status_code": 400, "detail": "Bad Request", "extra": {} } ] } } } } }, "deprecated": false } } }, "components": { "schemas": { "Asset": { "properties": { "asset_id": { "type": "string" }, "name": { "type": "string" } }, "type": "object", "required": [ "asset_id", "name" ], "title": "Asset" }, "AssetEnergyBaseline": { "properties": { "asset_id": { "type": "string" }, "timestamp": { "type": "integer" }, "value": { "type": "number" } }, "type": "object", "required": [ "asset_id", "timestamp", "value" ], "title": "AssetEnergyBaseline" }, "AssetEnergyConsumption": { "properties": { "asset_id": { "type": "string" }, "timestamp": { "type": "integer" }, "value": { "type": "number" } }, "type": "object", "required": [ "asset_id", "timestamp", "value" ], "title": "AssetEnergyConsumption" }, "EnergyConsumption": { "properties": { "timestamp": { "type": "integer" }, "value": { "type": "number" } }, "type": "object", "required": [ "timestamp", "value" ], "title": "EnergyConsumption" }, "Event": { "properties": { "id": { "type": "string", "format": "uuid" }, "scheme": { "$ref": "#/components/schemas/EventScheme" }, "name": { "type": "string" }, "start_time": { "type": "string", "format": "date-time" }, "end_time": { "type": "string", "format": "date-time" }, "event_type": { "type": "integer" }, "event_running_type": { "type": "integer" } }, "type": "object", "required": [ "end_time", "event_running_type", "event_type", "id", "name", "scheme", "start_time" ], "title": "Event" }, "EventScheme": { "properties": { "name": { "type": "string" } }, "type": "object", "required": [ "name" ], "title": "EventScheme" }, "Portfolio": { "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "description": { "oneOf": [ { "type": "null" }, { "type": "string" } ] }, "created_time": { "type": "string", "format": "date-time" }, "status": { "type": "string" } }, "type": "object", "required": [ "created_time", "id", "name", "status" ], "title": "Portfolio" }, "PortfolioIn": { "properties": { "name": { "type": "string" }, "description": { "oneOf": [ { "type": "null" }, { "type": "string" } ] } }, "type": "object", "required": [ "name" ], "title": "PortfolioIn" }, "Webhook": { "properties": { "id": { "type": "string", "format": "uuid" }, "url": { "type": "string" }, "events": { "items": { "type": "string" }, "type": "array" } }, "type": "object", "required": [ "events", "id", "url" ], "title": "Webhook" }, "WebhookIn": { "properties": { "url": { "type": "string" }, "events": { "items": { "type": "string" }, "type": "array" } }, "type": "object", "required": [ "events", "url" ], "title": "WebhookIn" } } } }