[SalesForce] Query API Limits

Is there a way to programmatically query how many API calls an organization has made for the 24-hour period? We have a program that imports data from external databases to SFDC in a fancy way, and we are trying to gauge how many API calls we are consuming. Furthermore, we import data from DBs of different sizes, and we would like to track how many API calls are consumed per database we import. Therefore, we are hoping that there is a solution similar to using the Limits class in APEX (so we can query how many API calls we have left for the 24-hour period both before and after we use our program, and then the difference should indicate how many API calls were consumed to import that DB).

Currently, we are referencing the API Usage via the System Overview link in the Setup and performing the calculation manually (which isn't sufficing). We also know of the API Usage Report, but we don't have enough available users to wield this report to satisfy our needs (have certain users import certain DBs over time, and we can watch/analyze the results).

Best Answer

Starting in a relativley recent release (I believe APIv29) the SOAP API (and possibly others) returns a header describing your org's API limits.

This LimitInfoHeader should be returned on all SOAP calls made from the APIv29 WSDL, and shows you the current use and 24hr rolling limit.

Related Topic