We use Salesforce to manage our website logins & access to our products. If something goes wrong with our site or it gets attacked, we quickly go over our API call limit which means that our store & site go down. Is it possible to check where we are in terms of our API call limit so we can stop calling Salesforce before there's a problem (we're calling the SOAP API)? I've been looking through the developer docs & haven't been able to find anything that might help.
Is it possible to check how close we are to our API call limit before making a call through the API?
1 Answer
There is a header returned for both the SOAP API and REST API. See the documentation for details.
Responses appear as:
REST (header)
Sforce-Limit-Info: api-usage=18/5000
SOAP (SOAP header in XML payload)
<soapenv:Header>
<LimitInfoHeader>
<limitInfo>
<current>5</current>
<limit>5000</limit>
<type>API REQUESTS</type>
</limitInfo>
</LimitInfoHeader>
</soapenv:Header>
-
its in the soap api as well (in fact was in the soap api before the rest api). limit info is returned as a response soap header. Commented Nov 21, 2014 at 16:38
-
@superfell Thanks for that. I'd never seen in the documentation previously; every time I looked for it, I couldn't find it. I've found the related documentation and updated this answer.– sfdcfox ♦Commented Nov 21, 2014 at 16:57