Frequent questions about idempotency: how it differs from safe, why DELETE returns different codes, and how Stripe implements idempotency keys.
- Safe vs idempotent?
Safe means read-only. Idempotent means repeatable without additional effects. GET is both; DELETE is idempotent but not safe; POST is neither.
- Why does DELETE return 204 then 404?
The response differs, the state does not. RFC idempotency refers to side-effects, not to status codes.
- How does Stripe's idempotency key work?
The client generates a key, sends it with the request, and the server stores the response. A retry with the same key returns the stored response without re-executing the operation.
- Can PATCH be idempotent?
Sometimes.
PATCH {set name: "Ana"}is effectively idempotent.PATCH {increment counter}is not. RFC 9110 does not guarantee it.