【发布时间】:2012-02-10 00:40:57
【问题描述】:
有谁知道如何通过 SOAP 或 REST 检索 SFDC 每日请求 api 限制?我没有看到任何呼吁。目前我必须在公司信息页面访问此信息。我想在代码级别检索此信息以进行批处理。
谢谢!
【问题讨论】:
标签: api soap salesforce
有谁知道如何通过 SOAP 或 REST 检索 SFDC 每日请求 api 限制?我没有看到任何呼吁。目前我必须在公司信息页面访问此信息。我想在代码级别检索此信息以进行批处理。
谢谢!
【问题讨论】:
标签: api soap salesforce
此信息未在 API 中公开。
从 Salesforce Spring '15 和 REST API 版本 29.0 开始,/limits 资源可用于检索此信息。 https://developer.salesforce.com/releases/release/Spring15/restapi
此外,每个 REST 响应都会返回 Sforce-Limit-Info 标头。
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_api_usage.htm
【讨论】:
我们正在使用自定义代码来解决此问题:
WebService static string GetAPIUsage() {
PageReference pr = new PageReference('/00D20000000HsCQ');//use id of setup page
pr.setRedirect(false);
String result = pr.getContent().toString();
Integer start_index = result.indexOf('API Requests, Last 24 Hours', 1) + 52;
Integer end_index = result.indexOf('<', start_index);
result = result.substring(start_index, end_index);
result = result.replaceAll(' ', ' ');
return result;
}
希望对您有所帮助。
问候, 乌卡斯
【讨论】:
我使用了 REST API。选择要在 REST API 服务 URI 上执行的 HTTP 方法 GET:“/services/data/v31.0/limits”。它允许我获取 DailyApiRequests 数据。
返回:
{
"ConcurrentAsyncGetReportInstances" : {
"Remaining" : 200,
"Max" : 200
},
"ConcurrentSyncReportRuns" : {
"Remaining" : 20,
"Max" : 20
},
"DailyApiRequests" : {
"Remaining" : 14995,
"Max" : 15000
},
"DailyAsyncApexExecutions" : {
"Remaining" : 250000,
"Max" : 250000
},
"DailyBulkApiRequests" : {
"Remaining" : 5000,
"Max" : 5000
},
"DailyStreamingApiEvents" : {
"Remaining" : 10000,
"Max" : 10000
},
"DailyWorkflowEmails" : {
"Remaining" : 390,
"Max" : 390
},
"DataStorageMB" : {
"Remaining" : 5,
"Max" : 5
},
"FileStorageMB" : {
"Remaining" : 20,
"Max" : 20
},
"HourlyAsyncReportRuns" : {
"Remaining" : 1200,
"Max" : 1200
},
"HourlyDashboardRefreshes" : {
"Remaining" : 200,
"Max" : 200
},
"HourlyDashboardResults" : {
"Remaining" : 5000,
"Max" : 5000
},
"HourlyDashboardStatuses" : {
"Remaining" : 999999999,
"Max" : 999999999
},
"HourlySyncReportRuns" : {
"Remaining" : 500,
"Max" : 500
},
"HourlyTimeBasedWorkflow" : {
"Remaining" : 50,
"Max" : 50
},
"MassEmail" : {
"Remaining" : 10,
"Max" : 10
},
"SingleEmail" : {
"Remaining" : 15,
"Max" : 15
},
"StreamingApiConcurrentClients" : {
"Remaining" : 20,
"Max" : 20
}
}
【讨论】: