When you interact with any website or application — logging in, submitting a form, searching for products, uploading files — your browser communicates with a server using HTTP request methods. These are also known as HTTP verbs, and they define what action the client wants the server to perform.
Understanding HTTP request methods is essential for developers, testers, backend engineers, and anyone building APIs.
This blog explains each method in detail, with real examples, diagrams, and best practices.
What Are HTTP Request Methods?
HTTP (Hypertext Transfer Protocol) is the foundation of data communication on the web.
When a client (browser/app) communicates with a server, it sends an HTTP request that includes:
- Method (GET, POST, PUT, DELETE, etc.)
- URL
- Headers
- Body (optional)
- Cookies or tokens (for authentication)
The request method tells the server what operation to perform.
List of Common HTTP Methods
| Method | Meaning | Body Allowed? | Safe? | Idempotent? | Typical Use |
|---|---|---|---|---|---|
| GET | Fetch data | No | Yes | Yes | Reading resources |
| POST | Create new data | Yes | No | No | Form submission, login |
| PUT | Update/replace data | Yes | No | Yes | Updating resources |
| PATCH | Partially update data | Yes | No | No | Minor updates |
| DELETE | Remove data | No (sometimes yes) | No | Yes | Delete items |
| HEAD | Fetch headers only | No | Yes | Yes | Check if resource exists |
| OPTIONS | Get supported methods | No | Yes | Yes | Preflight CORS |
| TRACE | Debug request | No | Yes | Yes | Loopback testing |
1. GET – Retrieve Data (Safe & Idempotent)
The GET method is used to fetch data from the server.
It should not change any data on the server.
Example: Fetch user details
GET /api/users/10 HTTP/1.1
Host: example.com
Browser Example
https://example.com/products?category=mobiles
Response
{
"id": 10,
"name": "Amit",
"email": "amit@example.com"
}
When to Use GET
- Reading data
- Searching
- Loading web pages
- Fetching lists (products, posts, videos)
2. POST – Create Data (Not Idempotent)
POST sends data to the server and usually creates a new resource.
Example: Register a new user
POST /api/users HTTP/1.1
Content-Type: application/json
Body:
{
"name": "Riya",
"email": "riya@example.com",
"password": "12345"
}
Response:
{
"id": 101,
"message": "User created"
}
When to Use POST
- User sign-up
- Login
- File uploads
- Creating blog posts
- Submitting forms
3. PUT – Replace Entire Resource (Idempotent)
PUT is used to update or replace the entire resource.
Example: Update a user profile
PUT /api/users/10
Content-Type: application/json
Body:
{
"name": "Amit S",
"email": "amit@example.com",
"password": "newpassword"
}
This replaces all fields for user 10.
When to Use PUT
- Updating user profile
- Replacing a configuration
- Updating entire resource in APIs
4. PATCH – Update Part of a Resource
PATCH is used for partial updates.
Example: Update only user email
PATCH /api/users/10
Content-Type: application/json
Body:
{
"email": "newemail@example.com"
}
When to Use PATCH
- Updating one or two fields
- Changing only specific data without overwriting others
5. DELETE – Remove a Resource
Deletes the specified resource from the server.
Example: Delete a product
DELETE /api/products/22
Response:
{
"message": "Product deleted"
}
When to Use DELETE
- Deleting user accounts
- Removing cart items
- Deleting posts/photos
6. HEAD – Get Headers Only (No Body)
HEAD works like GET but returns only the headers, not the body.
Example: Check file exists before downloading
HEAD /downloads/guide.pdf
Use Cases
- Validate URL
- Check if resource updated (via
Last-Modified) - Improve performance (no body download)
7. OPTIONS – Check Available Methods
Used to identify which HTTP methods are supported by a resource.
Example:
OPTIONS /api/users
Response:
Allow: GET, POST, PUT, PATCH, DELETE
Use Cases
- CORS preflight checks
- API documentation
8. TRACE – Debugging Tool
Returns the request exactly as the server received it.
Example:
TRACE /api/check
Use Cases
- Debug proxy issues
(Not recommended in production — security risk)
Real-World Example: CRUD Operations with HTTP Methods
| Action | HTTP Method | Example |
|---|---|---|
| Create user | POST | /api/users |
| Read user | GET | /api/users/5 |
| Update full user | PUT | /api/users/5 |
| Update user email | PATCH | /api/users/5 |
| Delete user | DELETE | /api/users/5 |
Best Practices for HTTP Request Methods
✔ Use correct HTTP verbs
APIs become predictable and developer-friendly.
✔ Don’t send sensitive data in GET URLs
Use POST for login, OTP, passwords.
✔ PUT & DELETE must be idempotent
Calling them multiple times shouldn’t create duplicates.
✔ Cache only safe methods
GET is safe to cache — not POST.
✔ Use proper status codes
- 200 OK
- 201 Created
- 400 Bad Request
- 401 Unauthorized
- 404 Not Found
- 500 Server Error
Conclusion
HTTP request methods are the backbone of all web communication.
Understanding them — particularly GET, POST, PUT, PATCH, and DELETE — helps you build cleaner APIs, secure applications, and scalable systems.
Mastering them is essential whether you’re a backend developer, frontend engineer, tester, or student.

