Overview
Imagine you’re in a busy coffee shop, and the barista can only take a certain number of orders at a time to keep things running smoothly. If too many people place orders all at once, the shop slows down or might even stop serving for a bit to catch up. This is similar to how API rate limiting works.
Rate limiting is the “rules” that control how many requests a user or system can make to an API within a specific time frame. By enforcing these limits, APIs prevent overloads, ensure fair use, and keep the system working efficiently for everyone. In this article, we'll go over how to handle API rate limiting within your Tines stories.
Tines references
Before getting started, we recommend familiarizing yourself with the surrounding functionality this article covers:
Note: We always recommend reading your API platform's documentation for specifics on their API rate limiting boundaries.
Make it happen
Leverage HTTP request action options
By leveraging HTTP request action options like Retry on Status
and Retries
, we can handle these rate limits gracefully.
In this video, we show how to apply these two options for an HTTP request action that returned a 429
("Too Many Requests") API response code.
Create dynamic delays
Sometimes it’s necessary to explode an array to feed into an HTTP request action, one value at-a-time. By applying dynamic delays; whether by using basic math functions, or applying chronic language, we can control the rate at which data is processed.
In this video, we look at an example of building out a delay in a story.
Apply throttling via throttle mode
Throttling helps to control the pacing of events in your story. For API rate limiting, throttling specifically applies to events feeding into the HTTP requests actions, ensuring we stay within the allowed rate limits while still efficiently processing data.
In this video, we look at an example of applying a throttle in a story.
Review the results
As we discussed in this article, Tines offers multiple ways to approach API rate limiting as you continue to build. Understanding rate limiting effectively is key to constructing reliable and scalable stories.