0 votes
1 view
in Salesforce by (11.9k points)

Does anyone know how to retrieve the SFDC daily requests API limit through SOAP or REST? I don't see any call for this. Currently, I have to access this info at the Company Info page. I would like to retrieve this info at the code level for batch processing.

Thanks!

1 Answer

0 votes
by (31.6k points)

Try the following code to retrieve the SFDC daily requests API limits through SOAP or REST:

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;     

}

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...