Re: How can I send more than one request in a second or wait for 1 sec in REST API? I am using PHP

How can I send more than one request in a second or wait for 1 sec in REST API? I am using PHP

Grace_Armison
Visitor
1 0 0

Hi, I am custom app developer of this store. I am using REST API of Shopify. i am facing issues when i am trying to get all products from Shopify through API's. I am getting errors after 3k, 4k products. it show me error you can only send  per second per request ? how can i avoid this error while API is calling in loop. I am using PHP Foreach loop for getting all products, I am also using the Retry after 2 sec in request header.  But same error. There are more than 70K products. Please help.

Reply 1 (1)

RalfatGadget
Shopify Partner
11 1 2

Have you checked Shopify's documentation on their REST API rate limits to calculate at what cadence you should query to avoid hitting the limit? 

One option would be to check if the GraphQL bulk operations is a good option for you. Another one, that could work if you're building a custom app, is to use a Gadget.dev backend app to sync down the Shopify product data, and then query your Gadget app's APIs that don't have rate limits. 

Former Payments product manager @ Shopify, now at making Shopify app development easier for everyone @ Gadget.dev