termEngineering & architecture

HTTP Method

The request token that states the intended operation on an HTTP resource and carries standardized safety, idempotency, and caching semantics.

Download Markdown (.md)

01What it means

An HTTP method identifies the purpose of a request. Standard methods include GET for retrieval, POST for resource-specific processing, PUT for replacing state, PATCH for partial modification, and DELETE for removal. Their meanings include properties such as safety and idempotency; they are not merely CRUD labels.[1][2]

Request intent plus protocol properties Choose a method by standardized semantics—not a mechanical CRUD mapping
MethodPrimary intentProtocol property
GETRetrieve a representationSafe; idempotent; cacheable by definition
POSTResource-specific processingNot inherently idempotent
PUTCreate or replace target stateIdempotent
PATCHApply partial modificationNot inherently idempotent
DELETERemove target associationIdempotent semantics

Safety, idempotency, cacheability, preconditions, side effects, authorization, and retry behavior must agree with the operation.

02Why it matters

Clients, servers, caches, crawlers, retry mechanisms, and security controls make decisions from method semantics. Choosing accurately makes an interface more predictable and reduces unintended changes, duplicate effects, and broken caching.

03When to use it

Select a standard method whenever an HTTP interaction fits its defined semantics. Define or use extensions only when standard methods cannot express the operation and every relevant participant can understand the new method.

04How it works

  1. Identify whether the operation retrieves state, changes it, or asks a resource to process submitted content.
  2. Choose the standard method whose defined semantics match that intent.
  3. Determine whether the operation is safe, idempotent, and cacheable and design side effects accordingly.
  4. Specify accepted content, preconditions, authorization, successful responses, and failures.
  5. Test behavior through clients, retries, caches, gateways, and access controls rather than testing routing alone.

05A practical example

Example

A document API uses GET to retrieve a document and PUT to replace it at a known URL. If a client loses the PUT response, it can repeat the same request without intending an additional change, while a POST that creates a new document needs an idempotency strategy before automatic retry.

06Where it breaks

A method communicates protocol intent but cannot guarantee that an implementation honors it. Applications may need domain-specific operations that map imperfectly to CRUD, and idempotent protocol semantics do not eliminate concurrent-update or duplicate-request concerns.

Common mistakes

  • Using GET for an operation that changes state, making crawlers and retries unsafe.
  • Assuming POST always means create or PUT always means update without reading their actual semantics.
  • Confusing idempotent with having no side effects or always returning the same response.
  • Returning success for methods an endpoint does not actually support.

07Sources

  1. HTTP Semantics: MethodsRFC Editor · Internet StandardHTTP Semantics: Methods
  2. HTTP Request MethodsMDN Web Docs · Official technical documentationHTTP Request Methods
View saved topics

Start typing to search titles, definitions, categories, and frameworks.