2012-02-10 19 views
5

SOAPまたはRESTを通じてSFDCの毎日のリクエストAPI制限を取得する方法を知っている人はいますか?私はこれを求めていません。現在、私は会社情報ページでこの情報にアクセスしなければなりません。バッチ処理のコードレベルでこの情報を取得したいと思います。Salesforce Daily Apiリクエストの制限を取得する

ありがとうございます!

答えて

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('&nbsp;', ' '); 
    return result;  
} 

希望。

よろしく、 ルカシュ

+0

あなたの提案に感謝Lukasz!私はこれで遊ぶよ。 よろしく、 –

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

+2

ですか?特にエレガントではありませんが、あなたの唯一の選択肢かもしれません。 –

+0

現在、私たちはSFDC警告システム(例:apiが80%限界に近づいています)を使用してこのapi制限を監視する必要があります。 SFDCがapiでこのような呼び出しを実装したい場合や、誰かが回避策を知っていれば、コードからこの情報を取得するのが良いでしょう。ありがとう。 –

1

私は、REST APIを使用していました。 REST APIサービスURIで実行するHTTPメソッドGETを選択します。「/services/data/v31.0/limits」。 DailyApiRequestsデータを取得することができます。

それを返します:それはあなたがクライアント側で与えられた24時間の期間で行われてきた要求の数をカウントするために、完全には実現不可能

{ "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 } }

関連する問題