Created
October 30, 2019 12:47
-
-
Save tlindener/3ab141364a59e7d0d9e8657d3b1b3551 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"openapi": "3.0.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "ELEMENT Go" | |
}, | |
"servers": [ | |
{ | |
"url": "https://{environment}.element-iot.com/api/v1", | |
"variables": { | |
"environment": { | |
"default": "go", | |
"enum": [ | |
"go", | |
"dev.go", | |
"stage.go" | |
] | |
} | |
} | |
} | |
], | |
"paths": { | |
"/tasks": { | |
"get": { | |
"summary": "List all tasks", | |
"operationId": "listTasks", | |
"tags": [ | |
"tasks" | |
], | |
"responses": { | |
"200": { | |
"description": "An array of projects", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Tasks" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/tasks/{taskId}": { | |
"get": { | |
"summary": "Info for a specific task", | |
"operationId": "showTaskById", | |
"tags": [ | |
"tasks" | |
], | |
"parameters": [ | |
{ | |
"name": "taskId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the project to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Expected response to a valid request", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Task" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/locations": { | |
"get": { | |
"summary": "List all Locations", | |
"operationId": "listLocations", | |
"tags": [ | |
"locations" | |
], | |
"parameters": [ | |
{ | |
"name": "limit", | |
"in": "query", | |
"description": "How many items to return at one time (max 100)", | |
"required": false, | |
"schema": { | |
"type": "integer", | |
"format": "int32" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "A paged array of installers", | |
"headers": { | |
"x-next": { | |
"description": "A link to the next page of responses", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Locations" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"post": { | |
"summary": "Add a location", | |
"operationId": "createLocation", | |
"tags": [ | |
"locations" | |
], | |
"requestBody": { | |
"required": true, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/CreateLocation" | |
} | |
} | |
} | |
}, | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/locations/{locationId}": { | |
"get": { | |
"summary": "Info for a specific Order", | |
"operationId": "getLocationById", | |
"tags": [ | |
"locations" | |
], | |
"parameters": [ | |
{ | |
"name": "locationId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Location to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Expected response to a valid request", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Location" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/orders": { | |
"get": { | |
"summary": "List all Orders", | |
"operationId": "listOrders", | |
"tags": [ | |
"orders" | |
], | |
"parameters": [ | |
{ | |
"name": "limit", | |
"in": "query", | |
"description": "How many items to return at one time (max 100)", | |
"required": false, | |
"schema": { | |
"type": "integer", | |
"format": "int32" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "A paged array of installers", | |
"headers": { | |
"x-next": { | |
"description": "A link to the next page of responses", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Orders" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"post": { | |
"summary": "Add an Order", | |
"operationId": "createOrder", | |
"tags": [ | |
"orders" | |
], | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/orders/{orderId}": { | |
"get": { | |
"summary": "Info for a specific Order", | |
"operationId": "getOrderById", | |
"tags": [ | |
"orders" | |
], | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Order to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Expected response to a valid request", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Order" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/orders/{orderId}/locations": { | |
"get": { | |
"summary": "Get all locations of this order as tree", | |
"operationId": "listLocationsByOrderId", | |
"tags": [ | |
"orders", | |
"locations" | |
], | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Order to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "A paged array of installers", | |
"headers": { | |
"x-next": { | |
"description": "A link to the next page of responses", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Locations" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"put": { | |
"summary": "Assign locations", | |
"operationId": "assignLocations", | |
"tags": [ | |
"orders", | |
"locations" | |
], | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Order to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"requestBody": { | |
"required": true, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/AssignLocations" | |
} | |
} | |
} | |
}, | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/orders/{orderId}/locations/{locationId}": { | |
"get": { | |
"summary": "Get location by id", | |
"operationId": "showLocationById", | |
"tags": [ | |
"orders", | |
"locations" | |
], | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Order to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
}, | |
{ | |
"name": "locationId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the location to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "A paged array of installers", | |
"headers": { | |
"x-next": { | |
"description": "A link to the next page of responses", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Locations" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"put": { | |
"summary": "Assign location", | |
"operationId": "assignLocation", | |
"tags": [ | |
"orders", | |
"locations" | |
], | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Order to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
}, | |
{ | |
"name": "locationId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the location to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/orders/{orderId}/installers/{installerId}": { | |
"put": { | |
"summary": "Assign installer to an order", | |
"operationId": "assignInstallerToOrder", | |
"tags": [ | |
"orders", | |
"installers" | |
], | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Order to update", | |
"schema": { | |
"type": "string" | |
} | |
}, | |
{ | |
"name": "installerId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the installer to assign", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/orders/{orderId}/taskset/{locationType}": { | |
"put": { | |
"summary": "Assign list of tasks to an order and location type", | |
"operationId": "assignTasksToOrder", | |
"tags": [ | |
"orders", | |
"tasks" | |
], | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Order to update", | |
"schema": { | |
"type": "string" | |
} | |
}, | |
{ | |
"name": "locationType", | |
"in": "path", | |
"required": true, | |
"description": "The type within the location tree", | |
"schema": { | |
"$ref": "#/components/schemas/LocationType" | |
} | |
} | |
], | |
"requestBody": { | |
"required": true, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/AddTaskSet" | |
} | |
} | |
} | |
}, | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/orders/{orderId}/devices": { | |
"put": { | |
"summary": "Assign list of tasks to an order", | |
"operationId": "assignDevicesToOrder", | |
"tags": [ | |
"orders", | |
"devices" | |
], | |
"parameters": [ | |
{ | |
"name": "orderId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the Order to update", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"requestBody": { | |
"required": true, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/AssignDevices" | |
} | |
} | |
} | |
}, | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/installers": { | |
"get": { | |
"summary": "List all installer", | |
"operationId": "listInstallers", | |
"tags": [ | |
"installers" | |
], | |
"parameters": [ | |
{ | |
"name": "limit", | |
"in": "query", | |
"description": "How many items to return at one time (max 100)", | |
"required": false, | |
"schema": { | |
"type": "integer", | |
"format": "int32" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "A paged array of installers", | |
"headers": { | |
"x-next": { | |
"description": "A link to the next page of responses", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Installers" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"post": { | |
"summary": "Add an Installer", | |
"operationId": "createInstaller", | |
"tags": [ | |
"installers" | |
], | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/installer/{installerId}": { | |
"get": { | |
"summary": "Info for a specific Installer", | |
"operationId": "getInstallerById", | |
"tags": [ | |
"installers" | |
], | |
"parameters": [ | |
{ | |
"name": "installerId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the installer to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Expected response to a valid request", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Installer" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/projects": { | |
"get": { | |
"summary": "List all projects", | |
"operationId": "listProjects", | |
"tags": [ | |
"projects" | |
], | |
"parameters": [ | |
{ | |
"name": "limit", | |
"in": "query", | |
"description": "How many items to return at one time (max 100)", | |
"required": false, | |
"schema": { | |
"type": "integer", | |
"format": "int32" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "A paged array of projects", | |
"headers": { | |
"x-next": { | |
"description": "A link to the next page of responses", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Projects" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"post": { | |
"summary": "Create a Project", | |
"operationId": "createProject", | |
"tags": [ | |
"projects" | |
], | |
"responses": { | |
"201": { | |
"description": "Null response" | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/projects/{projectId}": { | |
"get": { | |
"summary": "Info for a specific pet", | |
"operationId": "showPetById", | |
"tags": [ | |
"projects" | |
], | |
"parameters": [ | |
{ | |
"name": "projectId", | |
"in": "path", | |
"required": true, | |
"description": "The id of the project to retrieve", | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Expected response to a valid request", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Project" | |
} | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Error" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"components": { | |
"schemas": { | |
"Installer": { | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"phone": { | |
"type": "string" | |
}, | |
"email": { | |
"type": "string", | |
"format": "email" | |
} | |
}, | |
"example": { | |
"name": "Max Mustermann", | |
"phone": "+49160123456", | |
"email": "[email protected]" | |
} | |
}, | |
"AssignedTaskSet": { | |
"type": "object", | |
"required": [ | |
"items", | |
"order", | |
"locationType" | |
], | |
"properties": { | |
"assignedTasks": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Task" | |
} | |
}, | |
"order": { | |
"$ref": "#/components/schemas/Order" | |
}, | |
"locationType": { | |
"$ref": "#/components/schemas/LocationType" | |
} | |
} | |
}, | |
"Task": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "integer", | |
"format": "int64" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"type": { | |
"$ref": "#/components/schemas/TaskType" | |
}, | |
"mandatory": { | |
"type": "boolean" | |
} | |
} | |
}, | |
"TaskType": { | |
"type": "string", | |
"enum": [ | |
"take_photo", | |
"get_coordinates", | |
"read_meter", | |
"select_device", | |
"select_location" | |
] | |
}, | |
"AssignDevices": { | |
"type": "object", | |
"properties": { | |
"devices": { | |
"type": "array", | |
"items": { | |
"type": "string" | |
} | |
} | |
} | |
}, | |
"AddTaskSet": { | |
"type": "object", | |
"properties": { | |
"tasks": { | |
"type": "array", | |
"items": { | |
"type": "integer", | |
"format": "int64" | |
} | |
} | |
} | |
}, | |
"AssignLocations": { | |
"type": "object", | |
"properties": { | |
"locations": { | |
"type": "array", | |
"items": { | |
"type": "integer", | |
"format": "int64" | |
} | |
} | |
} | |
}, | |
"CreateLocation": { | |
"type": "object", | |
"properties": { | |
"parent": { | |
"nullable": true, | |
"type": "integer", | |
"format": "int64" | |
}, | |
"children": { | |
"type": "array", | |
"items": { | |
"type": "integer", | |
"format": "int64" | |
} | |
}, | |
"type": { | |
"$ref": "#/components/schemas/LocationType" | |
}, | |
"name": { | |
"type": "string" | |
} | |
} | |
}, | |
"Location": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "integer", | |
"format": "int64" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"type": { | |
"$ref": "#/components/schemas/LocationType" | |
}, | |
"locations": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Location" | |
} | |
} | |
}, | |
"example": { | |
"id": 1, | |
"name": "Spaldingstraße 64", | |
"type": "streeet", | |
"locations": [ | |
{ | |
"id": 2, | |
"name": "Gebäude 1", | |
"type": "building" | |
}, | |
{ | |
"id": 3, | |
"name": "Gebäude 2", | |
"type": "building" | |
} | |
] | |
} | |
}, | |
"LocationType": { | |
"type": "string", | |
"enum": [ | |
"street", | |
"coordinates", | |
"building", | |
"business_area", | |
"flat", | |
"room" | |
], | |
"example": [ | |
"building" | |
] | |
}, | |
"Order": { | |
"type": "object", | |
"required": [ | |
"id", | |
"name" | |
], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"format": "int64" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"description": { | |
"type": "string" | |
}, | |
"locations": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Location" | |
} | |
} | |
}, | |
"example": { | |
"id": 1, | |
"name": "Installation 100 Kerlink iStation" | |
} | |
}, | |
"Project": { | |
"type": "object", | |
"required": [ | |
"id", | |
"name" | |
], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"format": "int64" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"description": { | |
"type": "string" | |
}, | |
"metadata": { | |
"type": "object", | |
"additionalProperties": { | |
"type": "string" | |
} | |
} | |
}, | |
"example": { | |
"id": 1, | |
"name": "Hamburg", | |
"description": "Installation 500 Gateways", | |
"metadata": { | |
"customerId": 10523 | |
} | |
} | |
}, | |
"Tasks": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Task" | |
} | |
}, | |
"Locations": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Location" | |
} | |
}, | |
"Orders": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Order" | |
} | |
}, | |
"Installers": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Installer" | |
} | |
}, | |
"Projects": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Project" | |
} | |
}, | |
"Error": { | |
"type": "object", | |
"required": [ | |
"code", | |
"message" | |
], | |
"properties": { | |
"code": { | |
"type": "integer", | |
"format": "int32" | |
}, | |
"message": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment