Shopify Products API returning 500 error

Highlighted
Shopify Partner
9 0 0

I'm trying to get product detail from my store using Shopify product REST API. The product count is around 30k. The Shopify API is returning  HTTP status code 500 after making several requests. I'm also using cursor-based pagination to paginate the product. Is there any issue on the Shopify end or in my process. 

Is there anybody who knows why the error is being returned. 

 

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 119

Hey @arslan_iftikhar ,

 

Most of the time, if you are seeing 500 "Internal Server Errors" intermittently for GET requests it means that there was a timeout on Shopify's end when trying to query our database to obtain and return the results of your query request.

 

To prevent these 500 "Internal Server Errors" from happening, there are multiple things you can do on your end to make your API request faster and more efficient and less likely to cause timeouts:

  • Using query parameter of "since_id" to filter results, instead of 'created_at_x', can dramatically improve the efficiency of queries
  • Reducing the limit value of your request from the default of 250 to a lower value (e.g. limit=100) will make queries faster and therefore less likely to timeout
  • Using the GraphQL Admin API instead of the REST Admin API, so you do not have to request as much information and use less resources, which will make queries significantly more efficient and less likely to timeout.

Sometimes however, these 500 "Internal Server Errors" are unavoidable and can still occur due to factors that are outside of your app's control (e.g. the Shopify platform being under heavy traffic load from lots of simultaneous requests and therefore slow to complete occurs). Due to this, it is recommended for your app to implement some sort of time delay after retrieving a 500 error and then to retry the request at a later time

 

If after implementing this time delay functionality, and after following all of the steps to increase the efficiency of your GET requests, you are still regularly seeing getting the 500 "Internal Server Error" response please provide me with the value of the X-Request-ID header from the API response.

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

1 Like
Highlighted
Shopify Partner
9 0 0

I got you, 
Thanks, @hassain  for the detailed explanation.

0 Likes