question

Angelo Bevilacqua avatar image
Angelo Bevilacqua asked ·

C# SDK - Get X-Rate-Limit headers from response

Using the RingCentral.Net SDK - how do retrieve the X-Rate-Limit-* headers from the responses ?

sdk
1 |1000 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.

Khadhar Koneti avatar image
Khadhar Koneti answered ·
1 comment
1 |1000 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.

Thanks for the link but it does not show how to get the headers using the .Net SDK.

0 Likes 0 ·
Phong Vu avatar image
Phong Vu answered ·

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);
}
1 comment
1 |1000 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.

Perfect, thanks for all your help.

0 Likes 0 ·
Ravindra Jumrani avatar image
Ravindra Jumrani answered ·

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...

1 comment
1 |1000 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.

What version of the RingCentral .NET SDK do you use?

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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