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}/commands | Command to a register (envelope) |
| GET | /api/v1/requests | Agent request log |
Command to a register (envelope)#
/api/v1/devices/{id}/commandsA 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
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | integer int64 | register number from |
Request body application/json required
Fields · CommandRequest
methodstringpattern:GET|POST|PUT|DELETE|PATCHpathstringrequiredpattern:/api/v1/.*from 1bodyany valueidempotencyKeystring
{
"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 -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#
/api/v1/requestsRequests 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
| Name | In | Type | Description |
|---|---|---|---|
deviceId | query | integer int64 | Only this register |
failed | query | boolean | Only failed: proxy errors and 4xx/5xx responses |
limit | query | integer int32 | |
offset | query | integer int32 |
Response 200 application/json
Array · LogEntry
atstring date-timedeviceIdinteger int64methodstringpathstringstatusinteger int32errorstringmsinteger int32sourcestring
Errors — problem+json with a code field, see error codes.
Request example
curl 'https://cloud.hw-connector.ru/api/v1/requests' \
-H 'X-Api-Key: hwk_…'