다음 /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"
}
}
}
}'