question

andrew-smedley323 avatar image
andrew-smedley323 asked benjamin-dean answered

ringcentral-csharp: Handling 429 Exception - Too Many Requests

I'd like to know how best to handle the 429 Error when using the ringcentral-csharp SDK. When the HttpResponseMessage is returned with an error code outside of 200-299, the Response constructor throws an exception. The exception does not contain details of the status error nor the headers of the HttpResponseMessage. According to the documentation: https://developer.ringcentral.com/api-docs/latest/index.html#!#HttpStatusCodes.html 429 - Too Many Requests The number of requests is exceeded. It typically means that the client is throttled by the server due to too high request rate. Specific retry period in seconds may be specified in Retry-After response header I expected to check the status myself and detect the 429 error, inspect the response header and handle the delay before retrying. A cannot see a way to handle this error myself and read the header for Retry-After. At the moment, it look like I need to inspect the string of the error for specific text and then delay 60 seconds. Is there a better way to handle this issue? If the exception was not thrown, I believe that would solve this particular issue but I am unsure of the side effects that this would cause.

sdk
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

benjamin-dean avatar image
benjamin-dean answered
There are a few use-cases when a 429 HTTP response will be returned:
  1. If your app/integration exceeds 10 requests per second to our OAuth resource
  2. If your app/integration exceeds 10 requests per second to the Call Log resource
  3. If your app/integration exceeds 20 requests per minute to any other API resource
Additionally, if you're making too many requests per second (3 is the recommended maximum) you'll also receive the 429 response.

Make sure that you're not exceeding this basic API limits and you should be good. Let me know if you continue experiencing this issue.
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys