THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.

Revision history  [back]

PUT vs POST difference as a computer network and internet technology student (not web developer)

I am not a web developer or anything professional. I am just a student learning topic called HTTP protocol. In which I got confused by PUT vs POST methods. This is probably not even 1 marks stuffs in most exams (unless we are explicitly asked about HTTP methods where it can weigh upto 2.5+2.5=5 marks as the maximum marks that can be asked from this topic is 10 marks and we would be expected to write 4 of the methods).

What's that all I need to know about this? I did a huge research for learning this. Mostly I stumbled upon stackoverflow. Most online sites have copied pasted the stackoverflow answer. I haven't read the HTTP RFC as I feel

a) I am not at that caliber to read and understand RFC yet. I prefer reading books written by authors who simplify those RFCs.

b) I don't feel I should do this all for a subtopic(if my luck is bad, we could get asked HTTP methods for 10 marks in exam lol, hope i don't get jinxed).

But I have read MDN docs about them, but really speaking, they added no value to my learning. Maybe that is great for web developers but as a computer science student, that really didn't make lots of sense.

So till now I have collected this much information-:

1) PUT and POST both are same thing logically. It is just that one is used for sth and another for sth just for convention.

2)PUT write documents to server. It can create new documents in specified URL or if document already exists in that URL, it can replace its contents. Whereas POST is used to send input data to server rather than some random document data.

So the difference could be in type of data sent. One sends data to store in server only, whereas other sends data to query the server for other data.

3)PUT for update in CRUD, and POST for create in CRUD.

4) PUT-: I just want data to be created at this location. Or data to be updated if it already exists. POST-: I just want data to be sent to this location.

5)PUT displays data to be sent in URL. POST doesn't. So PUT is used in google search, google maps, whereas POST is used in forms data.

6)PUT is idempotent meaning doing PUT 1000 times will have the same result as doing PUT 1 time.

This is all I have learnt. While I know whatever I have learnt is all correct and well. I want few things from the users of this website. 1) A simple definition that can explain PUT and POST.

If possible, extra explanations to solidify my concept.

Figure for explanations of PUT and POST-:

https://i.stack.imgur.com/nbHen.png

https://i.stack.imgur.com/iNS2T.png