Reactor API에서 리소스 검색

Reactor API의 /search 끝점을 사용하면 저장된 리소스에 대해 구조화된 쿼리를 만들 수 있습니다. 이 문서에서는 다양한 일반적인 사용 사례에 대한 다양한 검색 쿼리의 예를 제공합니다.

NOTE
이 안내서를 읽기 전에 허용되는 쿼리 구문 및 기타 사용 지침에 대한 자세한 내용은 검색 끝점 안내서를 참조하십시오.

기본 쿼리 전략

다음 예에서는 API의 검색 기능 사용에 대한 몇 가지 기본 개념을 보여 줍니다.

여러 필드 검색

필드 이름에 와일드카드를 사용하여 여러 필드에서 검색을 수행할 수 있습니다. 예를 들어 여러 특성 필드를 검색하려면 attributes.*을(를) 필드 이름으로 사용하십시오.

{
  "data": {
    "query": {
      "attributes.*": {
        "value": "evar7"
      }
    }
  }
}
IMPORTANT
일반적으로 검색 값은 검색 중인 데이터 유형과 일치해야 합니다. 예를 들어 정수 필드에 대한 쿼리 값 evar7이(가) 실패합니다. 여러 필드에서 검색할 때 오류를 방지하기 위해 쿼리 유형 요구 사항을 완화하지만 원하지 않는 결과가 발생할 수 있습니다.

특정 리소스 유형으로 쿼리 범위 지정

요청에 resource_types을(를) 제공하여 특정 리소스 유형으로 검색 범위를 지정할 수 있습니다. 예를 들어 data_elementsrule_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"
            }
          }
        }
      }'

"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"
            }
          }
        }
      }'

"사용자 지정 코드" 위임 유형의 데이터 요소

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"]
        }
      }'

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"
            }
          }
        }
      }'

"OR" 용어 논리를 사용하여 검색 수행

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"
            }
          }
        }
      }'
recommendation-more-help
12b4e4a9-5028-4d88-8ce6-64a580811743