Idempotency in REST APIs: Safe to Retry?

An idempotent API request means sending it once or 100 times has the same effect on the server's state. GET, PUT, and DELETE are idempotent, making them safe to retry. POST is not, so retrying can create duplicates.
An idempotent API request ensures that making the same call multiple times has the same final effect on the server as making it just once. This allows clients to safely retry GET (read), PUT (create/replace), and DELETE (remove) requests over an unreliable network without fear of corrupting state. In contrast, retrying a non-idempotent POST could create duplicate records. The footgun: idempotency guarantees the final server state, not the server's response. A successful DELETE might return 200, but a retry will return 404.
Read the original → developer.mozilla.org
- #rest
- #api design
- #http
- #networking
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.