Record one scan on a package journey (RecordScan)
POST/journeys/:trackingNumber/scans
RecordScan over REST. Scans apply in time order; an older scan is stored but does not move the state (409 scan-out-of-order, the scan is kept with applied=false). A scan whose scanType has no edge from the current state is stored with applied=false and answers 409 illegal-transition. A known scanId answers 409 duplicate-scan and stores nothing. A closed journey answers 409 journey-closed. The two refusals that keep the scan (scan-out-of-order, illegal-transition) are stored under the Idempotency-Key together with the scan, so a retry under the same key replays the refusal and never answers duplicate-scan.
Request
Responses
- 200
- 400
- 404
- 409
- 422
- 500
Scan applied; the journey after the scan.
Response Headers
Present, with the value true, only when the response is a replay of the answer stored for the Idempotency-Key.
idempotency-key-required (the Idempotency-Key header is missing) or idempotency-key-invalid (not 1-128 printable ASCII characters).
not-found. The addressed label or journey does not exist.
duplicate-scan (ErrDuplicateScan), scan-out-of-order (ErrScanOutOfOrder, stored not applied), journey-closed (ErrJourneyClosed), illegal-transition (stored not applied), concurrent-update or idempotency-key-reused (the Idempotency-Key was already used with a different request).
validation-failed. The request is well-formed JSON but violates a value rule. It is not stored under the Idempotency-Key; the key is released and a retry with the same key is validated again.
internal-error. An unmapped failure; the detail never carries the cause. Never cached by the idempotency middleware, so the same key retries the work.