HTTP

Glossary Term

HTTP Method

Learn what HTTP methods are and how they define actions on resources. Understand GET, POST, PUT, DELETE, PATCH, and other methods with examples.

2 min read beginner

TL;DR: The HTTP method is the verb of the request. It tells the server whether you are reading, creating, replacing, updating, or deleting something.

An HTTP method is the part of the request that expresses intent. The path tells the server which resource you mean. The method tells it what kind of operation you want to perform on that resource.

Why Method Choice Matters

Developers often treat methods as syntax, but clients and infrastructure treat them as semantics.

Choosing the method affects:

  • whether a request is safe to retry
  • whether caches may reuse a response
  • whether browser behavior feels natural
  • whether another developer can understand your API without reading custom docs

That is why POST is not just “the one that has a body” and GET is not just “the one browsers use.”

The Methods Most Developers Meet First

  • GET: read a resource
  • POST: create something new or trigger processing
  • PUT: replace a resource completely
  • PATCH: update part of a resource
  • DELETE: remove a resource

And a few that matter in debugging and infrastructure:

  • HEAD: like GET, but without the body
  • OPTIONS: ask what is allowed, often seen in CORS flows

A Simple Example

These paths could all target the same user resource:

GET /users/42
PATCH /users/42
DELETE /users/42

The URL stays the same. The method changes the meaning completely.

Safe And Idempotent Are Different

Two terms come up constantly with methods:

  • safe: the request should not change server state as part of normal use
  • idempotent: repeating the same request should leave the same final state

Examples:

  • GET is safe and idempotent
  • PUT is not safe, but is idempotent
  • POST is usually neither

That distinction matters when a client times out and needs to decide whether it can retry automatically.

The Common Real-World Mistake

The most common API mistake is using POST for every write because it feels flexible. That works technically, but it hides intent. A more specific method usually gives better defaults for retries, caching expectations, and team understanding.

Related terms: HTTP Request, HTTP Response, Idempotent

Frequently Asked Questions

What is an HTTP method?

An HTTP method is the action a client wants to perform on a resource. Common methods include GET, POST, PUT, PATCH, and DELETE.

What is the difference between GET and POST?

GET is for retrieving data without changing server state. POST sends data for creation or processing and usually has side effects.

What does idempotent mean for methods?

Idempotent methods reach the same final state when repeated. GET, PUT, and DELETE are idempotent by design; POST is not.

What is a safe method?

A safe method should not change server state as part of normal use. GET, HEAD, and OPTIONS are the main safe methods.

Keep Learning