Skip to main content

Enqueue a work unit onto a process path's work pool

POST 

/paths/:pathId/work-units

deprecated

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​

Work unit enqueued in Pending state.

Response Headers
    Idempotency-Replayed

    Present, with value true, only when this answer is a replay of a stored earlier answer for the same Idempotency-Key.

    Location

    Canonical URI of the created work unit.

    Example: /work-units/wu-482910