Filtering responses in the Reactor API
When using list (GET) endpoints in the Reactor API, you may find it necessary to limit the returned results to a subset of records. To accomplish this, many of the API’s list endpoints support the ability to filter by specific attributes. If you wish to make structured queries to the API instead, see the guide on searching.
Filtering syntax
The following example explains how to implement filters for your GET requests.
API format
To filter the response for a given list endpoint, you must supply a filter
query parameter in the request path.
[]
) and space characters for readability. In practice, these characters must be URI-encoded, as outlined in RFC 3986. An example of a properly encoded request path is shown later in this guide.GET {ENDPOINT}?filter[{ATTRIBUTE_NAME}]={OPERATOR} {VALUE}
{ENDPOINT}
{ATTRIBUTE_NAME}
{OPERATOR}
{VALUE}
. Supported operators are listed in the appendix section.{VALUE}
EQ
operator, the value must be an exact, case-sensitive match in order to be included in the response.Request
The example request below retrieves a list of of published libraries by applying a filter that requires the library’s state
attribute to equal published
.
Before URI encoding, the syntax for this filter in the request path would look similar to the following:
https://reactor.adobe.io/properties/PR906238a59bbf4262bcedba248f483600/libraries?filter[state]=EQ published
Once the path and query parameters have been URI-encoded, they can be used in API requests like the one below:
curl -X GET \
https://reactor.adobe.io/properties/PR906238a59bbf4262bcedba248f483600/libraries?filter%5Bstate%5D=EQ%20published \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}'
Filtering on multiple values multiple-values
To filter by multiple values for a single attribute, supply the values as a comma-separated list.
GET {ENDPOINT}?filter[{ATTRIBUTE_NAME}]={OPERATOR} {VALUE_1},{VALUE_2}
Using multiple filters
To apply filters for multiple attributes, supply a filter
parameter for each attribute. Parameters must be separated by ampersand (&
) characters.
GET {ENDPOINT}?filter[{ATTRIBUTE_NAME_1}]={OPERATOR} {VALUE}&filter[{ATTRIBUTE_NAME_2}]={OPERATOR} {VALUE}
Appendix
The following section contains additional information for working with filters in the Reactor API.
Supported filter operators operators
The following table lists the supported operator values for filter parameters. Keep in mind that depending on the attribute you are filtering by, not all available filter operators will be applicable, such as using “less than” or “greater than” operators for string attributes.
EQ
NOT
LT
GT
BETWEEN
CONTAINS