有没有人知道如何通过SOAP或REST检索SFDC每日请求api限制?我没有看到任何要求。目前,我必须在公司信息页面上访问此信息。我想在代码级别检索此信息以进行批处理。
谢谢!
答案 0 :(得分:4)
此信息未在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
答案 1 :(得分:3)
我们正在使用自定义代码来解决此问题:
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;
}
希望有所帮助。
此致 卢卡斯
答案 2 :(得分:1)
我使用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
}
}