Fork me on GitHub

When should we use the PATCH HTTP method?

The HTTP methods PATCH can be used to update partial resources. For instance, when you only need to update one field of the resource, PUTting a complete resource representation might be cumbersome and utilizes more bandwidth

PATCH /user/jthijssen HTTP/1.1
<user>
    <firstname>Joshua</firstname>
</user>

Also, the PUT method is idempotent. PUTting the same data multiple times to the same resource, should not result in different resources, while POSTing to the same resource can result in the creation of multiple resources.

See also

Caveats

  • PATCH is neither safe nor idempotent.
  • An API implementing PATCH must patch atomically. It MUST not be possible that resources are half-patched when requested by a GET.