此 /search
Reactor API中的端點可讓您對儲存的資源進行結構化查詢。 本檔案提供各種常見使用案例的不同搜尋查詢範例。
閱讀本指南前,請先參閱 搜尋端點指南 以取得接受的查詢語法和其他使用准則的相關資訊。
下列範例示範使用API搜尋功能的一些基本概念。
您可以在欄位名稱中使用萬用字元,跨多個欄位執行搜尋。 例如,若要搜尋多個屬性欄位,請使用 attributes.*
作為欄位名稱。
{
"data": {
"query": {
"attributes.*": {
"value": "evar7"
}
}
}
}
一般而言,搜尋值必須符合要搜尋的資料型別。 例如,查詢值為 evar7
針對整數欄位會失敗。 跨多個欄位搜尋時,查詢型別要求會變得寬鬆以避免錯誤,但可能會產生不需要的結果。
您可以透過提供以下專案將搜尋範圍限定為特定資源型別 resource_types
在請求中。 例如,若要搜尋 data_elements
、和 rule_components
:
{
"data": {
"from": 0,
"size": 25,
"query": {
"attributes.display_name": {
"value": "Performance"
}
},
"resource_types": [
"data_elements",
"rule_components"
]
}
}
此 sort
屬性可用於排序回應。 例如,排序依據 created_at
以最新的優先:
{
"data": {
"from": 0,
"size": 25,
"query": {
"attributes.display_name": {
"value": "Performance"
}
},
"sort": [
{
"attributes.created_at": "desc"
}
],
"resource_types": [
"data_elements",
"rule_components"
]
}
}
下列範例示範其他常見搜尋模式。
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"
}
}
}
}'
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"
}
}
}
}'
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"]
}
}'
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"]
}
}'
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"]
}
}'
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"
}
}
}
}'
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"
}
}
}
}'