Work Order To Equipment
Reference for the work_order_to_equipment resource. Requests follow the conventions in
Requests and Responses; fields you
receive and may write are filtered by your user's permissions, so responses can
contain a subset of the fields below.
Operations
| Operation | Request |
|---|---|
| List | GET /{profile}/user/v4/work_order_to_equipment |
| Set (upsert) the work needed on a work order for one equipment item | POST /{profile}/user/v4/work_order_to_equipment/set |
| Remove an equipment work-item from a work order by (work_order_id, customer_equipment_id) | POST /{profile}/user/v4/work_order_to_equipment/clear |
Not available as a standard REST operation for this resource: create, update, delete —
such requests return 402 feature_not_enabled or 403 permission_denied (see the actions above for this resource's write path).
How it works
work_order_to_equipment records the work needed on a work order: for each of the customer's
equipment items, whether the work order is to install, service, or remove it. Each row is
work_order_id + customer_equipment_id + work_order_action_id, where the action is:
work_order_action_id |
Work |
|---|---|
1 |
Install |
2 |
Service |
3 |
Remove |
Gated by Customer Work Orders at the work order's customer location. (A work order is a
customer_notes record with is_work_order = 1.)
This resource has a composite primary key (
work_order_id,customer_equipment_id) and no row id. A work-item is identified by the pair (work order, equipment), so there is noGET/PATCH/DELETE /work_order_to_equipment/{id}. You read the items (list) and set / remove them through the two collection actions below. The equipment must belong to the work order's customer.
Setting the work needed
POST /work_order_to_equipment/set upserts a work-item: it updates the action if the equipment is
already on the work order, otherwise it adds it.
curl -X POST "https://portal.securitytrax.com/acme/user/v4/work_order_to_equipment/set" \
-H "Authorization: Bearer stx_acme_..." \
-H "Content-Type: application/json" \
-d '{"data":{"attributes":{"work_order_id":815,"customer_equipment_id":42,"work_order_action_id":1}}}'
| Field | Required | Notes |
|---|---|---|
work_order_id |
Yes | The work order (a customer_notes record with is_work_order = 1). |
customer_equipment_id |
Yes | One of the work order's customer's equipment items. |
work_order_action_id |
Yes | 1 Install, 2 Service, 3 Remove. |
Returns the resulting row (201). An equipment item that doesn't belong to the work order's customer
returns 422; an unknown work order or action returns 422.
Removing a work-item
POST /work_order_to_equipment/clear removes an equipment item from a work order. Removing one that
isn't on the work order returns 404.
curl -X POST "https://portal.securitytrax.com/acme/user/v4/work_order_to_equipment/clear" \
-H "Authorization: Bearer stx_acme_..." \
-H "Content-Type: application/json" \
-d '{"data":{"attributes":{"work_order_id":815,"customer_equipment_id":42}}}'
Reading the work needed
GET /work_order_to_equipment?work_order_id={workOrderId} lists a work order's equipment work-items
(filters: work_order_id, customer_equipment_id; sort: work_order_id, customer_equipment_id,
work_order_action_id, created_at; ?count_only=true for the total). Each row can expand its
work_order and customer_equipment via ?include=.
Fields
Fields are grouped by the permission that gates them. A group you may not view
is absent from responses; a group you may not write is rejected with 422 when
sent in a write.
Work Order Equipment
View: Customer Work Orders at the record's location. Create: Customer Work Orders at the record's location. Update: Customer Work Orders at the record's location.
| Field | Type | Writable | Validation |
|---|---|---|---|
work_order_id |
integer (nullable) | Create, update | min 0 |
customer_equipment_id |
integer (nullable) | Create, update | min 0 |
work_order_action_id |
integer (nullable) | Create, update | min 0 |
created_at |
string (nullable) | Read-only | — |
created_by |
integer (nullable) | Read-only | — |
updated_at |
string (nullable) | Read-only | — |
updated_by |
integer (nullable) | Read-only | — |
Pagination
The list endpoint uses client-controlled offset pagination: ?page= (1-based) and
?per_page= (default 25, max 100). The response mirrors
meta.pagination (page, per_page, total, last_page) and sends an RFC5988
Link header; follow rel="next" to walk pages. See
Pagination.
Filters
The list endpoint accepts these query-param filters: work_order_id, customer_equipment_id.
An unsupported filter parameter returns 422. See
Filtering collections
for matching semantics.
Sorting
GET .../work_order_to_equipment?sort= orders the list by: work_order_id, customer_equipment_id, work_order_action_id, created_at.
Prefix a field with - for descending; comma-separate for tie-breakers. An
unsupported field returns 422. See
Sorting collections.
Related
- Requests and Responses — envelope, errors, pagination, and rate limits.
- Authentication — tokens and the
Authorizationheader.