How to Choose the Right HTTP Methods for API Actions: GET, POST, PUT, PATCH, and DELETE Explained

How to Choose the Right HTTP Methods for API Actions: GET, POST, PUT, PATCH, and DELETE Explained

One of the questions I get asked most often by developers new to API design is: “How do I know which HTTP method to use?” It seems simple at first, but once you get into real-world scenarios like partial updates, bulk actions, or non-CRUD operations, it gets trickier. In this article, I am going to break down every common HTTP method, explain exactly when I use each one, and cover the edge cases that trip most people up.

Why HTTP Methods Matter So Much

HTTP methods are not just labels. They carry real meaning that both humans and machines rely on:

Choosing the wrong method breaks these assumptions and creates confusing, unpredictable behavior.

GET: Retrieve Data, Never Change It

I use GET whenever I want to read data, and never for anything that changes state on the server.

GET /users/45
GET /orders?status=shipped

Key properties of GET that I always respect:

I never accept a request body with GET. If I need to pass complex filtering criteria, I use query parameters, and if the filtering criteria is too large or complex for a query string, I create a dedicated search endpoint using POST instead (more on that below).

POST: Create a New Resource or Trigger an Action

I use POST in two main situations:

1. Creating a New Resource

POST /orders
Content-Type: application/json

{
  "customerId": 45,
  "items": [{ "productId": 12, "quantity": 2 }]
}

The server typically responds with a 201 Created status and a Location header pointing to the new resource.

2. Triggering an Action That Doesn’t Fit Other Methods

Sometimes an operation is not a simple create, update, or delete. For example, sending an email, processing a payment, or running a search with a complex body. In these cases, I still use POST, treating the action as its own sub-resource:

POST /orders/901/cancellation
POST /reports/generate

Key properties of POST:

PUT: Replace a Resource Completely

I use PUT when I want to replace an entire resource with a new version. The client must send the complete representation of the resource, not just the fields that changed.

PUT /users/45
Content-Type: application/json

{
  "firstName": "Ayesha",
  "lastName": "Khan",
  "email": "ayesha@example.com",
  "accountStatus": "active"
}

If the client leaves out a field, I treat that as intentionally clearing it, because PUT means “this is now the full state of the resource.”

Key properties of PUT:

PATCH: Update Part of a Resource

I use PATCH when the client only wants to change some fields, not the entire resource.

PATCH /users/45
Content-Type: application/json

{
  "email": "ayesha.khan@example.com"
}

This only updates the email field and leaves everything else untouched. This is the method I reach for most often in real applications, because clients rarely have the full resource state on hand and usually just want to update one or two fields.

Key properties of PATCH:

[
  { "op": "replace", "path": "/email", "value": "ayesha.khan@example.com" }
]

I usually go with the simpler merge-patch style unless the API genuinely needs precise, operation-based patching (for example, array manipulation).

DELETE: Remove a Resource

I use DELETE when the client wants to remove a resource entirely.

DELETE /orders/901

Key properties of DELETE:

For resources I don’t want removed instantly (for example, user accounts), I often implement a soft delete — the record is marked as deleted internally, but I still use DELETE as the public-facing method, because that is what best represents the client’s intent.

HEAD and OPTIONS: The Lesser-Known Methods

I don’t use these every day, but they are worth understanding:

A Quick Decision Table I Use

I want to…Method
Read a resource or collectionGET
Create a new resourcePOST
Replace an entire resourcePUT
Update part of a resourcePATCH
Remove a resourceDELETE
Trigger an action with no clean nounPOST (as a sub-resource)
Check if a resource exists, headers onlyHEAD
Discover allowed methodsOPTIONS

Common Mistakes I See (and Used to Make Myself)

Final Thoughts

Choosing the right HTTP method is about respecting the meaning that is already built into the protocol. When I use GET, POST, PUT, PATCH, and DELETE the way they are meant to be used, my API becomes predictable, cacheable where it should be, and safe to retry where it needs to be — all without extra documentation.

Exit mobile version