API Testing / Quiz
Idempotency Keys Under Fire
Retries, dedupe windows, and the Idempotency-Key header, the difference between one charge and three.
- Difficulty
- Medium
- Format
- Quiz
- Points
- 150
- Estimate
- 9 min
// MISSION BRIEF
Your Mission
The network times out on a payment POST. The client retries. Does the customer get charged once, or three times? That answer lives in your idempotency design.
This quiz drills the Idempotency-Key protocol, the race conditions that defeat it, and the test cases that prove it holds.
// FIRST CONTACT
Battle teaser
A client retries POST /charges after a network timeout, unsure if the first attempt landed. The clean way to make this safe:
- AAdd a unique timestamp to the body so each request is distinct
- BInstruct clients to never retry a POST
- CSwitch the endpoint to PUT, since PUT is idempotent
- DSupport an Idempotency-Key request header so the server dedupes and returns the original result
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
apiidempotencyretriesconcurrency