Re: Shopify Orders API returns response with code 200 and empty body

Shopify Orders API returns response with code 200 and empty body

AlexeySergeev
Tourist
9 0 3

During the last month (September 2023), I faced several times with the same situation when GET requested to order API (https://[shop name].myshopify.com/admin/api/2023-01/orders.json?..) returns status 200 and empty body. A successful response will always return JSON and an array inside.

 

X-Stats-ApiClientId:3879321

Server:cloudflare

X-Request-ID:6e165ff5-d708-4f4d-9f2b-fd7f4f8de4d9

X-Shopify-Stage:production

Server-Timing:cfRequestDuration;dur=8032.999992

X-ShopId:10691900

X-Permitted-Cross-Domain-Policies:none

HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT:1/400

X-Stats-ApiPermissionId:312679825492

 

Could you please fix it?

Replies 7 (7)

Liam
Community Manager
3108 341 881

 

Hi AlexeySergeev,

 

The HTTP 200 status code indicates that the API request was successful. However, an empty response body may mean that there are no resources that match your request.

 

Here are some steps you can take to troubleshoot this issue:

  1. Confirm the endpoint: Make sure you're using the correct endpoint and API version (in your case, '2023-01') to retrieve the orders.

  2. Check the parameters: If you're using parameters in your request, make sure they are correct. For example, you might be requesting orders from a specific time period where no orders were made, or using a filter that matches no orders.

  3. Verify access: Ensure that your API key has the necessary permissions to access order data.

  4. Test in Postman: Test your request in an API development environment like Postman to see if you get the same result.

Test out the above and let us know if it your still seeing an empty body - hope this helps! 

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

AlexeySergeev
Tourist
9 0 3

1) In API documentation there is no sign that empty body can be returned and it can be treated as the correct response

2) I repeated the response and got a non-empty array of orders!

 

If it helps response header X-Request-ID value is 33b1210b-c67c-4ce2-b6c9-eab274019e49

 

Could you please fix the problem? 

JeanCastro
Shopify Partner
2 0 0

@AlexeySergeev did you manage to solve the issue? I'm experiencing the same response in version 2023-07.

AlexeySergeev
Tourist
9 0 3

@JeanCastro Not really. This issue still happens from time to time,

JeanCastro
Shopify Partner
2 0 0

@Liam 

I'm facing the same issue.

  1. Confirmed the correct endpoint (in my case, 2023-07).
  2. The parameters are correct (it works in other stores, only in a specific client's store it doesn't).
  3. Permissions have been checked, everything seems fine. I tested removing the permissions, and the request returned an error as expected. The problem is that it's returning `{ orders: [] }` and status 200 when I try to create an order.
  4. I tested it in Postman, and the behavior was the same.

Any updates on this? I believe it's affecting more users as well.

X-Request-ID: 4a8bfd19-d580-47bd-b2c7-7a3d396e0913

markrhythm
Excursionist
11 0 4

I believe I'm facing the same issue.

 

Once a day I automatically download all our Orders, Products, and Customers into a separate system, via the API. It has worked flawlessly for over a year. Recently, the amount of data retrieved has been smaller than usual

 

Testing some more, it seems that the pagination intermittently finishes early. I retrieve the URL for the next page from the Link field, call the API with that URL, then on the next call there is no body, and many of the header fields are missing, including Link (no previous URL to go to)

 

I've witnessed this with Products, Customers, Orders, and Inventory endpoints

 

Our store relies on the Products and Inventory to keep our Shopify inventory in-sync with our in-store inventory. Dev team please help!

markrhythm
Excursionist
11 0 4

I also created another post about this with some more detail, and am currently waiting to hear back from support

 

https://community.shopify.com/c/products-variants-and/api-sometimes-returning-empty-responses/td-p/2...