🔌Idempotency
Also known as Idempotent, Idempotency Key, Idempotent Request
When doing something twice has the same result as doing it once.
Think of it like
Think of it like a lift button. Pressing it five times calls the lift once.
Example
Emma's app sends a payment with an idempotency key. The network drops, the app sends it again, and the card is charged only once.
Why it matters
Networks fail all the time. Idempotent actions turn a scary retry into a safe one.
Definition
Example code
http
POST /payments HTTP/1.1
Idempotency-Key: 8f2c-41a7
{"amount": 2500}Common mistake
Key takeaways
- 1Twice equals once. Same end result.
- 2GET, PUT, DELETE. Meant to be idempotent.
- 3Keys for POST. Make retries safe.