Methods and request semantics
Methods, safety and idempotency
Repeatability and read-only intent are distinct.
Understand the concept
GET and HEAD are defined for retrieval; deleting orders through GET violates safe semantics. Incidental logging is different from the business effect requested by a client. PUT creates or replaces the targeted representation; DELETE requests removal.
Idempotency concerns intended effect, not identical responses. A DELETE may return 204 then 404 while leaving the same absent-resource state. POST is not generally idempotent. PATCH depends on the operations in the patch document.
HEAD provides GET-like metadata without a response body; some fields can describe the body a GET would send. OPTIONS can describe capabilities and is used for CORS preflight. Method names do not replace authorisation.
Design correct retries, crawlers and API contracts.
Assuming idempotency requires identical responses.
One topic. Three levels of depth.
GET /products/7 HTTP/1.1
Host: example.testRetrieval intent.
This page does not send requests to external servers. Messages are readable HTTP/1.1 illustrations, not HTTP/2 or HTTP/3 wire dumps. example.test is reserved for examples. Run commands and JavaScript only in your own test environment; never publish real tokens or cookies.
Try it yourself first.
Is immediately retrying a timed-out payment POST safe?
Show the solution and explanation
Unknown outcome → reconcile / idempotency contractNot by default; the first payment may have succeeded. Use an explicit retry contract and queryable operation identity.