I've triggered a Shopify REST API multiple times and the request got throttled. The header info of this throttled request had the value - "X-Shopify-Shop-Api-Call-Limit": ["1/40"].
However, as per the Shopify document ( reference - https://shopify.dev/api/usage/rate-limits#rest-admin-api-rate-limits ), the request would be throttled once the request goes over a rate limit (example- X-Shopify-Shop-Api-Call-Limit: 40/40 ).
Can someone please help if there is any field in the header information or any way I can identify the throttled requests, and handle such scenarios accordingly.
If you had the x-request_id from the throttled request headers we can take a look!
On the throttled requests, they would return a client side 429 status - "too many requests" - and a message that a throttle had been applied.
Sounds like you know about the X-Shopify-Shop-Api-Call-Limit header already, but The Retry-After header contains the number of seconds to wait until you can make a request again once you've been throttled. Worth noting though, that any request made before the wait time has finished will be throttled.
There's some recommendations on handling such scenario's here if it helps too. Thanks!
Hey @L_J_K ,
Thank you for your response.
Here is the request ID for one such throttled request - "X-Request-ID": ["e6ca081e-4d49-4b17-96ab-9e6721e13281"]
This header payload did not contain the "Retry-After" field as well.
Please let me know if you need any further information to look into this issue.
Thanks! I checked out that request ID and I see what's happening now.
So you're hitting the update_tracking.json endpoint more than 5 times a minute. On the 429 throttle, you should be returned "upgrade to a paid account to remove this limit".
I can see you're making these calls on a Partner Test Store and you're hitting that resource more than 5 times a minute. Certain endpoints like the Fulfillments endpoint has restrictions on the amount of calls per minute - please see here. If you'd like to hit that endpoint more than that, you would need to upgrade to a paid plan.
I note you're calling 2019-10 of the API - well worth bumping up to the latest 2021-07 version (versioning docs here if need be). Hope that explains at least!