Understanding the 2 requests per second API call limit and the proper way to work around that limitation

Craig6
New Member
11 0 0

Hello,

I am building an omni-channel app that leverages Shopify for e-commerce. Currently, it will be supported on both a native iOS app and a react front-end. I have a proxy API in node js that talks to Shopify upstream and connects to my mobile and web clients. I have been following the guides as illustrated in https://github.com/Shopify/storefront-api-examples. Reading about the API limit, I am concerned that the 2 req/sec won't work in practice for my aforementioned setup. Reading about proposed and recommended solutions, I can queue requests to not hit the 429 Too Many Requests Error. That is fine to do and won't be an issue for cases where I am doing any offload processing or anything that won't impact the user live. But in my case, I am leveraging the API for the entire storefront (customer login/registration, cart/checkout, orders, products, etc.) Hitting the rate-limit will be trivial with a handful of users as even 1 user could spawn multiple requests in one second ( For example, in creating a customer, I will call both the graphql createCustomer mutation and the customerAccessTokenCreate mutation at the same time). Queueing requests in this fashion will have a very bad user experience for the customer interacting with my application or website (customer has to wait long periods in spikes). Furthermore, in adopting any queueing strategy, I have to address issues of retry if I do hit the call limit (Should I just fail-fast? In that case, that could have a real financial impact for my business). Then, likely I will need to look for the web and mobile clients to implement long-polling or web-sockets (I don't want to have my node js HTTP connection open forever if there is a massive buildup in the queue for example). Fortunately, I have a lot of experience working around throttling requests. But there is no silver-bullet solution and it does obviously have additional complexity. I do recognize that my use-case is not typical of the universe of Shopify users, but if there are Shopify-written examples that touch on my use-case, then hopefully people have had to deal with the call rate issue in practice. I would love to hear feedback on how best to approach this. Is the Shopify API not meant for this use-case at scale? Are there alternative solutions that I should be thinking of to work around the 2 req/sec limitation?

 

Thanks,

 

Craig

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 293

Hey Craig,

Just to make sure: you're using the storefront API right? There is no rate limiting through that route.

Cheers.

0 Likes
Craig6
New Member
11 0 0

Hey Alex,

thanks for clarifying that! I wasn't sure if the limit applied to all API calls. 

0 Likes
typeoneerror
New Member
1 0 0

@Alex, can you explain why there is this page:

 

https://help.shopify.com/en/api/custom-storefronts/storefront-api/storefront-api-rate-limits

 


@Alex wrote:

Hey Craig,

Just to make sure: you're using the storefront API right? There is no rate limiting through that route.

Cheers.


It sounds like it is rate limited based on Shopify's documentation. Can you explain why you are saying there is no rate limiting?

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 293

Hey @typeoneerror.

 

That post was some time ago. I can't recall if it was said in error or if there was not a limit defined at that time, I'm guessing the latter. As of this moment, the documentation is the source of truth.

 

Cheers.

0 Likes
samullman
Tourist
10 3 3

Screen Shot 2020-05-13 at 10.15.20 AM.png

0 Likes