Enqueue a work unit onto a process path's work pool
POST/paths/:pathId/work-units
This endpoint has been deprecated and may be replaced or removed in future versions of the API.
Adds a releasable unit of work (e.g. a pick task) to a process path's WorkPool — the EnqueueWorkUnit use case. workUnitId is client-supplied and must be unique within the pool: enqueueing the same workUnitId twice returns 409 Conflict (work-unit-already-enqueued) rather than silently creating a duplicate entry — this endpoint is idempotent-by-client-supplied-ID in that sense, though not a pure no-op retry (a second call with the same ID is rejected, not silently accepted). If this is the first unit ever enqueued against the path, a WorkPool is auto-provisioned as release-fed with a default WIP limit. Publishes WorkUnitCreated.
A unit becomes a pack-aware pick (workKind CASE_PICK / EACH_PICK) when the body carries quantity (eaches), pickUnit or fromBin, or a BREAK_CASE when it carries caseBreak (ADR-0045); both need a sku and the two never mix. A CASE pick needs an active CASE pack level in the local copy and a whole number of cases.
Idempotency (ADR-0022, replay classes ADR-0050). This resource-creating POST requires a caller-supplied Idempotency-Key header. The first request with a given key is processed and its final response (status, headers, body) is stored in the same database transaction as the write; a retry with the same key and the same body replays that stored response verbatim and does not enqueue again. A refusal is stored only when it is final for the request — a validation of the request's own fields (FINAL). A refusal that depends on state that can change (work-unit-already-enqueued, unknown-path-id, no-active-case-level, quantity-not-case-multiple, any 5xx) is not stored: the key is released, so the same key can be retried and executes again (a different body under it is a new request, not idempotency-key-reused). A missing key is 400 idempotency-key-required; the same key with a different body after a stored answer is 409 idempotency-key-reused. Use a fresh key per logical action. A replay carries Idempotency-Replayed: true.
Superseded by the K1 choreography (X3): order-management publishes OrderAllocated / OrderPartiallyAllocated and this service's ApplyOrderAllocated consumer enqueues one work unit per line (OM ADR 0005 / WP ADR-0031); removal planned with the next breaking window.
Request
Responses
- 201
- 400
- 409
- 422
- 500
Work unit enqueued in Pending state.
Response Headers
Present, with value true, only when this answer is a replay of a stored earlier answer for the same Idempotency-Key.
Canonical URI of the created work unit.
/work-units/wu-482910Either the Idempotency-Key header is missing (idempotency-key-required) or malformed (idempotency-key-invalid), or the body is malformed / fails validation (including a missing cpt) / names an unknown pathId (unknown-path-id), or fails the lineNo (invalid-line-no) or pack-aware checks (unknown-pick-unit, invalid-pick-plan, invalid-case-break).
A work unit with this workUnitId is already enqueued in this pool (work-unit-already-enqueued), the pool was modified concurrently (concurrent-modification), or the Idempotency-Key was already used with a different request (idempotency-key-reused; fingerprint = method + path + body hash). Distinguish by the problem type.
A CASE pick cannot be planned: the SKU has no active CASE pack level in this service's local copy (no-active-case-level) or quantity is not a whole number of cases (quantity-not-case-multiple).
An unexpected server-side failure (e.g. a repository or event-publisher error).