Most people assume the choice between HTTP methods is a matter of preference. It is not. Each method carries a contract that clients, servers and proxies rely on, and the common belief that GET and POST are interchangeable is the single biggest source of broken APIs.
REST APIs use five core HTTP methods: GET reads data, POST creates it, PUT replaces it, PATCH updates part of it, and DELETE removes it. Use them according to what changes on the server, not according to how the client happens to talk to it.
The Five Core Methods and What Each Contract Says
Think of each method as a promise. A GET request promises no change to server state. A POST request says "add something new." PUT says "make the resource look exactly like this, replace it entirely." PATCH says "change only these parts." DELETE says "remove it."
| Method | Job | Changes server? | Safe to repeat? | Request body |
|---|---|---|---|---|
| GET | Read | No | Yes (idempotent) | None |
| POST | Create | Yes | No | Required |
| PUT | Replace | Yes | Yes (idempotent) | Required |
| PATCH | Partial update | Yes | Not guaranteed | Required |
| DELETE | Remove | Yes | Yes (idempotent) | Usually none |
GET Asks, POST Tells
GET is for retrieving a representation of a resource, and it must never change state. Clients, browsers and caches all assume a GET can be repeated freely. If your GET endpoint creates an order or writes a log entry, a retried request can quietly duplicate work. POST is the correct method whenever the server will do something new. A POST to a collection creates a member, so sending it twice typically makes two members.
PUT Replaces, PATCH Adjusts
PUT sends the full representation of a resource. If you send only one field with PUT, every other field is expected to be overwritten or cleared. PATCH sends only the fields that change. This matters for collaborators: two people editing different fields of the same record can both use PATCH and keep each other's work. With PUT they would overwrite one another.
DELETE Is Idempotent, Not Reversible
DELETE removes a resource. Repeating DELETE returns an error the second time, usually 404, but the outcome is the same: the resource is gone. Idempotent means the repeated result matches the first result from the server's point of view, not that every request returns 200.
The Safe-and-Idempotent Split Does the Real Work
Two words describe the contracts, and both are worth memorising.
- Safe means the request does not change server state. Only GET and HEAD are safe among the common methods.
- Idempotent means the same request sent many times has the same effect as sending it once. GET, PUT and DELETE are idempotent. POST is not.
This is why a browser can refresh a GET page without warning but suggests a resubmit when you refresh after a POST. The browser is protecting you from a duplicate side effect. Caches also treat safe methods differently from unsafe ones, which is why a broken GET route can still leak stale data for minutes.
Choosing the Right Method for Common Cases
Match the intent of the request to the method. These cases cover most everyday design decisions.
- Fetch a list of orders. Use GET on the orders collection. Return 200 with an array, and allow filters as query parameters.
- Create an order. Use POST to the collection. Return 201 with a Location header pointing to the new resource.
- Show one order. Use GET on the item path with its identifier. Return 404 if it does not exist.
- Replace an order's details. Use PUT on the item path, sending the whole representation.
- Change only the shipping address. Use PATCH with a small body containing that field.
- Cancel an order. If cancellation is a state change on a resource, PATCH the status field. Do not expose it as DELETE unless the record should actually disappear.
- Remove an order. Use DELETE on the item path. Return 204 if there is nothing to send back.
A simple test works before you write any code. Ask what happens when the same request arrives twice. No harm and same outcome: GET, PUT or DELETE fit. Something new happens each time: POST is the honest choice.
Status Codes That Keep Your Methods Honest
Methods and response codes tell one story together. If the method is correct but the code contradicts it, clients misbehave.
- GET returns 200 with the entity, or 404 when missing.
- POST returns 201 with a new resource, or 200 if it returns the created object without a new URL.
- PUT returns 200 or 204. Some designs return 201 when the PUT created a resource that did not exist.
- PATCH returns 200 with the updated entity or 204 with nothing.
- DELETE returns 204, or 200 with a confirmation body.
- Validation failures return 400 or 422, and wrong credentials return 401.
Keep statuses consistent across the whole API. A client that learns 201 means "created" on one resource will break when another resource answers with 200 and no Location header.
PUT Overwrite Mistakes and PATCH Partial Updates
The classic PUT mistake is sending a partial body and letting the server merge it. That turns PUT into PATCH behind the client's back, and a client that expects replacement cannot trust the result. The fix is to reject partial PUT bodies with 400, or to document the merge clearly and use PATCH where partial updates are intended.
For PATCH, use a predictable patch format. A plain JSON object of changed fields is easiest to read. Send only the keys that changed, and let unchanged keys, including empty strings and explicit nulls, mean what you document. Decide once whether null clears a field or is rejected, then apply that rule everywhere.
Concurrency matters here. Include a version or updated-at value with the resource, and require the client to send it with PUT or PATCH. If another change landed in the meantime, return 409 or 412 and let the client refresh rather than silently overwriting someone else's edit.
Less Common Methods Worth Knowing
A few extra verbs appear in real APIs and are easy to recognise without using them yourself.
HEAD and OPTIONS
HEAD works like GET but returns only headers, which is useful for checking size or existence. OPTIONS describes what a resource allows and is part of cross-origin request handling. Both are safe.
When a Method Is Overloaded
Some environments allow only GET and POST. In that case, encode the intended action in the path or a field, such as a cancel route on a POST, and document it plainly. The contract still holds even when the label does not.
API Method Questions That Come Up Often
Should GET ever have a request body?
No. Request bodies with GET are ambiguous and some clients and proxies drop them. Put filters and pagination in query parameters instead.
Is POST ever idempotent in practice?
Not by contract. You can make a POST effectively safe by having the client send a unique key, such as an idempotency key, and by having the server reject or return the earlier result for that key. The method stays unsafe; the server adds the protection.
Should DELETE remove the record or mark it inactive?
DECIDE FROM THE BUSINESS RULE, NOT THE METHOD NAME. If the data must be recoverable or audited, PATCH a status field such as archived and keep DELETE for true removal. Document which one the endpoint does so clients do not assume the opposite.
What does idempotent mean for a client that times out?
If a request times out, retrying a GET, PUT or DELETE is generally safe because the final state matches. Retrying a POST can create a duplicate, so retry only when the server supports a request key or reports that nothing was created.