クエリデータのAdobe Commerce Optimizer
Adobe Commerce Optimizer インスタンスでGraphQLを使用してデータに対してクエリを実行する方法を説明します。
このビデオの目的は誰ですか。
- Commerce ソリューションアーキテクトと開発者
ビデオコンテンツ
- GraphQLを使用したデータのクエリ
- jq を使用した json の読み取り容易さ
コードサンプル
{{insert-your-graphql-endpoint-url}}
、{{insert-your-ac-source-locale}}
、{{your-search-query-string}}
などの値を、クエリで必要な値と交換してください。
基本的なサンプルクエリ
curl '{{insert-your-graphql-endpoint-url}}' \
-H 'Content-Type: application/json' \
-H 'AC-Source-Locale: {{insert-your-ac-source-locale}}' \
-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-Source-Locale: {{insert-your-ac-source-locale}}' \
-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