Every time you open a web page, submit a form, scroll through a feed or tap a button in a mobile app, your device is sending HTTP requests to a server. These requests use HTTP methods (also called HTTP verbs) to tell the server exactly what kind of action you want to perform — read data, create something new, update it or delete it.
Understanding HTTP methods is fundamental to web development. Whether you are building a frontend that fetches data from an API, designing a REST API on the backend, or debugging network requests in DevTools — you need to know these methods inside and out. This guide covers all of them simply, with real examples you can use immediately.
What Is HTTP
HTTP stands for HyperText Transfer Protocol. It is the language that web browsers and servers use to communicate. When you type a URL into your browser and press Enter, your browser sends an HTTP request to a server. The server processes the request and sends back an HTTP response with the data (an HTML page, JSON data, an image, etc.).
Think of HTTP like ordering at a restaurant. You (the client) tell the waiter (HTTP) what you want, the waiter takes your order to the kitchen (the server), and the kitchen sends back your food (the response). The HTTP method is the type of action — are you ordering something new, asking to see the menu, changing your order, or cancelling it?
HTTP is stateless — the server does not remember previous requests. Each request is completely independent. This is why cookies, tokens and sessions exist — to carry state between requests.
Anatomy of an HTTP Request
Every HTTP request has the same basic structure. Understanding this structure helps you work with any API or debug any network issue.
GET — Read Data
The GET method is used to retrieve data from a server. It is the most common HTTP method — every time you load a web page, your browser sends a GET request. GET requests should never change data on the server. They are safe (no side effects) and idempotent (calling it once or 100 times gives the same result).
Query Parameters — Filter and Search
GET requests often include query parameters in the URL to filter, sort or paginate results. These come after a ? and are separated by &.
POST — Create New Data
The POST method is used to create new resources on the server. When you submit a registration form, upload a file, or add a new item to a shopping cart — that is a POST request. POST is not idempotent — sending the same POST twice will typically create two separate resources.
The Request Body
POST requests carry data in the request body, not in the URL. The most common format is JSON, but you can also send form data, files (multipart/form-data), or plain text. The Content-Type header tells the server what format the body is in.
PUT — Replace Entire Resource
The PUT method replaces the entire resource at the given URL with the data you send. If the resource does not exist, some APIs will create it. PUT is idempotent — sending the same PUT request 10 times has the same effect as sending it once (the resource ends up in the same state).
The key difference from POST: PUT targets a specific resource by its ID, while POST targets a collection to create a new item.
PATCH — Partial Update
The PATCH method applies a partial update to a resource. Unlike PUT, you only send the fields you want to change. All other fields remain unchanged. This is often more practical than PUT in real-world applications.
PUT vs PATCH — When to Use Each
PATCH = "Here are just the changes I want to make. Keep everything else."
In practice, most APIs use PATCH for updates because it is simpler and less error-prone. PUT is used when you need to guarantee the exact state of the full resource.
DELETE — Remove a Resource
The DELETE method removes a resource from the server. It is idempotent — deleting the same resource twice should give the same end result (the resource is gone). The second request might return a 404 (not found) since it is already deleted, but the state of the server is the same.
HEAD & OPTIONS — The Utility Methods
HEAD is identical to GET but the server only returns headers, not the body. It is useful for checking if a resource exists, getting its size, or checking when it was last modified — without downloading the full content.
OPTIONS asks the server what methods and headers are allowed for a resource. Browsers send OPTIONS requests automatically before cross-origin requests (called a "preflight request" in CORS).
Idempotency & Safety
Two important concepts help you understand how HTTP methods should behave:
Safe — the method does not modify the resource. It only reads data. GET, HEAD and OPTIONS are safe methods.
Idempotent — calling the method multiple times has the same effect as calling it once. GET, PUT, DELETE, HEAD and OPTIONS are idempotent. POST and PATCH are generally not idempotent.
Common Status Codes
Every HTTP response includes a status code — a 3-digit number that tells the client what happened. Here are the ones you will see most often:
| Code | Name | Meaning | Common With |
|---|---|---|---|
| 200 | OK | Request succeeded | GET, PUT, PATCH, DELETE |
| 201 | Created | New resource was created | POST |
| 204 | No Content | Success but no body in response | DELETE |
| 301 | Moved Permanently | Resource has a new URL | GET |
| 400 | Bad Request | Invalid data sent by client | POST, PUT, PATCH |
| 401 | Unauthorized | Authentication required | All |
| 403 | Forbidden | Authenticated but no permission | All |
| 404 | Not Found | Resource does not exist | GET, PUT, DELETE |
| 409 | Conflict | Conflict with current state | POST, PUT |
| 500 | Internal Server Error | Server crashed or had a bug | All |
REST API Patterns
REST (Representational State Transfer) is the most common way to design APIs. REST APIs map HTTP methods to CRUD operations on resources. Here is the standard pattern:
Quick Reference
| Method | Purpose | Has Body | Idempotent | Safe |
|---|---|---|---|---|
| GET | Read / retrieve data | No | Yes | Yes |
| POST | Create new resource | Yes | No | No |
| PUT | Replace entire resource | Yes | Yes | No |
| PATCH | Partial update | Yes | No | No |
| DELETE | Remove resource | Optional | Yes | No |
| HEAD | Get headers only | No | Yes | Yes |
| OPTIONS | Check allowed methods | No | Yes | Yes |
- GET retrieves data without modifying anything. It is safe, idempotent and the most common HTTP method. Data is sent via URL query parameters, never in the body.
- POST creates new resources. Data goes in the request body (usually JSON). It is not idempotent — sending the same POST twice can create duplicates.
- PUT replaces an entire resource at a specific URL. You must send all fields — missing fields may be deleted. It is idempotent.
- PATCH applies a partial update — send only the fields you want to change. In practice, PATCH is used more often than PUT for updates.
- DELETE removes a resource. It is idempotent — deleting something twice has the same end result.
- HEAD is like GET but returns only headers (no body). Useful for checking if a resource exists or how large it is.
- OPTIONS checks what methods and headers a server allows. Browsers send it automatically for CORS preflight checks.
- Idempotency means calling a method multiple times has the same effect as calling it once. This matters for retry logic — you can safely retry GET, PUT and DELETE but not POST.
- REST APIs map HTTP methods to CRUD: GET = Read, POST = Create, PUT/PATCH = Update, DELETE = Delete. Use nouns for URLs, proper status codes, and keep endpoints predictable.
