A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
This query runs fine in the GraphiQL editor but when I run it as a JSON request I get a 400 response.
The json provided is not formatted correctly
If I remove the pagination request "after: ..." it runs as expected.
Is there something about my formatting of the "after" request that isn't JSON friendly?
{
"query": "query{ orders(first: 3, after: "eyJsYXN0X2lkIjo0MzU5OTgzMjY3ODkzLCJsYXN0X3ZhbHVlIjoiMjAyMi0wNS0yMyAxMDozNzoyMy4wMDAwMDAifQ==") { edges { cursor node { id name legacyResourceId email createdAt processedAt totalPriceSet { shopMoney { amount currencyCode } } totalDiscountsSet { shopMoney { amount currencyCode } } totalRefundedSet { shopMoney { amount currencyCode } } subtotalLineItemsQuantity test } } }}"
}
Solved! Go to the solution
This is an accepted solution.
Solved my own question. I needed to escape the quotes within my query.
{
"query": "query{ orders(first: 3, after: \"eyJsYXN0X2lkIjo0MzU5OTgzMjY3ODkzLCJsYXN0X3ZhbHVlIjoiMjAyMi0wNS0yMyAxMDozNzoyMy4wMDAwMDAifQ==\") { edges { cursor node { id name legacyResourceId email createdAt processedAt totalPriceSet { shopMoney { amount currencyCode } } totalDiscountsSet { shopMoney { amount currencyCode } } totalRefundedSet { shopMoney { amount currencyCode } } subtotalLineItemsQuantity test } } }}"
}
This is an accepted solution.
Solved my own question. I needed to escape the quotes within my query.
{
"query": "query{ orders(first: 3, after: \"eyJsYXN0X2lkIjo0MzU5OTgzMjY3ODkzLCJsYXN0X3ZhbHVlIjoiMjAyMi0wNS0yMyAxMDozNzoyMy4wMDAwMDAifQ==\") { edges { cursor node { id name legacyResourceId email createdAt processedAt totalPriceSet { shopMoney { amount currencyCode } } totalDiscountsSet { shopMoney { amount currencyCode } } totalRefundedSet { shopMoney { amount currencyCode } } subtotalLineItemsQuantity test } } }}"
}