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/content | Read a file |
| PUT | /api/v1/files/content | Write a file |
| GET | /api/v1/system/computer | Computer info |
| GET | /api/v1/files | Files in the allowed folder |
| DELETE | /api/v1/files | Delete a file |
Read a file#
GET
/api/v1/files/contentContent in base64 and, for UTF-8 text, in text
Parameters
| Name | In | Type | Description |
|---|---|---|---|
pathrequired | query | string |
Response 200 application/json
Fields · FileContent
pathstringtextstringbase64string
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/contentBody {text} or {base64}; subfolders are created; the file is replaced as a whole
Parameters
| Name | In | Type | Description |
|---|---|---|---|
pathrequired | query | string |
Request body application/json required
Fields · FileContent
pathstringtextstringbase64string
JSON
{
"path": "string",
"text": "string",
"base64": "string"
}Response 200 application/json
Fields · FileInfo
pathstringsizeinteger int64modifiedstring date-timedirectoryboolean
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/computerName, user, OS, network adapters (MAC, IP) and the agent's permanent machineId
Response 200 application/json
Fields · Computer
machineIdstringhostnamestringuserstringosstringosVersionstringarchstringagentVersionstringinterfacesarray of Interface6 fields · Interface
namestringdisplayNamestringmacstringipv4array of stringipv6array of stringvirtualboolean
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/filesEnabled by hw.files.enabled; dir — subfolder, empty — root
Parameters
| Name | In | Type | Description |
|---|---|---|---|
dir | query | string |
Response 200 application/json
Array · FileInfo
pathstringsizeinteger int64modifiedstring date-timedirectoryboolean
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/filesParameters
| Name | In | Type | Description |
|---|---|---|---|
pathrequired | query | string |
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'