Searching resources in the Reactor API
The /search
endpoint in the Reactor API allows you to make structured queries on stored resources. This document provides examples of different search queries for various common use cases.
Basic query strategies
The following examples demonstrate some basic concepts for using the API’s search functionality.
Search across multiple fields
A search can be performed across multiple fields by use of wildcards in the field name. For example, to search across multiple attribute fields, use attributes.*
as the field name.
{
"data": {
"query": {
"attributes.*": {
"value": "evar7"
}
}
}
}
evar7
against an integer field would fail. When searching across multiple fields, the query type requirement is made lenient to avoid errors, but may produce undesired results.Scope queries to specific resource types
You can scope a search to a specific resource type by supplying resource_types
in the request. For example, to search across data_elements
, and rule_components
:
{
"data": {
"from": 0,
"size": 25,
"query": {
"attributes.display_name": {
"value": "Performance"
}
},
"resource_types": [
"data_elements",
"rule_components"
]
}
}
Sort responses
The sort
property can be used to sort responses. For example, to sort by created_at
with newest first:
{
"data": {
"from": 0,
"size": 25,
"query": {
"attributes.display_name": {
"value": "Performance"
}
},
"sort": [
{
"attributes.created_at": "desc"
}
],
"resource_types": [
"data_elements",
"rule_components"
]
}
}
Common search examples
The following example demonstrate additional common search patterns.
Any resource with a specific name
curl -X POST \
https://reactor.adobe.io/search \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H "Content-Type: application/vnd.api+json" \
-H 'Accept: application/vnd.api+json;revision=1' \
-d '{
"data": {
"query": {
"attributes.name": {
"value": "Adobe"
}
}
}
}'
Any resource referencing “evar7”
curl -X POST \
https://reactor.adobe.io/search \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H "Content-Type: application/vnd.api+json" \
-H 'Accept: application/vnd.api+json;revision=1' \
-d '{
"data": {
"query": {
"attributes.*": {
"value": "evar7"
}
}
}
}'
Data elements of a “custom-code” delegate type
curl -X POST \
https://reactor.adobe.io/search \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H "Content-Type: application/vnd.api+json" \
-H 'Accept: application/vnd.api+json;revision=1' \
-d '{
"data": {
"query": {
"attributes.delegate_descriptor_id": {
"value": "custom-code"
}
},
"resource_types": ["data_elements"]
}
}'
Rule components referencing a specific data element
curl -X POST \
https://reactor.adobe.io/search \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H "Content-Type: application/vnd.api+json" \
-H 'Accept: application/vnd.api+json;revision=1' \
-d '{
"data": {
"query": {
"attributes.settings": {
"value": "myDataElement8"
}
},
"resource_types": ["rule_components"]
}
}'
Rules in a specific Property
curl -X POST \
https://reactor.adobe.io/search \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H "Content-Type: application/vnd.api+json" \
-H 'Accept: application/vnd.api+json;revision=1' \
-d '{
"data": {
"query": {
"relationships.property.data.id": {
"value": "PR3cab070a9eb3423894e4a3038ef0e7b7"
}
},
"resource_types": ["rules"]
}
}'
Find a resource by ID
curl -X POST \
https://reactor.adobe.io/search \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H "Content-Type: application/vnd.api+json" \
-H 'Accept: application/vnd.api+json;revision=1' \
-d '{
"data": {
"query": {
"id": {
"value": "PR3cab070a9eb3423894e4a3038ef0e7b7"
}
}
}
}'
Perform a search using “OR” term logic
curl -X POST \
https://reactor.adobe.io/search \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H "Content-Type: application/vnd.api+json" \
-H 'Accept: application/vnd.api+json;revision=1' \
-d '{
"data": {
"query": {
"attributes.display_name": {
"value": "My Rule Holiday Sale",
"value_operator: "OR"
}
}
}
}'