Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

GraphQL 400 Bad Request

GraphQL 400 Bad Request

363518457
Shopify Partner
23 0 5

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

}

 

Replies 5 (5)

Liam
Community Manager
3108 344 910

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

363518457
Shopify Partner
23 0 5

We have replaced it with the real order ID, which is the same error. Please help to see why some can and some cannot.

363518457
Shopify Partner
23 0 5

May I ask if you have seen it?

363518457
Shopify Partner
23 0 5

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'

363518457
Shopify Partner
23 0 5

We have replaced it with the real order ID, which is the same error.