Skip to content

assetUnits

Assets module · 8 operations

List asset unit rows

GET/asset-units

An individual asset tracked by serial or asset tag (unit grain), with a nine-value lifecycle. Returns a cursor page of asset unit rows the caller may see. The default order is `created_at` ascending. Supports sparse fieldsets and the filter grammar.

Create an asset unit

POST/asset-units

An individual asset tracked by serial or asset tag (unit grain), with a nine-value lifecycle. Creates an asset unit. Requires `Idempotency-Key`; a replay returns the original response. The organization is derived from the credential or the parent row, never from the body.

Get an asset unit

GET/asset-units/{id}

An individual asset tracked by serial or asset tag (unit grain), with a nine-value lifecycle. Returns one asset unit with its `ETag`. A asset unit the caller may not see returns 404.

Update an asset unit

PATCH/asset-units/{id}

An individual asset tracked by serial or asset tag (unit grain), with a nine-value lifecycle. Updates the fields sent; omitted fields are unchanged. Requires `If-Match` with the current `ETag`: a stale tag returns 412 and a missing tag returns 428.

Delete an asset unit

DELETE/asset-units/{id}

An individual asset tracked by serial or asset tag (unit grain), with a nine-value lifecycle. Soft-deletes the asset unit: it moves to Trash and can be restored for its table's retention period.

Transition the asset state

POST/asset-units/{id}/transitions

Moves the asset lifecycle to another state through its transition RPC, which writes the transition ledger. Uses compare-and-set on `expected_state`; a disallowed transition returns a 422 refusal. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.

Resolve a scanned asset

POST/asset-units/scan

Resolves a scanned barcode, QR or NFC payload to an asset unit. An unknown code returns a 422 `NO_ANSWER` refusal. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.

Apply a scan event

POST/asset-units/scans

Applies one scanned custody move in one transaction (app.apply_asset_scan): resolves the code to a unit or lot, writes the custody entry or lot movement under the device's event id, and moves the unit's state. Replaying an event id returns `duplicate` and changes nothing. A unit someone else moved meanwhile is refused (422, asset_scan_state_conflict); a code no item carries is refused with NO_ANSWER. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.