HTTP methods are commands that tell a server what to do with a request. They define how data is fetched, sent, or updated on the server.
Overview
What are HTTP Methods?
HTTP methods define how a client communicates with a server to perform specific actions on a resource. They tell the server what kind of operation the client wants, such as retrieving, creating, updating, or deleting data.
Difference Between GET, POST, and PUSH
Here are the key differences between GET, POST, and PUSH HTTP methods.
Method | Purpose | Safe | Idempotent | Changes Data |
---|---|---|---|---|
GET | Retrieve data | Yes | Yes | No |
POST | Add or submit data | No | No | Yes |
PUSH | Update or sync data (mainly in WebDAV or APIs) | No | Yes | Yes |
This article compares GET, POST, and PUSH to show how each handles requests.
What Are HTTP Methods?
HTTP methods are instructions that a client sends to a server to specify what action to take on a resource. They define how data is requested or changed on the server.
Each method has a clear purpose and is used for particular tasks when working with web APIs or websites. For example:
- GET requests data from the server.
- POST submits new data to the server.
- PUT updates existing data on the server.
GET Method
GET is an HTTP method used to request data from a server. It asks the server to return a specific resource without changing it. When a client sends a GET request, it expects the server to respond with data such as a web page, JSON, or an image. GET requests are read-only and should not cause side effects on the server.
When to Use the GET HTTP Method?
Use GET to retrieve data from the server without modifying any resource. It is suitable for operations like:
- Loading a web page
- Fetching a list of products
- Getting user profile information
- Downloading a file
GET requests are also cacheable and can be bookmarked or shared because the request parameters appear in the URL.
Response Codes for GET
- 200 OK: The data was retrieved successfully
- 304 Not Modified: The cached version is still valid
- 404 Not Found: The requested resource does not exist
- 401 Unauthorized: Authentication is required
Example of the GET Method
The client asks the server to return data without changing anything. Here’s how that request and response look.
GET Request
GET /users/42 HTTP/1.1 Host: api.example.com Authorization: Bearer abc123token
GET Response
HTTP/1.1 200 OK Content-Type: application/json { "id": 42, "name": "Jane Doe", "email": "jane@example.com" }
200 OK means the server found the resource and returned the data successfully.
POST Method
POST is an HTTP method that sends data to a server to create a new resource. The data is sent in the request body. The server processes this data and usually returns confirmation or details about the newly created resource.
When to Use the POST HTTP Method?
Use POST when you want to:
- Create a new user account
- Submit a form
- Upload a file
- Post a comment or message
POST requests are not cacheable and do not appear in the URL, so they are more secure for sending sensitive data.
Response Codes for POST
- 201 Created: The resource was created successfully
- 200 OK: The request was successful, and the server returned data
- 400 Bad Request: The data was invalid
- 401 Unauthorized: Authentication is required
Example of POST Requests
The client sends data to the server to create a new resource. Here’s how that request and response look.
POST Request
POST /users HTTP/1.1 Host: api.example.com Authorization: Bearer abc123token Content-Type: application/json { "name": "John Smith", "email": "john@example.com" }
POST Response
HTTP/1.1 201 Created Content-Type: application/json { "id": 43, "name": "John Smith", "email": "john@example.com" }
201 Created means the server successfully created the new resource.
PUSH Method
PUSH is not a standard HTTP method like GET or POST. It usually refers to the HTTP/2 server push feature or custom implementations where the server proactively sends resources to the client without the client explicitly requesting them. Some systems or APIs may define a custom PUSH method to update resources or deliver real-time data.
When to Use the PUSH HTTP Method?
Use PUSH in cases where:
- The server needs to send resources or updates to the client before the client asks for them
- A custom API defines PUSH for real-time updates
- HTTP/2 server push is used to improve page load by sending resources early
Response Codes for PUSH
If using custom PUSH methods:
- 200 OK: The push was accepted
- 202 Accepted: The push was accepted for processing
- 400 Bad Request: The push request was invalid
- 401 Unauthorized: Authentication is required
Example of PUSH Requests
The client sends a push update to the server in a system that supports a custom PUSH method. Here’s how that request and response look.
PUSH Request
PUSH /updates HTTP/1.1 Host: api.example.com Authorization: Bearer abc123token Content-Type: application/json { "message": "New content is available", "priority": "high", "timestamp": "2025-06-20T10:30:00Z" }
PUSH Response
HTTP/1.1 200 OK Content-Type: application/json { "status": "update delivered", "receivedAt": "2025-06-20T10:30:01Z" }
200 OK means the server accepted and handled the push update.
GET vs. POST vs. PUSH: Key Differences
Each of these methods serves a different role when working with HTTP requests. Below is a detailed comparison so you can see how they differ in purpose, behavior, and usage across real-world applications.
Feature | GET | POST | PUSH |
---|---|---|---|
Purpose | Retrieve data without changes | Send data to create a resource | Send or trigger updates (custom) |
Request body allowed | No | Yes | Yes |
Data in URL | Yes (query parameters) | No | Rare (custom use) |
Cacheable | Yes | No | No |
Idempotent | Yes | No | Usually no |
Safe method | Yes (does not change state) | No (creates new data) | No |
Visible in browser history | Yes | No | No |
Bookmarkable | Yes | No | No |
Common status codes | 200, 304, 404, 401 | 201, 200, 400, 401, 500 | 200, 202, 400, 401 |
Typical use cases | Fetch resources, load pages | Submit forms, create records | Push updates, trigger events |
Appears in logs | Full URL visible | The body may not appear in logs | Depends on implementation |
Used in REST APIs | Yes | Yes | Rare (usually custom or HTTP/2) |
Supported in the HTTP spec | Yes | Yes | No (custom or HTTP/2 server push) |
How Requestly Supports GET, POST, and PUSH Testing
Requestly gives you control over how GET, POST, and PUSH requests behave so you can test APIs without changing any backend code. You can create rules that intercept and change HTTP methods, headers, URLs, or responses to see how your server or app handles different scenarios.
Here is how you can use it during testing:
- Change a GET to a POST or another method to see how your server responds to unexpected methods.
- Adjust headers to check how authentication, caching, or content types affect the response.
- Redirect GET or POST requests to mock APIs or alternate endpoints for safe testing.
- Add delays or inject errors to see how your app handles timeouts or failures.
- Set up repeatable rules so you can run tests consistently without manual effort.
Conclusion
GET, POST, and PUSH each serve a specific role in how clients and servers exchange data. Testing these methods under real conditions helps you catch issues early and ensure your app handles requests as expected. Requestly enables you to modify requests, simulate different scenarios, and verify that your app handles each method correctly without changing backend code.