Interfaces
Which key protects a repetition, and which version protects an outdated decision?
The following endpoints are proposed APIs for this example. Submission binds A-17 to the server-identified applicant. Every change carries the expected revision and request version. U-17 has a separate contract with external purchasing.
Starting point Step 3 has set the targeted test peak for simultaneous decisions.
Assumptions for the example case
Illustrative design: an internal procurement request for 6,000 euros undergoes business review followed by budget review. The inclusive budget threshold is 5,000 euros. These figures are assumptions rather than operational measurements. Ordering, payment, contract law and automatic decisions are outside the scope.
Three contracts with different effects
Contracts · Commands, decisions and handovers have separate retry rules
U-17. A lost response leaves the handover pending until reconciliation establishes acceptance.- Calling role or target system
- Server-side inspection
An identical idempotency key repeats the same request. Changed payload under the same key produces a conflict.
Proposed contracts
- POST
/applications/A-17/revisionsSubmit R-3
- Input
- Amount, business details, requestKey, expected active revision and request version; applicant identity comes from the session. Initial submission compares the current draft state.
- Result
- 202 with reviewing, active revision and new request version only after commit; otherwise 409 if the initial state has changed.
- Retry behaviour
- Same requestKey with the same payload delivers the same revision; different payload conflict.
- POST
/tasks/F-17/decisionRecord a decision
- Input
- approved or rejected, expected revision R-3, expectedVersion=7 and requestKey; identity and current role from server context.
- Result
- 200 with the stored decision result and request version, 403 for insufficient authorisation, or 409 for a revision, version, task or idempotency conflict.
- Retry behaviour
- The same requestKey, actor and content provide the stored original receipt after a new rights check, even after a lost response. New content to the key returns 409; a new key must not re-decide a closed task. Current status is read separately.
- POST
/handoffs/U-17Accept the purchasing handover at the external target
- Input
- U-17 as a stable key, plus the approved revision.
- Result
- acknowledged or the existing acceptance.
- Retry behaviour
- The same U-17 with identical content returns its existing acceptance. Changed content under U-17 produces a conflict for process operations to investigate.
Acceptance and external completion
- 202 does not confirm purchasing success
- The submission confirms only the accepted revision and the first task.
- Transfer pending
- After business approval, acceptance at the target may still be unknown. The worker reconciles it.
Terms in this step
- Idempotency key
- A stable key associates retries with one intended effect. It must not conceal a changed request.
Try it yourself
Sketch the response to a decision request for R-3 if R-4 is now active. Complement the effect of an identical U-17 repetition.
A hint for your attempt
Version conflict and external duplicate treatment are at different limits.
Compare with a possible solution
- Version conflict
- The API returns 409 revision_conflict and records no approval. Test: A-17 remains reviewing with R-4 active.
- Duplicate transfer
- The purchasing application recognises U-17 and returns the existing acceptance. Test: exactly one external order reference is stored.
Apply to your project
Which request data must be compared in your critical command on the server side with the current state of affairs?