Lesson 03.2
Idempotency keys (API level)
An idempotency key is a unique id a client sends with a request so the server can recognise a retry and return the original result instead of doing the work again.
Asking again after no answer
Mia taps Buy ticket in the cinema app. The app sends request #7 to the cinema's computer. Ava or Ben, whoever is free, charges Mia's card $10 and sends back “Done!”.
Phones lose signal. If the app hears nothing for a while, it asks again. What could go wrong?
In this lesson you'll
- 1Explain how a saved request number lets a retry get the same answer instead of doing the job twice
- 2Watch a normal ticket purchase.
- 3Guess what happens when the answer gets lost.
- 4Find a rule so Mia pays once.