How to check API Request Limit using Apex in Salesforce?

Using OrgLimit Class, we can check API Request Limit using Apex in Salesforce.

Sample Code:

  1. Map < String,System.OrgLimit > limitsMap = OrgLimits.getMap();  
  2. System.OrgLimit apiRequestsLimit = limitsMap.get( 'DailyApiRequests' );  
  3. System.debug( 'Limit Name: ' + apiRequestsLimit.getName() );  
  4. System.debug( 'Usage Value: ' + apiRequestsLimit.getValue() );  
  5. System.debug( 'Maximum Limit: ' + apiRequestsLimit.getLimit() );  

Output:


No comments:

Post a Comment