XML.com: XML From the Inside Out

XML.comWebServices.XML.comO'Reilly Networkoreilly.com
  Articles | Weblogs | Newsletter | Safari Bookshelf
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 Titles Only 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.

    • Why PUT vs. POST?
      2005-03-05 07:34:05 velebak [Reply]

      That makes sense, I guess it's all in how your application code handles PUT and POST operations. I was thinking too far down in the code again. Thanks for the clarification!


      Keith

Sponsored By:


Contact Us | Our Mission | Privacy Policy | Advertise With Us | | Submissions Guidelines
Copyright © 2008 O'Reilly Media, Inc. | (707) 827-7000 / (800) 998-9938