Using the RingCentral.Net SDK - how do retrieve the X-Rate-Limit-* headers from the responses ?
Using the RingCentral.Net SDK - how do retrieve the X-Rate-Limit-* headers from the responses ?
Hi,
Please check the below link
https://medium.com/ringcentral-developers/ringcentral-api-rate-limit-explained-2280fe53cb16
Thanks for the link but it does not show how to get the headers using the .Net SDK.
Using the RingCentral .Net SDK, you can check API limit header as shown below:
static RestClient rcsdk; static void Main(string[] args) { rcsdk = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_PRODUCTION); rcsdk.Authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD).Wait(); rcsdk.AfterHttpCall += EventHandler; } static void EventHandler(object sender, HttpCallEventArgs eventArgs) { var rateLimitRemaining = eventArgs.httpResponseMessage.Headers.First(i => i.Key == "X-Rate-Limit-Remaining").Value.First(); Console.WriteLine("Remaining: " + rateLimitRemaining); }
Hi Phong Vu,
I don't see AfterHttpCall in my ringcentral DLL. (Assembly RingCentral.Net, Version=1.0.0.0)
I am using Nuget Packaage.
Am I missing something...
RingCentral .NET SDK 5.x has major changes and there are many source breaks. It supports SDK extensions mechanism. And to catch the events, create and install the EventsExtension as shown below:
RestClient rcsdk = new RestClient(RC_CLIENTID, RC_CLIENTSECRET, RC_PRODUCTION); rcsdk.Authorize(RC_USERNAME, RC_EXTENSION, RC_PASSWORD).Wait(); var eventsExtension = new EventsExtension(); rcsdk.InstallExtension(eventsExtension).Wait(); eventsExtension.RequestSuccess += EventHandler; ... static void EventHandler(object sender, HttpMessages httpMessages) { var rateLimitRemaining = httpMessages.httpResponseMessage.Headers.First(i => i.Key == "X-Rate-Limit-Remaining").Value.First(); Console.WriteLine("Remaining: " + rateLimitRemaining); }
What do I have to do to make it work for EventsExtension as I am getting an error to create a namespace for it. Do I have to install some package from Nuget?
What do you mean by "create and install the EventsExtension as shown below: ". Can you clarify this?
@Carl McFarland Please go through below article about RingCentral .NET SDK 5 which supports extensions:
https://medium.com/ringcentral-developers/ringcentral-net-sdk-5-0-and-its-extensions-2992a5dc5caa
Check the Events extension:
https://github.com/ringcentral/RingCentral.Net/tree/master/RingCentral.Net.Events
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:
5 People are following this question.