DEV Community

Cover image for HTTP Methods Demystified: A Guide to Understanding HTTP Request Methods
vayola pradeep
vayola pradeep

Posted on • Updated on

HTTP Methods Demystified: A Guide to Understanding HTTP Request Methods

HTTP is Hypertext Transfer Protocol.

HTTP is designed to enable communication between clients and servers. HTTP works as request-response between client and server.

HTTP methods

  • GET
  • POST
  • PUT
  • HEAD
  • DELETE
  • PATCH
  • OPTIONS
  • CONNECT
  • TRACE

Two most common http methods are
GET and POST

http method

GET Method

Appends data to the URL in the form of name or value pair.
Request data from a specified resource. A GET Request is used to request information from a resource such as a
website, a server, or an API.

Image description

POST Method

Web server accepts data included in the body of the message.
Send data to server to create/update a resource.It Creates a new Resource on the backend (Server). We send data to the server in the request body.

Image description

Now what is the difference between GET & POST Method

Image description

Image description

PUT Method

Send data to server to create/ update a resource
Only difference between put method is calling same PUT request multiple times will always produce the same result. But POST requests repeatedly have same resource multiple times.Using this, we can update an existing resource by sending the updated data as the content of the request body to the server.

Image description

HEAD Method

The HEAD method is similar to the
GET method. But it doesn't have any response body. Only difference between HEAD method is make the request but not return GET Method make request and return. So if it mistakenly returns the response body, it must be ignored.

Image description

DELETE Method

The DELETE method deletes a resource. Regardless of the number of calls, it returns the same result

Image description

PATCH Method

Similar to PUT , PATCH updates a resource, but it updates data partially and not entirely.

Image description

OPTIONS Method

Describe the communication options for target resource. It used to get information about the possible communication options for the given URL or an asterisk to refer.

Image description

CONNECT Method

Used to start a two way communication with the requested resources.The Connect Method is for making end to end connections between a client and a server. It makes a two way connection like a tunnel between them.

Image description

TRACE Method

Used to perform a message loop back test that tests the path for target resource. Useful for debugging purposes.The TRACE Method is for diagnosis purposes. It creates a loop-back test
win the same request body that the client sent to the server before, and the successful response code is 200

Image description

Top comments (0)