Andrew_Shatz | 2017-05-22 19:48:44 UTC | #1
I am currently developing an application to pull historical call metadata and audio for analysis for very large clients. As such, I am often coming into conflict with the rate limiting present within the Purecloud API. While trying to create an effective throttling mechanism within my application, I discovered that the rate limiting for the Purecloud API is separated amongst multiple queues by "route family" so to speak. For example, any routes that fall within the Analytics, Conversations, or Routings APIs have a maximum allowed rate of 300 requests per minute, routes within the Users API have a maximum allowed rate of 180 requests per minute, and routes within the Recordings API have a maximum allowed rate of 120 requests per minute.
Looking around, I have not been able to find any documentation regarding the rate limits for particular "route families". Does this documentation exists, and if not, could it please be made available? Thank you for your time.
tim.smith | 2017-05-22 22:32:48 UTC | #2
Generally, resources are set at 300 requests per minute, but there are some APIs that individually have lower limits because they are more costly. The rate limits for APIs are not explicitly documented because they are subject to change at any time; they are reviewed periodically and altered to ensure that PureCloud remains stable.
A performant application will dynamically throttle itself based on the information contained in the headers (documented here: API Rate Limiting and when it receives 429 responses. Your application could keep track of the rate limit max it receives for each resource and use some logic to determine if it can make requests to a given resource even after getting rate limited by others. If you choose to do this, just be careful that you aren't triggering an excessive amount of 429s.
Andrew_Shatz | 2017-05-23 14:34:29 UTC | #3
OK. Thank you Tim for the reply. I do not need to know the exact allowed number of requests per second for the routes, but instead which group of routes fall under a particular rate limiting queue. As for right now, I am persisting rate limit data in a dictionary in which the key is an enum that represents a particular route group (Conversations, Recordings, Users, etc). Thus before a request is send to the API over HTTP, it passes through a handler that looks at the rate limit headers from the previous request sent to a route in that particular route group. If the allowed requests per minute has not yet been reset, it assesses whether the current request count exceeds 95% of the total request allowance per minute. If this is the case, it locks the request and any additional requests form executing until the rate limit resets.
Having an understanding of the routes and corresponding route queues would better help identify the conceptual identification and naming of these enum keys, for I have working at this on a trial-by-error basis.
tim.smith | 2017-05-23 14:41:08 UTC | #4
Thanks for the additional info. We're currently looking into some improvements surrounding rate limiting communication, so hopefully this will get easier in the future.
There's no straightforward way to produce documentation as it stands today as the rate limits are hard coded into each resource. But the general groupings (similar to api categories) that may have lower limits are token, content management, phone provisioning, recording, notifications, users, and search.
system | 2017-06-23 14:54:36 UTC | #5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 1322