PUT vs POST in simple words needed

Discussion in 'CCENT / CCNA' started by shivaji, May 29, 2022.

  1. 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.
  2. dmarsh
    Honorary Member

    dmarsh Petabyte Poster

    Most of what you posted is correct.

    Originally the the web was designed for Hypertext, and this was largely document based where a document would reside at a URI.

    The original HTTP verbs are designed around that.

    Nowadays its largely syntactic convention to make understanding a REST api easier.

    In REST PUT is used for update, POST for create, both take form data and typically store it.

    The main diffference is the URI in PUT is sopposed to be a unique document identifier in the RFC spec.


    Much of this is convention and following the spec so that HTTP caching works as expected etc.

    PUT is idempotent in that multiple requests cause the same result, POST can be made to be idempotent also, but its assumed its non idempotent by default. Due to this the network caching cannot cache.

    You can write code the breaks all the conventions if you like, its just considered bad practice.

    Probably easier to write a simple REST api yourself and watch a course on REST than read random HTTP protocol stuff. I've coded for 30 years and only read bits of a handful of RFCs.
    Last edited: May 29, 2022
    shivaji likes this.
  3. yeah i would love to code and learn but setting up databases and writing whole django code would take a life out of me. and i have so less time to study these(i keep telling it and keep spending a day on not even getting a topic :( ..)
  4. dmarsh
    Honorary Member

    dmarsh Petabyte Poster

    You dont need a database to write a rest service. You can use a hashmap in memory or a json file.

    You could code it in nodejs, .NET core, Spring Boot, can be done in 1 hour.


    You should be able to do this stuff ideally if you want a job after graduating.
    Last edited: May 29, 2022
    shivaji likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.