Resources that accept
PATCH requests may or may not return a representation in the response. The client might want the response returned, however, to save a subsequent
GET request, or to omit a returned representation to save transmission time. The Representation profile gives a client the ability to specify that they prefer the created or modified representation returned with the response or omitted from the response.
Resources that support the Representation profile include the Representation profile header in its list of profile headers.
The client sends a
Prefer: return=representation header indicating that they want the content of the created or modified representation returned with the response. This header saves them from having to issue a
GET request to fetch the changed state. The resource returns a status of
200 OK instead of
204 No Content for
The Prefer header parameter
return also accepts the value
minimal which tells the resource to omit a response representation.
HTTP/1.1 Semantics and Content: RFC 7231
Prefer Header for HTTP: RFC 7240
- return=representation / return=minimal: section 4.2
Copyright © 2019 Matt Bishop
This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.