Methods revisited: safety and idempotency
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
classify HTTP methods and explain why retries depend on it.
Planned topics
- Safe means the request does not change server state (reading only).
GET,HEAD,OPTIONSare safe. - Idempotent means doing it once or ten times leaves the server in the same state.
GET,PUT,DELETEare idempotent. POSTis neither safe nor idempotent: two identical calls can create two orders.PATCHis not guaranteed idempotent; it depends on what the patch says.- Clients, proxies, and load balancers may retry idempotent calls automatically. A non-idempotent retry can duplicate work.
Draft outline details
Demonstration
| Method | Safe | Idempotent |
|---|---|---|
| GET | yes | yes |
| PUT | no | yes |
| DELETE | no | yes |
| POST | no | no |
Check your understanding
Why is it fine to retry PUT /products/5 after a timeout?
Show answer
Repeating it leaves the same final state.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.