GET /products/sku_123GET is safe and should not mutate state. It is commonly cacheable and bookmarkable.
HTTP methods, safe vs unsafe semantics, and idempotency examples for API consumers and designers.
Map the method to the expected behavior.
GET /products/sku_123GET is safe and should not mutate state. It is commonly cacheable and bookmarkable.
Submit a new resource or command-like workflow.
POST /ordersPOST is not inherently idempotent. Repeating the same request may create duplicates unless you add idempotency controls.
PUT /profiles/123PUT is generally idempotent: sending the same representation repeatedly should lead to the same final state.
PATCH /profiles/123PATCH may or may not be idempotent depending on the patch format and operation design.
DELETE /profiles/123DELETE is commonly designed to be idempotent: deleting an already-deleted resource should not keep changing state.
HEAD /reports/monthly.pdfHEAD can be useful for existence checks, cache validation, or content-length inspection.
Inspect available methods or CORS capabilities.
OPTIONS /usersOPTIONS is often used by browsers for CORS preflight requests and by tooling to inspect server capabilities.
Protect writes from accidental duplication.
Deduplicate retryable create requests.
POST /payments
Idempotency-Key: 8f3dc9d4-7d3e-4c66-9f44-7d85f0f86dd1This pattern helps clients safely retry network-failed POST requests without creating duplicate side effects.
PUT /devices/device_123When the client supplies the stable identifier, repeated PUT requests can converge on the same final state.
{
"display_name": "Jane Smith",
"timezone": "America/Los_Angeles"
}Field assignment patches are easier to reason about than increment-style or append-style patches when idempotency matters.
Do not track writes in the same endpoint contract.
Avoid: GET /posts/123/mark-readA GET endpoint should not change business state. Use a dedicated write route if you need to record events or acknowledgements.