function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Prabhat Gangwar007Prabhat Gangwar007 

how to Get number of total used \remaining API calls for ORG in APEX ?

I  want dispaly into visualforce page 

how to Get number of total used \remaining API calls for ORG in APEX  , bifurcate each API call

like

Soap API : 20 used , 10 Remain

Rest API : 10 Used , 10 Remain 

how ?

 

UC InnovationUC Innovation
Hi Vipin,

Look into the limit apex class. I believe what you're looking for is getCallouts() and getLimitCallouts().

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_limits.htm

Here's some additional documentation regarding API callout limits:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_timeouts.htm

Hope this helps!
Prabhat Gangwar007Prabhat Gangwar007

Thanks !

I used getCallouts() method of limit class but it was not filling me actual requirment , it was giving only Total callout .
 

UC InnovationUC Innovation
Hi Vipin,

Your other requirement is to get the remaining calls left right? Just use getLimitCallouts() for that.

Please make sure to mark the best answer if this helped find your solution!
UC InnovationUC Innovation
I'm not sure if it's possible to differentiate the type of callout, at least not with the Limit class. Anyway, I don't think there's a need to differentiate whether it is a SOAP or REST api call, the salesforce limit only cares about how many total API calls there are, regardless of the type of API call.