HW agent API 2.15.3

API section

Scales

Scale weight and zeroing (zero or tare).

POST/api/v1/scales/{id}/zeroZero the scale
GET/api/v1/scales/{id}/weightWeight on the scale

Zero the scale#

POST/api/v1/scales/{id}/zero
Operation

Set zero or tare, as the scale protocol allows; no request body

Parameters

NameInTypeDescription
idrequiredpathinteger int32

device number from GET /api/v1/devices

Idempotency-Keyrequiredheaderstring
Preferheaderstring

Response 200 application/json

Fields · Operation
  • idstring uuid
  • typestring
  • idempotencyKeystring
  • resourcesarray of string
  • statusstring
    values: QUEUED RUNNING SUCCEEDED FAILED UNKNOWN
  • stagestring
  • createdAtstring date-time
  • startedAtstring date-time
  • finishedAtstring date-time
  • resultany value
  • 3 fields · OperationError
    • codestring
    • messagestring
    • detailsany value
  • warningsarray of string

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

Request example

curl
curl -X POST 'http://localhost:7790/api/v1/scales/1/zero' \
  -H 'Idempotency-Key: $(uuidgen)' \
  -H 'Prefer: wait=30'
curl
curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/scales/1/zero' \
  -H 'X-Api-Key: hwk_…' \
  -H 'X-Device-Id: 42' \
  -H 'Idempotency-Key: $(uuidgen)' \
  -H 'Prefer: wait=30'

Weight on the scale#

GET/api/v1/scales/{id}/weight

Immediate, not an operation: request-response scales wait a few seconds for the load to settle (stable=true). Stream-mode scales return the latest reading; its changes arrive as weight events

Parameters

NameInTypeDescription
idrequiredpathinteger int32

device number from GET /api/v1/devices

Response 200 application/json

Fields · Weight
  • deviceIdinteger int32
  • weightnumber
  • stableboolean
  • atstring date-time

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

Request example

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