Http Methods are type of request for the Server from any Client.

The primary or most-commonly-used HTTP methods are
POST
GET
PUT
PATCH, and
DELETE.
These correspond to create, read, update, and delete (or CRUD) operations, respectively.
There are a number of other methods too, but are utilized less frequently. Of those less-frequent methods, OPTIONS and HEAD are used more often than others.

1 GET
The GET method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data.
2 HEAD
Same as GET, but transfers the status line and header section only.
3 POST
A POST request is used to send data to the server, for example, customer information, file upload, etc. using HTML forms.
4 PUT / PATCH

PUT
Replaces all current representations of the target resource with the uploaded content.
PATCH
Used to update partial resources. For instance, when you only need to update one field of the resource, PUTting a complete resource representation might be cumbersome and utilizes more bandwidth

5 DELETE
Removes all current representations of the target resource given by a URI.
6 CONNECT
Establishes a tunnel to the server identified by a given URI.
7 OPTIONS
Describes the communication options for the target resource.
8 TRACE
Performs a message loop-back test along the path to the target resource.
  1. GET
    The HTTP GET method is used to **read** (or retrieve) a representation of a resource. In the “happy” (or non-error) path, GET returns a representation in XML or JSON and an HTTP response code of 200 (OK). In an error case, it most often returns a 404 (NOT FOUND) or 400 (BAD REQUEST).According to the design of the HTTP specification, GET (along with HEAD) requests are used only to read data and not change it. Therefore, when used this way, they are considered safe.That is, they can be called without risk of data modification or corruption—calling it once has the same effect as calling it 10 times, or none at all. Do not expose unsafe operations via GET—it should never modify any resources on the server.
  2. POST
    The POST verb is most-often utilized to **create** new resources.On successful creation, return HTTP status 201, returning a Location header with a link to the newly-created resource with the 201 HTTP status.
  3. PUT
    PUT is most-often utilized for **update** capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource.However, PUT can also be used to create a resource in the case where the resource ID is chosen by the client instead of by the server.
    In other words, if the PUT is to a URI that contains the value of a non-existent resource ID. Again, the request body contains a resource representation. Many feel this is convoluted and confusing. Consequently, this method of creation should be used sparingly, if at all.On successful update, return 200 (or 204 if not returning any content in the body) from a PUT. If using PUT for create, return HTTP status 201 on successful creation.
  4. PATCH
    PATCH is used for **modify** capabilities. The PATCH request only needs to contain the changes to the resource, not the complete resource.This resembles PUT, but the body contains a set of instructions describing how a resource currently residing on the server should be modified to produce a new version. This means that the PATCH body should not just be a modified part of the resource, but in some kind of patch language like JSON Patch or XML Patch.
  5. DELETE
    DELETE is pretty easy to understand. It is used to **delete** a resource identified by a URI.On successful deletion, return HTTP status 200 (OK) along with a response body, perhaps the representation of the deleted item (often demands too much bandwidth), or a wrapped response (see Return Values below). Either that or return HTTP status 204 (NO CONTENT) with no response body. In other words, a 204 status with no body, or the can JSEND-style response and HTTP status 200 are the recommended responses.
Advertisements