At some point, you are likely to encounter a situation
where you need to partially update an existing resource. This may happen
if the resource is large and/or the update you want to make is small. In
these cases, it may seem wasteful to submit a
to get the entire representation, make the small change, and submit a
PUT request with the entire representation back to the
server to update the resource. When you are confronted with such a
situation, one of the first solutions to consider is to refine the
resource in question in a way that removes the need for partial updates
in the first place. See Recipe 11.9 for
You want to know how to refine resources so that clients can partially update resources.
Design a new resource that encapsulates the parts of the
resource that a client can modify. Let clients
PUT to update that resource, in effect partially
updating the original resource.
The key advantage of this solution is that it gives clients the
ability to update subsets of the original resource by using the HTTP
PUT. It also has the added bonus of making
otherwise previously hidden resources accessible via their own URIs to
For example, consider the following representation of a customer resource:
# Request GET /customers/1 HTTP/1.1 Host: www.example.org # Response HTTP/1.1 200 OK Content-Type: application/xml;charset=UTF-8 Last-Modified: Thu, 05 Nov 2009 01:54:19 GMT ...