HTTP Methods: GET, POST, PUT, PATCH, DELETE and HEAD

GET retrieves a representation and should not intentionally change server state. POST commonly creates a subordinate resource or triggers a server-side operation. PUT replaces the representation of a resource at a known URI and is intended to be idempotent. PATCH applies partial modifications. DELETE removes a resource and is also intended to be idempotent.

HEAD is similar to GET but asks for response headers without the response body. It is useful for checking existence, metadata, content length, or cache information.

Do not select methods simply because they sound convenient. Method semantics affect caching, retries, proxies, client behavior, and API correctness.

HTTP Method Semantics

GET

Retrieve

Safe and idempotent.

POST

Create/process

Usually not idempotent.

PUT

Replace

Idempotent when designed correctly.

PATCH

Partially modify

Used for partial updates.

DELETE

Remove

Idempotent semantics are expected.

HEAD

Retrieve metadata

Returns headers without a response body.

Knowledge Check

Which HTTP method is generally intended to be idempotent and replace a resource representation?