Query data Adobe Commerce Optimizer

Learn how to query data using GraphQL on an Adobe Commerce Optimizer instance.

Who is this video for?

  • Commerce Solution Architect and developers

Video content

  • Query data using GraphQL
  • Using jq to make json easier to read

Code Samples

Be sure to exchange values like {{insert-your-graphql-endpoint-url}}, {{insert-your-ac-view-id}} and {{your-search-query-string}} with the values needed on your query.

Basic sample query

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

Basic sample query using jq to pretty-print the output

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 .
recommendation-more-help
commerce-learn-help-adobe-commerce-optimizer