API sometimes returning empty responses

I’m facing an issue where I can not reach the end of pagination in REST API responses. The body is sometimes returned empty, other times with no issue. Sometimes it happens on the 2nd page of responses, sometimes the 30th etc.

Using version 2023-01 in production. In testing, I tried 2023-07, and witnessed the same issue

Once a day all our Orders, Products, and Customers are downloaded 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.

I also posted a reply to this thread, stating similar. It sounds like this user is also experiencing the same thing
https://community.shopify.com/post/2239482

Hi Markrhythm,

This sounds like a very specific issue that would require us to take a closer look at the API calls you’re making and the response headers. Have you reached out to our support team about this yet - via the support tab in your partner dashboard?

Thanks Liam, have been in touch with the support team and they are looking at it now

I thought worth mentioning it here in case any other users or developers come across the same issue

We download 1,000s of records each day from 5 other sources also, none of which are having any issues now. Which leads me to believe the Shopify API is playing up, as opposed to the system we use to call the API.

I know how tricky intermittent issues can be to track down. The only thing consistent I can get out of this issue is that it almost never reaches the final page of the response (should be about 52 or so pages) before it gets a blank response, and the response has no Link field for next/previous page.

Will post back here with any results from the support team

I’m having the same issue with both the product and order endpoints from the admin api. Please keep this post updated if you get a response! I’ll do the same if I hear back earlier from my support thread.

After some more digging into this issue, it turned out that the body was not empty, BUT, many fields were missing from the Response Header, including the Link field that is necessary to get the next/previous page from pagination.

Adding a small few second wait between each pagination request seems to reduce the frequency of the header fields missing, but sometimes it still happens

Hathair, have you received an update from support? My support agent says that it has been passed on to the technical team but that is as far as I have gotten

I am also facing the same issue the Link parameter is coming empty

Link: ; rel=“next”

Could you guide if this get fixed at your end

Turned out that some of the header fields had changed case, sometimes returning as “Link” and sometimes “link”. It appears to be fixed and consistent now with the lowercase version