question

Angelo Bevilacqua avatar image
Angelo Bevilacqua asked Angelo Bevilacqua commented

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

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 Angelo Bevilacqua edited
1 comment
1 |1000

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

Angelo Bevilacqua avatar image Angelo Bevilacqua commented ·

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 Angelo Bevilacqua commented

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

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

Angelo Bevilacqua avatar image Angelo Bevilacqua commented ·

Perfect, thanks for all your help.

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.