{ "schemes": [], "swagger": "2.0", "info": { "description": "grid proxy server has the main methods to list farms, nodes, node details in the grid.", "title": "Grid Proxy Server API", "contact": {}, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "host": "", "basePath": "/", "paths": { "/contracts": { "get": { "description": "Get all contracts on the grid, It has pagination", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "GridProxy" ], "summary": "Show contracts on the grid", "parameters": [ { "type": "integer", "description": "Page number", "name": "page", "in": "query" }, { "type": "integer", "description": "Max result per page", "name": "size", "in": "query" }, { "type": "boolean", "description": "Set contracts' count on headers based on filter", "name": "ret_count", "in": "query" }, { "type": "integer", "description": "contract id", "name": "contract_id", "in": "query" }, { "type": "integer", "description": "twin id", "name": "twin_id", "in": "query" }, { "type": "integer", "description": "node id which contract is deployed on in case of ('rent' or 'node' contracts)", "name": "node_id", "in": "query" }, { "type": "string", "description": "contract name in case of 'name' contracts", "name": "name", "in": "query" }, { "type": "string", "description": "contract type 'node', 'name', or 'rent'", "name": "type", "in": "query" }, { "type": "string", "description": "contract state 'Created', 'GracePeriod', or 'Deleted'", "name": "state", "in": "query" }, { "type": "string", "description": "contract deployment data in case of 'node' contracts", "name": "deployment_data", "in": "query" }, { "type": "string", "description": "contract deployment hash in case of 'node' contracts", "name": "deployment_hash", "in": "query" }, { "type": "integer", "description": "Min number of public ips in the 'node' contract", "name": "number_of_public_ips", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/types.Contract" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/farms": { "get": { "description": "Get all farms on the grid, It has pagination", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "GridProxy" ], "summary": "Show farms on the grid", "parameters": [ { "type": "integer", "description": "Page number", "name": "page", "in": "query" }, { "type": "integer", "description": "Max result per page", "name": "size", "in": "query" }, { "type": "boolean", "description": "Set farms' count on headers based on filter", "name": "ret_count", "in": "query" }, { "type": "integer", "description": "Min number of free ips in the farm", "name": "free_ips", "in": "query" }, { "type": "integer", "description": "Min number of total ips in the farm", "name": "total_ips", "in": "query" }, { "type": "integer", "description": "Pricing policy id", "name": "pricing_policy_id", "in": "query" }, { "type": "integer", "description": "farm version", "name": "version", "in": "query" }, { "type": "integer", "description": "farm id", "name": "farm_id", "in": "query" }, { "type": "integer", "description": "twin id associated with the farm", "name": "twin_id", "in": "query" }, { "type": "string", "description": "farm name", "name": "name", "in": "query" }, { "type": "string", "description": "farm name contains", "name": "name_contains", "in": "query" }, { "type": "string", "description": "certificate type Diy or Certified", "name": "certification_type", "in": "query" }, { "type": "boolean", "description": "farm is dedicated", "name": "dedicated", "in": "query" }, { "type": "string", "description": "farm stellar_address", "name": "stellar_address", "in": "query" }, { "type": "integer", "description": "Min free reservable mru for at least a single node that belongs to the farm, in bytes", "name": "node_free_mru", "in": "query" }, { "type": "integer", "description": "Min free reservable hru for at least a single node that belongs to the farm, in bytes", "name": "node_free_hru", "in": "query" }, { "type": "integer", "description": "Min free reservable sru for at least a single node that belongs to the farm, in bytes", "name": "node_free_sru", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/types.Farm" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/gateways": { "get": { "description": "Get all gateways on the grid, It has pagination", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "GridProxy" ], "summary": "Show gateways on the grid", "parameters": [ { "type": "integer", "description": "Page number", "name": "page", "in": "query" }, { "type": "integer", "description": "Max result per page", "name": "size", "in": "query" }, { "type": "boolean", "description": "Set nodes' count on headers based on filter", "name": "ret_count", "in": "query" }, { "type": "integer", "description": "Min free reservable mru in bytes", "name": "free_mru", "in": "query" }, { "type": "integer", "description": "Min free reservable hru in bytes", "name": "free_hru", "in": "query" }, { "type": "integer", "description": "Min free reservable sru in bytes", "name": "free_sru", "in": "query" }, { "type": "integer", "description": "Min number of free ips in the farm of the node", "name": "free_ips", "in": "query" }, { "type": "string", "description": "Node status filter, 'up': for only up nodes, 'down': for only down nodes \u0026 'standby' for powered-off nodes by farmerbot.", "name": "status", "in": "query" }, { "type": "string", "description": "Node city filter", "name": "city", "in": "query" }, { "type": "string", "description": "Node country filter", "name": "country", "in": "query" }, { "type": "string", "description": "Get nodes for specific farm", "name": "farm_name", "in": "query" }, { "type": "boolean", "description": "Set to true to filter nodes with ipv4", "name": "ipv4", "in": "query" }, { "type": "boolean", "description": "Set to true to filter nodes with ipv6", "name": "ipv6", "in": "query" }, { "type": "boolean", "description": "Set to true to filter nodes with domain", "name": "domain", "in": "query" }, { "type": "boolean", "description": "Set to true to get the dedicated nodes only", "name": "dedicated", "in": "query" }, { "type": "boolean", "description": "Set to true to filter the available nodes for renting", "name": "rentable", "in": "query" }, { "type": "boolean", "description": "Set to true to filter rented nodes", "name": "rented", "in": "query" }, { "type": "integer", "description": "rented by twin id", "name": "rented_by", "in": "query" }, { "type": "integer", "description": "available for twin id", "name": "available_for", "in": "query" }, { "type": "string", "description": "List of farms separated by comma to fetch nodes from (e.g. '1,2,3')", "name": "farm_ids", "in": "query" }, { "type": "string", "description": "certificate type Diy or Certified", "name": "certification_type", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/types.Node" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/gateways/{node_id}": { "get": { "description": "Get all details for specific gateway hardware, capacity, DMI, hypervisor", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "GridProxy" ], "summary": "Show the details for specific gateway", "parameters": [ { "type": "integer", "description": "Node ID", "name": "node_id", "in": "path" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NodeWithNestedCapacity" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nodes": { "get": { "description": "Get all nodes on the grid, It has pagination", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "GridProxy" ], "summary": "Show nodes on the grid", "parameters": [ { "type": "integer", "description": "Page number", "name": "page", "in": "query" }, { "type": "integer", "description": "Max result per page", "name": "size", "in": "query" }, { "type": "boolean", "description": "Set nodes' count on headers based on filter", "name": "ret_count", "in": "query" }, { "type": "integer", "description": "Min free reservable mru in bytes", "name": "free_mru", "in": "query" }, { "type": "integer", "description": "Min free reservable hru in bytes", "name": "free_hru", "in": "query" }, { "type": "integer", "description": "Min free reservable sru in bytes", "name": "free_sru", "in": "query" }, { "type": "integer", "description": "Min number of free ips in the farm of the node", "name": "free_ips", "in": "query" }, { "type": "string", "description": "Node status filter, 'up': for only up nodes, 'down': for only down nodes \u0026 'standby' for powered-off nodes by farmerbot.", "name": "status", "in": "query" }, { "type": "string", "description": "Node city filter", "name": "city", "in": "query" }, { "type": "string", "description": "Node country filter", "name": "country", "in": "query" }, { "type": "string", "description": "Get nodes for specific farm", "name": "farm_name", "in": "query" }, { "type": "boolean", "description": "Set to true to filter nodes with ipv4", "name": "ipv4", "in": "query" }, { "type": "boolean", "description": "Set to true to filter nodes with ipv6", "name": "ipv6", "in": "query" }, { "type": "boolean", "description": "Set to true to filter nodes with domain", "name": "domain", "in": "query" }, { "type": "boolean", "description": "Set to true to get the dedicated nodes only", "name": "dedicated", "in": "query" }, { "type": "boolean", "description": "Set to true to filter the available nodes for renting", "name": "rentable", "in": "query" }, { "type": "boolean", "description": "Set to true to filter rented nodes", "name": "rented", "in": "query" }, { "type": "integer", "description": "rented by twin id", "name": "rented_by", "in": "query" }, { "type": "integer", "description": "available for twin id", "name": "available_for", "in": "query" }, { "type": "string", "description": "List of farms separated by comma to fetch nodes from (e.g. '1,2,3')", "name": "farm_ids", "in": "query" }, { "type": "string", "description": "certificate type Diy or Certified", "name": "certification_type", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/types.Node" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nodes/{node_id}": { "get": { "description": "Get all details for specific node hardware, capacity, DMI, hypervisor", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "GridProxy" ], "summary": "Show the details for specific node", "parameters": [ { "type": "integer", "description": "Node ID", "name": "node_id", "in": "path" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NodeWithNestedCapacity" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nodes/{node_id}/statistics": { "get": { "description": "Get node statistics for more information about each node through the RMB relay", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "NodeStatistics" ], "summary": "Show node statistics", "parameters": [ { "type": "integer", "description": "Node ID", "name": "node_id", "in": "path" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NodeWithNestedCapacity" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/ping": { "get": { "description": "ping the server to check if it is running", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "ping" ], "summary": "ping the server", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/explorer.PingMessage" } } } } }, "/stats": { "get": { "description": "Get statistics about the grid", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "GridProxy" ], "summary": "Show stats about the grid", "parameters": [ { "type": "string", "description": "Node status filter, 'up': for only up nodes, 'down': for only down nodes \u0026 'standby' for powered-off nodes by farmerbot.", "name": "status", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/types.Counters" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/twins": { "get": { "description": "Get all twins on the grid, It has pagination", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "GridProxy" ], "summary": "Show twins on the grid", "parameters": [ { "type": "integer", "description": "Page number", "name": "page", "in": "query" }, { "type": "integer", "description": "Max result per page", "name": "size", "in": "query" }, { "type": "boolean", "description": "Set twins' count on headers based on filter", "name": "ret_count", "in": "query" }, { "type": "integer", "description": "twin id", "name": "twin_id", "in": "query" }, { "type": "string", "description": "account address", "name": "account_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/types.Twin" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } } }, "definitions": { "explorer.PingMessage": { "type": "object", "properties": { "ping": { "type": "string", "example": "pong" } } }, "gridtypes.Unit": { "type": "integer", "enum": [ 1024, 1048576, 1073741824, 1099511627776 ], "x-enum-varnames": [ "Kilobyte", "Megabyte", "Gigabyte", "Terabyte" ] }, "types.Capacity": { "type": "object", "properties": { "cru": { "type": "integer" }, "hru": { "$ref": "#/definitions/gridtypes.Unit" }, "mru": { "$ref": "#/definitions/gridtypes.Unit" }, "sru": { "$ref": "#/definitions/gridtypes.Unit" } } }, "types.CapacityResult": { "type": "object", "properties": { "total_resources": { "$ref": "#/definitions/types.Capacity" }, "used_resources": { "$ref": "#/definitions/types.Capacity" } } }, "types.Contract": { "type": "object", "properties": { "billing": { "type": "array", "items": { "$ref": "#/definitions/types.ContractBilling" } }, "contractId": { "type": "integer" }, "created_at": { "type": "integer" }, "details": {}, "state": { "type": "string" }, "twinId": { "type": "integer" }, "type": { "type": "string" } } }, "types.ContractBilling": { "type": "object", "properties": { "amountBilled": { "type": "integer" }, "discountReceived": { "type": "string" }, "timestamp": { "type": "integer" } } }, "types.Counters": { "type": "object", "properties": { "accessNodes": { "type": "integer" }, "contracts": { "type": "integer" }, "countries": { "type": "integer" }, "farms": { "type": "integer" }, "gateways": { "type": "integer" }, "nodes": { "type": "integer" }, "nodesDistribution": { "type": "object", "additionalProperties": { "type": "integer" } }, "publicIps": { "type": "integer" }, "totalCru": { "type": "integer" }, "totalHru": { "type": "integer" }, "totalMru": { "type": "integer" }, "totalSru": { "type": "integer" }, "twins": { "type": "integer" } } }, "types.Farm": { "type": "object", "properties": { "certificationType": { "type": "string" }, "dedicated": { "type": "boolean" }, "farmId": { "type": "integer" }, "name": { "type": "string" }, "pricingPolicyId": { "type": "integer" }, "publicIps": { "type": "array", "items": { "$ref": "#/definitions/types.PublicIP" } }, "stellarAddress": { "type": "string" }, "twinId": { "type": "integer" } } }, "types.Location": { "type": "object", "properties": { "city": { "type": "string" }, "country": { "type": "string" }, "latitude": { "type": "number" }, "longitude": { "type": "number" } } }, "types.Node": { "type": "object", "properties": { "certificationType": { "type": "string" }, "city": { "type": "string" }, "country": { "type": "string" }, "created": { "type": "integer" }, "dedicated": { "type": "boolean" }, "farmId": { "type": "integer" }, "farmingPolicyId": { "type": "integer" }, "gridVersion": { "type": "integer" }, "id": { "type": "string" }, "location": { "$ref": "#/definitions/types.Location" }, "nodeId": { "type": "integer" }, "power": { "$ref": "#/definitions/types.NodePower" }, "publicConfig": { "$ref": "#/definitions/types.PublicConfig" }, "rentContractId": { "type": "integer" }, "rentedByTwinId": { "type": "integer" }, "serialNumber": { "type": "string" }, "status": { "description": "added node status field for up or down", "type": "string" }, "total_resources": { "$ref": "#/definitions/types.Capacity" }, "twinId": { "type": "integer" }, "updatedAt": { "type": "integer" }, "uptime": { "type": "integer" }, "used_resources": { "$ref": "#/definitions/types.Capacity" } } }, "types.NodePower": { "type": "object", "properties": { "state": { "type": "string" }, "target": { "type": "string" } } }, "types.NodeWithNestedCapacity": { "type": "object", "properties": { "capacity": { "$ref": "#/definitions/types.CapacityResult" }, "certificationType": { "type": "string" }, "city": { "type": "string" }, "country": { "type": "string" }, "created": { "type": "integer" }, "dedicated": { "type": "boolean" }, "farmId": { "type": "integer" }, "farmingPolicyId": { "type": "integer" }, "gridVersion": { "type": "integer" }, "id": { "type": "string" }, "location": { "$ref": "#/definitions/types.Location" }, "nodeId": { "type": "integer" }, "power": { "$ref": "#/definitions/types.NodePower" }, "publicConfig": { "$ref": "#/definitions/types.PublicConfig" }, "rentContractId": { "type": "integer" }, "rentedByTwinId": { "type": "integer" }, "serialNumber": { "type": "string" }, "status": { "description": "added node status field for up or down", "type": "string" }, "twinId": { "type": "integer" }, "updatedAt": { "type": "integer" }, "uptime": { "type": "integer" } } }, "types.PublicConfig": { "type": "object", "properties": { "domain": { "type": "string" }, "gw4": { "type": "string" }, "gw6": { "type": "string" }, "ipv4": { "type": "string" }, "ipv6": { "type": "string" } } }, "types.PublicIP": { "type": "object", "properties": { "contractId": { "type": "integer" }, "farmId": { "type": "string" }, "gateway": { "type": "string" }, "id": { "type": "string" }, "ip": { "type": "string" } } }, "types.Twin": { "type": "object", "properties": { "accountId": { "type": "string" }, "publicKey": { "type": "string" }, "relay": { "type": "string" }, "twinId": { "type": "integer" } } } } }