Sign In/My Account | View Cart  
advertisement

Article:
 Show Me the Code
Subject: Why PUT vs. POST?
Date: 2005-03-04 07:30:41
From: velebak

When updating bookmarks, you specify using PUT for a single but POST for a collection. What benefit does PUT bring, and wouldn't a POST work just as well?


Thanks,
Keith Veleba


No Previous Message Previous Message   Next Message Next Message


Titles Only Full Threads Newest First
  • Why PUT vs. POST?
    2005-03-04 22:23:28 Mike Dierken [Reply]

    A PUT request is idempotent - it can be repeated and the client can be sure of the results. A POST has no such guarantee - it could append some text, and doing that twice results in something different than doing it once.


    The benefit of repeatable requests is that if the network goes down, or a reply doesn't reach the client, your software can simply send the request again - the system as a whole becomes tolerant of failures.


    In the example, the collection could be replace with a PUT, but that's a design choice of the developer.


Sponsored By: