Representation Profile (Mixin)

Profile: <http://level3.rest/profiles/mixins/representation>

Resources that accept POST, PUT or 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.

Discovery

Resources that support the Representation profile include the Representation profile header in its list of profile headers.

Return Representation

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 PUT and PATCH operations.

Omit Representation

The Prefer header parameter return also accepts the value minimal which tells the resource to omit a response representation.

Specifications

HTTP/1.1 Semantics and Content: RFC 7231

Prefer Header for HTTP: RFC 7240


Copyright © 2019 Matt Bishop
Creative Commons Licence
This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.