HW cloud API v1

API section

Commands

Commands to registers: a request to the agent API in an envelope and the log of all agent requests. The agent API without an envelope — the /agent/api/v1/** proxy, see Agent API → Through the cloud.

POST/api/v1/devices/{id}/commandsCommand to a register (envelope)
GET/api/v1/requestsAgent request log

Command to a register (envelope)#

POST/api/v1/devices/{id}/commands

A request to the agent API in the body {method, path, body, idempotencyKey}; the agent response as is. The same without an envelope, with files and headers — the /agent/api/v1/** proxy. Offline — 503, no answer — 504 (a retry with the same idempotencyKey never runs the operation twice), disabled — 403 DEVICE_DISABLED

Parameters

NameInTypeDescription
idrequiredpathinteger int64

register number from GET /api/v1/devices

Request body application/json required

Fields · CommandRequest
  • methodstring
    pattern: GET|POST|PUT|DELETE|PATCH
  • pathstringrequired
    pattern: /api/v1/.*
    from 1
  • bodyany value
  • idempotencyKeystring
JSON
{
  "method": "string",
  "path": "string",
  "body": {},
  "idempotencyKey": "string"
}

Response 200 application/json

Type: object

Errors — problem+json with a code field, see error codes.

Request example

curl
curl -X POST 'https://cloud.hw-connector.ru/api/v1/devices/42/commands' \
  -H 'X-Api-Key: hwk_…' \
  -H 'Content-Type: application/json' \
  --data '{"method":"string","path":"string","body":{},"idempotencyKey":"string"}'

Agent request log#

GET/api/v1/requests

Requests through the /agent/api/v1/** proxy and POST /api/v1/devices/{id}/commands: register, method, path without the query string, response status, proxy error, ms. Bodies are not stored; kept 30 days

Parameters

NameInTypeDescription
deviceIdqueryinteger int64

Only this register

failedqueryboolean

Only failed: proxy errors and 4xx/5xx responses

limitqueryinteger int32
offsetqueryinteger int32

Response 200 application/json

Array · LogEntry
  • atstring date-time
  • deviceIdinteger int64
  • methodstring
  • pathstring
  • statusinteger int32
  • errorstring
  • msinteger int32
  • sourcestring

Errors — problem+json with a code field, see error codes.

Request example

curl
curl 'https://cloud.hw-connector.ru/api/v1/requests' \
  -H 'X-Api-Key: hwk_…'