首页 > 解决方案 > C# 中有没有办法知道 DocuSign API 调用限制?

问题描述

我想以编程方式监控 DocuSign API 调用限制。我想知道是否有办法在 C# 中做到这一点。

标签: docusignapi

解决方案


是的,有,但这不是一个明显的方法。

您需要分析来自 http 调用的响应标头。

ApiResponse<EnvelopeSummary> results = envelopesApi.CreateEnvelopeWithHttpInfo(accountId, envelopeDefinition);results.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
ApiResponse<EnvelopeSummary> results = envelopesApi.CreateEnvelopeWithHttpInfo(accountId, envelopeDefinition);
results.Headers.TryGetValue("X-RateLimit-Reset", out string reset);
Console.WriteLine("API calls remaining: " + remaining);
Console.WriteLine("Next Reset: " + reset); // Unix timestamp

此博客文章中的更多详细信息 - https://www.docusign.com/blog/dsdev-from-the-trenches-working-with-headers-in-docusign-sdks/

(我假设您的意思是实时值,而不是帐户级别设置。您也可以获取后者,让我知道)


推荐阅读