← Learn

HTTP FIELD GUIDE

HTTP methods and idempotency

Choose the right HTTP method and understand when repeating a request is safe.

What does the method say?

The method describes the intended action. GET retrieves a representation and HEAD retrieves only its metadata. POST submits data for processing; PUT replaces a resource, while DELETE asks the server to remove it. A server may reject a method with 405, even when the method exists in HTTP.

Safe is not the same as idempotent

A safe method is intended to be read-only. An idempotent method has the same intended server effect when repeated. GET and HEAD are both safe and idempotent. PUT and DELETE are idempotent by definition, although their responses can differ across attempts. POST is not generally idempotent.

Why does this matter?

A network timeout does not reveal whether the server handled the request. Repeating a POST can create duplicate work, such as two orders. For a retryable write, use an API-supported idempotency key or check the resource state first. A method name alone does not guarantee a correctly implemented server.

References