DEV Community

Cover image for A complete guide to HTTP request methods

A complete guide to HTTP request methods

mayankjoshi profile image mayank joshi Originally published at ・Updated on ・3 min read

In, this post we are going to discuss different types of HTTP methods available and their usage.

HTTP methods are the set of requests that indicate the desired action to be performed for a given resource. These request methods are also referred to as HTTP verbs.

The most commonly used HTTP methods are POST, GET, PUT and DELETE. These correspond to create, read, update, and delete (or CRUD) operations (in making REST API calls).

Now, let's explore all the request methods available.

HTTP request methods

1. GET

The GET request is used to retrieve the data from the server accessed using a URL. The GET request is ready only type request and does not perform any kind of read/update operation on the server.

It can be cached and can be sorted in browser history. Sensitive data should never be passed using the GET method.


The POST request method is used to send data to the server to create a new resource. POST methods send the data in plain text format and data is not visible in the URL. Note, without SSL, a POST request is just as secure as a GET request, as it also gets sent unencrypted over the network).

POST method is non-idempotent meaning identical POST requests multiple times can create the same resource multiple times.

3. PUT

The PUT method is used to send data to a server to update the already existing resource entirely. The PUT request can also we used to create a resource like POST but the difference between two is that the PUT is idempotent i.e, calling the same PUT request multiple times will always produce the same result, unlike POST where repeated requests will create the same resource multiple times.


As the name symbolizes, the DELETE method is used to delete a resource. The DELETE requests are idempotent meaning if we DELETE a resource, it’s removed and repeatedly calling DELETE on that resource ends up the same: the resource is deleted.


TRACE methods provide a debugging mechanism to the client by echoing the received request so that a client can see what (if any) additions or changes have been made by intermediate servers.


The OPTIONS method describes the communication options for the target resource. It allows the client to find out HTTP methods and other options supported by a web server.


The CONNECT method creates a two-way communication with the requested resource. It can be used to open a TCP/IP tunnel usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.


The PATCH method is used to partially update a resource. The difference between HTTP PUT and PATCH method is that the PUT method allows only a complete replacement of the resource. Also, the patch method is not idempotent i.e, multiple identical patch requests may have different effects.

Various HTTP methods and their characteristics table

Did, I miss something or do you want to add some other key points?πŸ€”
Please comment. 😊

If you are interested in learning HTTP response codes too, which I highly recommend. Check out this post.

This post was originally published at

Discussion (5)

Editor guide
artoodeeto profile image

so non-idempotent is when you create and save it in a DB and returns/yields different results?

for idempotent when you make a request that returns/yields the same result, is idempotent?

mayankjoshi profile image
mayank joshi Author • Edited

See, it's like this:

idempotent means when you make multiple requests using this type of method you will get same result in each successive request as that of first request. Example you made a PUT request to update a record, first time you will receive the updated result, and for next time the you will receive same result as same record is updated multiple time.

non-idempotent means for multiple requests of same type, multiple requests will be created. For example you made same POST request to create a movie multiple times (say 10), then 10 new entries will be made in database having all records same(except the key/I'd of mongo) i.e, 10 entries in database with same movie name.

Tell me if you still have more doubts.


artoodeeto profile image

I think I get it now.

Idempotent is when you make a request that gives you same result except for the first one. like DELETE which deletes the first one and returns the same result on the next request.

NON-Idempotent is when you make a request but returns a different result from the previous one. Ex: is when you make a post request and save it in the database, a new ID is generated, which returns a new row.

Thread Thread
mayankjoshi profile image
mayank joshi Author • Edited

Correct. πŸ‘

Adding a little bit: when you POST same data multiple time, it will be inserted multiple times.

Like you made same post request to add your name to database 10 times, you name will be inserted into database 10 times, i.e. 10 rows with same values

Thread Thread
artoodeeto profile image

Thank you. hahaha. achievement unlocked!