Skip to content

HTTP Method

An HTTP method communicates the intended action of a request, such as retrieving, creating, updating, or deleting information.

An HTTP method describes the intended action of an HTTP request.

APIs commonly use these methods to distinguish between retrieving, creating, updating, and deleting information.

MDN's HTTP method reference documents the standard semantics for methods such as GET, POST, PUT, PATCH, and DELETE.

Common HTTP Methods

### GET

Retrieves information.

Example:

GET /products

might return a list of products.

### POST

Submits information, commonly to create something or trigger an action.

Example:

POST /orders

might create a new order.

### PUT

Commonly replaces the complete representation of an existing resource.

### PATCH

Commonly applies a partial update.

### DELETE

Requests removal of a resource.

Why the Method Matters

The URL alone may not describe the operation.

For example:

GET /customers/123
DELETE /customers/123

refer to the same resource but request completely different actions.

The HTTP Method and API Endpoint work together.

Safe and Idempotent Methods

HTTP methods have defined behaviour beyond their names.

For example, MDN describes GET as a safe and idempotent retrieval method, while repeated identical POST requests may create repeated effects. MDN's GET method documentation MDN's POST method documentation

This distinction becomes important for Idempotency and retry behaviour.

Common Problems

Common problems include:

  • Using POST for every operation
  • Retrying POST requests without protection
  • Using GET for actions that change data
  • Assuming PUT and PATCH mean the same thing
  • Integrations depending on non-standard method behaviour

How to Improve

Follow the API's documented operation rather than guessing based on the endpoint name.

When designing APIs, use HTTP methods consistently enough that developers can predict the intent of a request.