A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Why do I use test case data from the interface documentation. Some can be called successfully. Some keep reporting "400 Bad Request" errors?
For example:
The interface for "Get the first 10 orders" will succeed with the following parameters:
{
"Query": "Query {orders (first: 10) {edges {node {id}}}}"
}
However, the interface for "Get an order by its ID" keeps getting errors, with the following parameters:
{
"Query {order (id:)" gid://shopify/order/148977776 "{name}}"
}
Are these errors only happening with test data orders, eg from our test data development stores? Or on real orders too?
Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog
We have replaced it with the real order ID, which is the same error. Please help to see why some can and some cannot.
May I ask if you have seen it?
curl -X POST https://XXX.myshopify.com/admin/api/2023-10/graphql.json -H 'Content-Type: application/json' -H 'X-Shopify-Access-Token: XXXX -d '{"query": "query { order(id: "gid://shopify/Order/XXXX") { name } }"}'
curl -X POST \
https://XXX.myshopify.com/admin/api/2023-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: XXX' \
-d '{
"query": "query { order(id: "gid://shopify/Order/XXX") { name } }"
}'
I have tried both of the above methods. Return all 'Bad Requests'
We have replaced it with the real order ID, which is the same error.