What is the difference between GET vs POST vs PUT? Mainly POST vs PUT?

  • MHB
  • Thread starter shivajikobardan
  • Start date
  • Tags
    Difference
In summary, POST is used to submit form data whereas PUT doesn't. PUT keeps data to be sent in URL whereas POST doesn't.
  • #1
shivajikobardan
674
54
First of all I am not learning this currently from web development Point of view. So I think I don’t need the extreme level of understanding. I am studying this in a topic called “HTTP protocol”. And in my opinion, I need to learn enough to write what it does in exam paper.

It is so confusing in internet. I can’t explain enough. Firstly I was just confused between PUT and POST. But later someone started to tell me that you could use GET instead of these two in submitting form. That got me confused to next level.

What I have already understood(be it wrong or right I am not sure).

GET-: It helps to retrieve the file indicated by URL in request line from server.

PUT and POST seems same thing to me.

PUT places data in body to the URL in request line.
POST has no such definitions anywhere in books or internet. And it is generalized as “POST is used to submit form data”.
But the gist of these two seems similar ie post data to server. What’s the difference?

And there are like 6,670,000,000 results in google.
But I don’t know how stupid I am to not get this.Most articles in internet are copied from each other and written pretty unprofessionally. I am not very smart. I mean smart in the sense that one who can understand anything taught by anyone and doesn’t need that clarity. I need something very simplified to understand and I don’t find it at least till now.

https://stackoverflow.com/questions/630453/what-is-the-difference-between-post-and-put-in-http
https://stackoverflow.com/questions...ference-between-a-post-and-a-put-http-request

These are perhaps the only reputable answers about this but I find them very confusing.

They say idemptotencyy is there in some and not in other. But I want their basic difference in working.(PUT is idempotent).
Idempotent means you can keep repeating the same thing again and again but the final result will be the same as the initial result that happened when you did that thing for the first time.

Is this the only difference between POST and PUT working and is their definition same?
Another thing that I am seeing is PUT keeps data to be sent in URL whereas POST doesn’t do it. How do we know about it? I can’t see any information that shows this thing practically. (They say while googling you use PUT so that you can visit that page again as well.) But IDK how to explain, I don’t know how.
Just tell me the difference between PUT and POST in terms of real working difference, Like how they work. Thanks for the information.
 
Technology news on Phys.org
  • #2
This is not my speciality and I didn't really know about PUT before this question, but it seems that PUT is used to check if a resource exists and POST always creates a new resource. It also seems to me that repeated POST requests with the same payload will create new records each time, and PUT with the same payload will not change the result if used multiple times.
 

What is the difference between GET vs POST vs PUT?

GET, POST, and PUT are three different methods used in HTTP (Hypertext Transfer Protocol) for sending data from a client (such as a web browser) to a server. GET requests data from a specified resource, POST submits data to a specified resource, and PUT sends data to be stored at a specified resource.

What are the main differences between POST vs PUT?

The main difference between POST and PUT is in the way they handle data. POST is used for creating a new resource on the server, while PUT is used for updating an existing resource. POST requests are not idempotent, meaning that repeated requests may have different results, while PUT requests are idempotent, meaning that repeated requests will have the same result.

When should I use POST over PUT?

POST should be used when creating a new resource on the server, such as submitting a form or adding a new entry to a database. It should also be used when the request is not idempotent, meaning that repeated requests may have different results.

When should I use PUT over POST?

PUT should be used when updating an existing resource on the server, such as editing an existing entry in a database or updating a user's information. It should also be used when the request is idempotent, meaning that repeated requests will have the same result.

Can POST and PUT be used interchangeably?

No, POST and PUT have different purposes and should not be used interchangeably. POST should be used for creating new resources and non-idempotent requests, while PUT should be used for updating existing resources and idempotent requests.

Similar threads

  • Programming and Computer Science
Replies
3
Views
753
  • Engineering and Comp Sci Homework Help
Replies
4
Views
718
  • Programming and Computer Science
Replies
13
Views
469
  • Programming and Computer Science
Replies
28
Views
672
  • Programming and Computer Science
Replies
19
Views
2K
  • Programming and Computer Science
Replies
14
Views
1K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
2
Replies
59
Views
5K
Back
Top