쿼리 데이터 Adobe Commerce Optimizer
Adobe Commerce Optimizer 인스턴스에서 GraphQL을 사용하여 데이터를 쿼리하는 방법을 알아봅니다.
이 비디오는 누구의 것입니까?
- Commerce 솔루션 설계자 및 개발자
비디오 콘텐츠
- GraphQL을 사용하여 데이터 쿼리
- jq를 사용하여 json을 읽기 쉽게 만들기
코드 샘플
{{insert-your-graphql-endpoint-url}}
, {{insert-your-ac-view-id}}
및 {{your-search-query-string}}
과(와) 같은 값을 쿼리에 필요한 값과 교환하십시오.
기본 샘플 쿼리
curl '{{insert-your-graphql-endpoint-url}}' \
-H 'Content-Type: application/json' \
-H 'AC-View-ID: {{insert-your-ac-view-id}}' \
-d '{"query": "query ProductSearch($search: String!) { productSearch( phrase: $search, page_size: 10, current_page: 2) { items { productView { sku name description shortDescription images { url } ... on SimpleProductView { attributes { label name value } price { regular { amount { value currency } } roles } } } } } }", "variables": { "search": "{{your-search-query-string}}"}}'
출력을 예쁜 인쇄하기 위해 jq
을(를) 사용하는 기본 샘플 쿼리
curl '{{insert-your-graphql-endpoint-url}}' \
-H 'Content-Type: application/json' \
-H 'AC-View-ID: {{insert-your-ac-view-id}}' \
-d '{"query": "query ProductSearch($search: String!) { productSearch( phrase: $search, page_size: 10, current_page: 2) { items { productView { sku name description shortDescription images { url } ... on SimpleProductView { attributes { label name value } price { regular { amount { value currency } } roles } } } } } }", "variables": { "search": "{{your-search-query-string}}"}}' | jq .
3a5f7e19-f383-4af8-8983-d01154c1402f