Re: GraphQL 400 Bad Request

GraphQL 400 Bad Request

363518457
Shopify Partner
18 0 1

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 341 880

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
18 0 1

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
18 0 1

May I ask if you have seen it?

363518457
Shopify Partner
18 0 1

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
18 0 1

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