HTTP methods
corebeginnerEach HTTP method is a verb that states intent — GET reads, POST creates or triggers an action, PUT/PATCH update, DELETE removes — and two properties, safety and idempotency, decide whether a client or a proxy can retry a request automatically.
Think of it as
A method is a labeled request slot at a counter: "returns" (GET), "new order" (POST), "replace this order entirely" (PUT), "just fix this one line" (PATCH), "cancel" (DELETE). The label tells the counter clerk — and any automatic retry logic — whether resubmitting the same slip twice is safe or would double the order.
What we're doing: Prove PUT is idempotent (repeating it produces the identical response) using a real live endpoint, the concrete meaning of "idempotent" beyond the definition alone.
- 4
- The first PUT sends the full desired state of the resource.
- 5
- The second, identical PUT is safe to repeat — a network retry after a lost response would land here with no different outcome.
status codes: 200 200
same resulting resource state: TrueWhy this works: Both PUT calls return status 200 and the identical echoed resource body — sending the same PUT request any number of times leaves the resource in the same final state, which is the concrete, testable meaning of idempotent, not just a label from a table.
- GET, HEAD, OPTIONS — safe AND idempotent — always fine to retry
- PUT, DELETE — idempotent, not safe — retry is fine, state already changes
- POST, PATCH — neither — a blind retry can create a duplicate
Automatically retrying a failed POST request
Wrong
Better
What you see: A duplicate order/charge appears after a network blip — the first POST actually succeeded server-side, but the client never saw the response and retried blindly.
Why: POST is not idempotent by the HTTP spec, so blindly retrying it after a timeout (where the request may have already succeeded) can create a second resource — a server-recognized Idempotency-Key lets the server safely reject or dedupe a retried request instead of creating a duplicate.
The seven methods
Remember: Safe methods never change state; idempotent methods are safe to retry — POST and PATCH are neither by default, so retry them only with a dedupe key.
See also: status codes

