HTTP Request Methods Explained - GET/POST/PUT/DELETE/PATCH Comparison
Purpose and differences of GET / POST / PUT / PATCH / DELETE
| Method | Common use | Safe | Idempotent | Request body |
|---|---|---|---|---|
| GET | Retrieve a resource | Yes | Yes | Usually none |
| POST | Create resource / submit data | No | No | Usually yes |
| PUT | Replace a resource entirely | No | Yes | Usually yes |
| PATCH | Partially update a resource | No | No | Usually yes |
| DELETE | Delete a resource | No | Yes | Usually none |
| HEAD | Fetch response headers only | Yes | Yes | None |
| OPTIONS | Query server capabilities / CORS preflight | Yes | Yes | Usually none |
| TRACE | Diagnostic request echo | Yes | Yes | None |
| CONNECT | Establish a tunnel | No | No | None |
GET
Retrieves a resource without changing server state; parameters usually go in the URL query string.
GET /api/users?page=1POST
Submits a form, creates a resource or performs a non-idempotent action; the body is often JSON, a form or a file.
POST /api/usersPUT
Replaces a resource as a whole; submitting the same content multiple times should give the same result.
PUT /api/users/1001PATCH
Updates part of a resource’s fields; whether it is idempotent depends on the API design.
PATCH /api/users/1001DELETE
Deletes the specified resource; deleting the same resource multiple times usually gives the same result.
DELETE /api/users/1001HEAD
Like GET but returns only the response headers, often used to check resource existence or get a file size.
HEAD /download/file.zipOPTIONS
Queries the methods the server supports and is also commonly used for browser cross-origin preflight requests.
OPTIONS /api/usersTRACE
Echoes the request path back; usually disabled in production for security reasons.
TRACE /debugCONNECT
Commonly used by proxies to establish an HTTPS tunnel; rarely used by ordinary business APIs.
CONNECT example.com:443How to Use
HTTP methods define the semantics of a client’s operation on a resource. To actually send requests, use the HTTP Test Tool; for the Content-Type request header, see the HTTP MIME Types Guide.
FAQ
What is the difference between GET and POST?
GET is usually for querying resources, with parameters mostly in the URL; POST is usually for submitting data or creating resources, and its request body may carry JSON, form data or files.
What is an idempotent request?
Idempotent means running the same request once or many times has the same final effect on the server resource; GET, PUT and DELETE are usually designed to be idempotent.
What is the difference between PUT and PATCH?
PUT usually means replacing a resource as a whole, while PATCH usually means partially updating a resource.
What is an OPTIONS request for?
OPTIONS can query the request methods a server supports, and is also common in browser CORS preflight.
Does a DELETE request always have no body?
The spec does not absolutely forbid a DELETE body, but real APIs usually send none, and compatibility depends on the server implementation.