HW agent API 2.14.1

API section

Computer and files

Computer details and the agent installation id; files in an allowed folder (when hw.files.enabled is on).

GET/api/v1/files/contentRead a file
PUT/api/v1/files/contentWrite a file
GET/api/v1/system/computerComputer info
GET/api/v1/filesFiles in the allowed folder
DELETE/api/v1/filesDelete a file

Read a file#

GET/api/v1/files/content

Content in base64 and, for UTF-8 text, in text

Parameters

NameInTypeDescription
pathrequiredquerystring

Response 200 application/json

Fields · FileContent
  • pathstring
  • textstring
  • base64string

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

Request example

curl
curl 'http://localhost:7790/api/v1/files/content?path=text'
curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/files/content?path=text' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'

Write a file#

PUT/api/v1/files/content

Body {text} or {base64}; subfolders are created; the file is replaced as a whole

Parameters

NameInTypeDescription
pathrequiredquerystring

Request body application/json required

Fields · FileContent
  • pathstring
  • textstring
  • base64string
JSON
{
  "path": "string",
  "text": "string",
  "base64": "string"
}

Response 200 application/json

Fields · FileInfo
  • pathstring
  • sizeinteger int64
  • modifiedstring date-time
  • directoryboolean

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

Request example

curl
curl -X PUT 'http://localhost:7790/api/v1/files/content?path=text' \
  -H 'Content-Type: application/json' \
  --data '{"path":"string","text":"string","base64":"string"}'
curl
curl -X PUT 'https://cloud.hw-connector.ru/agent/api/v1/files/content?path=text' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42' \
  -H 'Content-Type: application/json' \
  --data '{"path":"string","text":"string","base64":"string"}'

Computer info#

GET/api/v1/system/computer

Name, user, OS, network adapters (MAC, IP) and the agent's permanent machineId

Response 200 application/json

Fields · Computer
  • machineIdstring
  • hostnamestring
  • userstring
  • osstring
  • osVersionstring
  • archstring
  • agentVersionstring
  • interfacesarray of Interface
    6 fields · Interface
    • namestring
    • displayNamestring
    • macstring
    • ipv4array of string
    • ipv6array of string
    • virtualboolean

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

Request example

curl
curl 'http://localhost:7790/api/v1/system/computer'
curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/system/computer' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'

Files in the allowed folder#

GET/api/v1/files

Enabled by hw.files.enabled; dir — subfolder, empty — root

Parameters

NameInTypeDescription
dirquerystring

Response 200 application/json

Array · FileInfo
  • pathstring
  • sizeinteger int64
  • modifiedstring date-time
  • directoryboolean

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

Request example

curl
curl 'http://localhost:7790/api/v1/files'
curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/files' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'

Delete a file#

DELETE/api/v1/files

Parameters

NameInTypeDescription
pathrequiredquerystring

Response 200

No body.

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

Request example

curl
curl -X DELETE 'http://localhost:7790/api/v1/files?path=text'
curl
curl -X DELETE 'https://cloud.hw-connector.ru/agent/api/v1/files?path=text' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42'