A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
{ shop { products(first: 10) { pageInfo { hasNextPage hasPreviousPage } edges { cursor node { id handle variants(first: 30) { edges { node { id } } } } } } } }
Solved! Go to the solution
This is an accepted solution.
Am I understanding your question correctly in that you want to know what a graphql request looks like using curl? If so, here's what your exaple query would look like:
curl -X POST 'https://anprichter-test.myshopify.com/api/graphql.json' \ -d '{"query":"{shop{products(first: 10){pageInfo{hasNextPage\nhasPreviousPage}edges{cursor\nnode{id\nhandle\nvariants(first: 30){edges{node{id}}}}}}}}"}' \ -H 'X-Shopify-Storefront-Access-Token: 2c36d7ecefcd0333dbad32e28f8db86b' \ -H 'Content-Type: application/json'
You're really just posting JSON at the end of the day, so if you want to include variables, the shape of your POST would be like so:
{"query": "{shop{id}}", "variables": {"key1": "value": "key2": "value"}}
Hope that helps.
Cheers.
Alex | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
This is an accepted solution.
Am I understanding your question correctly in that you want to know what a graphql request looks like using curl? If so, here's what your exaple query would look like:
curl -X POST 'https://anprichter-test.myshopify.com/api/graphql.json' \ -d '{"query":"{shop{products(first: 10){pageInfo{hasNextPage\nhasPreviousPage}edges{cursor\nnode{id\nhandle\nvariants(first: 30){edges{node{id}}}}}}}}"}' \ -H 'X-Shopify-Storefront-Access-Token: 2c36d7ecefcd0333dbad32e28f8db86b' \ -H 'Content-Type: application/json'
You're really just posting JSON at the end of the day, so if you want to include variables, the shape of your POST would be like so:
{"query": "{shop{id}}", "variables": {"key1": "value": "key2": "value"}}
Hope that helps.
Cheers.
Alex | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog