HTTP Methods Demystified: A Guide to Understanding HTTP Request Methods
vayola pradeep
Posted on August 22, 2023
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
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.
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.
Now what is the difference between GET & POST Method
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.
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.
DELETE Method
The DELETE method deletes a resource. Regardless of the number of calls, it returns the same result
PATCH Method
Similar to PUT , PATCH updates a resource, but it updates data partially and not entirely.
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.
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.
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
Posted on August 22, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.