HTTP Request Methods

Differentiate the HTTP request methods and use them in your projects.

REST API
HTTP REQUEST

May 2024

HTTP Request Methods

GET

The HTTP GET method requests a representation of the specified resource. Requests using GET should only be used to request data (they shouldn't include data).

Note: Sending body/payload in a GET request may cause some existing implementations to reject the request, while not prohibited by the specification, the semantics are undefined. It is better to just avoid sending payloads in GET requests.
GET method specification
TermsData
Request has bodyno
Successful response has bodyyes
safeyes
idempotentyes
cacheableyes
Allowed in HTML Formyes

POST

The HTTP POST method sends data to the server. The type of the body of the request is indicated by the Content-Type header. The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), where successive identical POST may have additional effects, like passing an order several times.

When the POST request is sent via a method other than an HTML form, such as a fetch() call, the body can take any type. As described in the HTTP 1.1 specification, POST is designed to allow a uniform method to cover the following functions:

Annotation of existing resource

Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles

Adding a new user through a signup modal

Providing a block of data, such as the result of submitting a form, to a data-handling process

Extending a database through an append operation.

POST method specification
TermsData
Request has bodyyes
Successful response has bodyyes
safeno
idempotentno
cacheableOnly if freshness information is included
Allowed in HTML Formyes

PUT

The HTTP PUT request method creates a new resource or replaces a representation of the target resource with the request payload. The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), whereas successive identical POST requests may have additional effects, akin to placing an order several times.

PUT method specification
TermsData
Request has bodyyes
Successful response has bodymay
safeyes
idempotentyes
cacheableOno
Allowed in HTML Formno

PATCH

The HTTP PATCH request method applies partial modifications to a resource. PATCH is somewhat analogous to the "update" concept found in CRUD (in general, HTTP is different than CRUD, and the two should not be confused). A PATCH request is considered a set of instructions on how to modify a resource. Contrast this with PUT; which is a complete representation of a resource. A PATCH is not necessarily idempotent, although it can be. Contrast this with PUT which is always idempotent.

PATCH method specification
TermsData
Request has bodyyes
Successful response has bodymay
safeno
idempotentno
cacheableOnly if freshness information is included
Allowed in HTML Formno

DELETE

The HTTP DELETE request method deletes the specified resource.

DELETE method specification
TermsData
Request has bodymay
Successful response has bodymay
safeno
idempotentyes
cacheableno
Allowed in HTML Formno