Query-gegevens Adobe Commerce Optimizer

Leer hoe u via GraphQL query's uitvoert op gegevens in een Adobe Commerce Optimizer-instantie.

Voor wie is deze video?

  • Commerce Solution Architect en ontwikkelaars

Video-inhoud

  • Query-gegevens uitvoeren met GraphQL
  • De jq gebruiken om de json beter leesbaar te maken

Codevoorbeelden

U moet waarden als {{insert-your-graphql-endpoint-url}} , {{insert-your-ac-view-id}} en {{your-search-query-string}} uitwisselen met de waarden die nodig zijn voor de query.

Standaardvoorbeeldquery

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

Standaardvoorbeeldquery met jq om de uitvoer vrij af te drukken

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 .

Gerelateerde inhoud

recommendation-more-help
3a5f7e19-f383-4af8-8983-d01154c1402f