[Mailman-Developers] REST API PUT versus PATCH - is there in any point in PUT and PATCH?

Barry Warsaw barry at list.org
Wed Feb 18 22:34:23 CET 2015


On Feb 19, 2015, at 08:10 AM, Andrew Stuart wrote:

>Is there any actual benefit in those PUT methods?  I can’t see what they
>offer over the PATCH methods.

PUT is defined in HTTP/1.1.  PATCH is (only) defined in RFC 5789, so it may
not be universally supported.  E.g. back in the restish days, I had to hack
WebOb to support it, and it was an ugly hack, though Falcon supports it out of
the box.  I haven't dug into HTTP/2 enough yet to know whether PATCH has
finally been adopted into the official standard.

Much of the philosophy of the REST API was influenced by RESTful Web Services
(Richardson & Ruby), which IIRC recommended implementing both methods[*].  I
recently received the follow up to that excellent book, RESTful Web APIs, but
haven't really had time to read it yet to see how the intervening 6 years have
changed their recommendations.  A *very* quick skim of the first index hit
provides some additional rationale as to why both are useful.

* PUT is idempotent.  If you send the same PUT request 10 times, the result is
  the same as if you'd only sent it once.

* PATCH is not idempotent, but it can save on bandwidth and complexity.  It's
  like a diff, in that it only contains the parts of the resource that have
  changed.

Cheers,
-Barry

[*] Leonard Richardson was a colleague of mine on the Launchpad project back
in the day.  We had many conversations about Launchpad's REST API and his
insights, expertise, and experience deeply shaped our current design.


More information about the Mailman-Developers mailing list