3

I'm working on an application, which uses SOAP, REST and Bulk API to integrate with Salesforce.

Is there any API call in Salesforce which enables me to track how much API calls did I consume in a certain time frame?

I'm aware of 'API Calls Made Within Last 7 Days' report, however, I can't find any information on the application which made the calls. It gives me only the number of API calls made using a user's token.

Thanks in advance!

2 Answers 2

4

Every time you call a web method in the Partner API the response includes the Limit Info Header in the response.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <LimitInfoHeader>
         <limitInfo>
            <current>43</current>
            <limit>15000</limit>
            <type>API REQUESTS</type>
         </limitInfo>
      </LimitInfoHeader>
   </soapenv:Header>
   <soapenv:Body>
   <!-- ... -->
   </soapenv:Body>
</soapenv:Envelope>

The header is also available in the REST API - Limit Info Header

Sforce-Limit-Info: api-usage=25/5000;

With this you can monitor your API usage.


Merged from comment for completeness:

I'm interested in knowing how much API calls did my application consume. – Haris Osmanagić

This header is the global account across all applications. The documentation does mention a API REQUESTS PER APP pilot that will provide limit quota information for a connected app. You could try and get on this pilot. Otherwise it is usually best if the application tracks its own usage.

3
  • Hi Daniel! Thanks for the response. I'm aware of that header, but is the API usage described there global? I'm interested in knowing how much API calls did my application consume. Mar 11, 2015 at 7:44
  • 1
    This header is the global account across all applications. The documentation does mention a API REQUESTS PER APP pilot that will provide limit quota information for a connected app. You could try and get on this pilot. Otherwise it is usually best if the application tracks its own usage. Mar 11, 2015 at 18:56
  • Your last comment answers it, thanks a lot! The application already tracks its own usage, but I wondered if there was something already implemented. Mar 12, 2015 at 12:41
1

You can use Event Logs - new in Winter '15 - to collect metrics on each individual SOAP/REST call, and roll up those metrics using your favorite BI tool. You can find a lot of excellent information on Event Logs here: http://www.salesforcehacker.com/

There are a variety of vendors who are leveraging this feature, if you don't want to roll your own, including FairWarning, which I saw demoed at DreamForce: https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B5YHjEAN

1
  • Hi John! Thanks for the reply. However, EventLogFiles are, as far as I could see, available only after 24 hours. What I'd like to have, if that's possible, real-time, or near-real-time, data about how much API calls did the calling application consume. Mar 11, 2015 at 7:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .