+ Start a Discussion
Prabhat Gangwar007Prabhat Gangwar007 

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

i want display inside vf page with bifurcate each API

Like Soap : 20 Used  , 10 Remains

RbnRbn
Hi Vipin,

Navigate to Remote Site Settings - Create  a new site Name - Under Remote site URL(Give the name of your Salesforce org)

And then try to execute the below code in your developer console to check if you get the desired requirement, and then you can implement the same in your vf page.
 
HttpRequest req = new HttpRequest();
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
req.setHeader('Content-Type', 'application/json');
req.setEndpoint('https://cs22.salesforce.com/services/data/v33.0/limits/');//This line should consists your Salesforce org URL
req.setMethod('GET');      
Http h = new Http();
HttpResponse res = h.send(req);  
system.debug('Limit'+res.getBody());

Mark it as Answer if it resolves your requirement.

Thank you!!
charforcecharforce
You will also need to use the JSONParser class to parse the JSON response. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_json_jsonparser.htm