Skip to main content
Version: 0.1.0

Order Sourcing API

REST contract of the order-sourcing bounded context of the retail network, derived from retail-network-docs model/model.yaml (contexts[order-sourcing].rest) and adjusted by the cross-context decisions G5, G10, G12, G13, G14, G20 and G26. Order Sourcing decides which vendor node and path fulfil each shipment group: it keeps a FulfillmentAssignment per group in a virtual queue, re-optimises it until its release point, releases it to one node (a purchase order through vendor-connectivity), reassigns on rejection or expiry, and locks it when the node accepts. This surface is the network-ops planner's: list and inspect assignments, ask for an immediate re-optimisation of a QUEUED one, and read and publish the versioned sourcing policy (ADR 0014). Every other change arrives as a Kafka event (see apis/asyncapi.yaml). No PII is held or returned by this context. No authentication, consistent with the rest of the network. Errors are RFC 9457 problem details whose type is the URI https://errors.order-sourcing.retail-network.example/ followed by the slug (for example .../assignment-locked); detail and instance are always set. The shared problem types are not-found (404), resource-not-found (404, a path that names no resource), method-not-allowed (405), malformed-request (400), illegal-transition (409), concurrent-update (409), validation-failed (422) and internal-error (500); the idempotency problems are idempotency-key-required and idempotency-key-invalid (400) and idempotency-key-reused (409); the model's Err names add assignment-locked, release-in-flight, node-excluded, stale-assignment-version (409) and candidate-breaks-promise (422), and policy-version-not-next (409, PUT /sourcing-policy only: the stored policy version cannot be incremented). The read-only analytics reports (tag reports, ADR 0013) are served by cmd/os-reports on its own port (per-path server) from the separate analytical database; their range problem is invalid-report-range (400). A repeat with the same Idempotency-Key and the same request replays the first response for 24 hours with the Idempotency-Replayed header when that response is final: a 2xx, or a refusal the same request cannot pass later (malformed-request, assignment-locked). A refusal that depends on state that can change is not stored: the key is released and the same request retried under the same key runs again (a different body under a released key is a new request, not idempotency-key-reused). The problem types that release the key (RETRYABLE): release-in-flight, node-excluded, stale-assignment-version, candidate-breaks-promise, not-found, concurrent-update, policy-version-not-next, illegal-transition, validation-failed. A 5xx is never stored (ADR 0019).

Contact

order-sourcing maintainers:

URL: https://github.com/IQVO/order-sourcing