8 Filter REST Responses
You can define filters that limit the data returned in REST responses, thereby improving performance.
Response filters are persistent and defined ahead of time, and then passed as part of a REST request. The server uses the response filter to determine which fields to return in response to the request. A response filter has an identifying name (the response filter key), and two lists of fields, one for fields to include in the response and one for fields to exclude. A response filter can configure fields to include, fields to exclude, or both. It is the response filter’s key that is passed in the data that is sent with a REST request. You create and update response filters via the REST API. For details on how to do this, see Response filters. This section discusses how to use a response filter once it has been created.
Note: The response filter functionality described in this section is,
at its core, a wrapper for the existing fields
and
exclude
query parameters in REST requests and it
behaves the same way. Instead of sending a complete list of fields to
include or exclude in the query parameters, you can create a persistent
filter containing that data and then pass that filter instead. To support
backward compatibility, if you pass a fields
or
exclude
query parameter and a filter in a request,
the filter is ignored. For more information on the fields
and exclude query
parameters, see REST API query parameters.