May 2024
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.
Terms | Data |
---|---|
Request has body | no |
Successful response has body | yes |
safe | yes |
idempotent | yes |
cacheable | yes |
Allowed in HTML Form | yes |
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.
Terms | Data |
---|---|
Request has body | yes |
Successful response has body | yes |
safe | no |
idempotent | no |
cacheable | Only if freshness information is included |
Allowed in HTML Form | yes |
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.
Terms | Data |
---|---|
Request has body | yes |
Successful response has body | may |
safe | yes |
idempotent | yes |
cacheable | Ono |
Allowed in HTML Form | no |
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.
Terms | Data |
---|---|
Request has body | yes |
Successful response has body | may |
safe | no |
idempotent | no |
cacheable | Only if freshness information is included |
Allowed in HTML Form | no |
The HTTP DELETE request method deletes the specified resource.
Terms | Data |
---|---|
Request has body | may |
Successful response has body | may |
safe | no |
idempotent | yes |
cacheable | no |
Allowed in HTML Form | no |