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
AltranAltran 

Exceeding the API Limit

Hi,

 

We are getting the error below in a visualforce page because we have exceeded the API limit.

How can we use/visualize the page again? Should we contact salesforce support?

 

 

Uncaught {faultcode:’sf:REQUEST_LIMIT_EXCEEDED’, faultstring:’REQUEST_LIMIT_EXCEEDED: TotalRequests Limit exceeded.’, detail:{UnexpectedErrorFault:{exceptionCode:’REQUEST_LIMIT_EXCEEDED’, exceptionMessage:’TotalRequests Limit exceeded.’, }, }, }

 

 

Many Thanks,

Altran

 

 

 

Scott_VSScott_VS

Rate limits and managing your resource usage is one of the core fundamentals of Salesforce development. Once you have blown through your API limit, you will have to wait 24 hours to be able to get back to using it.

 

So the question is why are you calling the API so much and is there any way to reduce the amount of time you call it? A Visualforce page shouldn't have to call the API because you can use an Apex controller.

AltranAltran

Hi,

 

We are doing some experiments with Google Charts API. May be this was the cause of  the problem of the too many API calls.

 

 

Thanks,

Altran

Scott_VSScott_VS

Calling Google Charts doesn't count towards your API limit. You're only being limited by calls to the Salesforce API.

 

Are you using the AJAX toolkit on your VF page to call Salesforce from JavaScript?

AltranAltran

Hi,

 

Yes, we are using Ajax and Jquery

 

  <script src="https://na1.salesforce.com/soap/ajax/23.0/connection.js" type="text/javascript"></script>
  <script src="https://na1.salesforce.com/soap/ajax/23.0/apex.js" type="text/javascript"></script>

 

 

  <!-- Load JQuery -->
  <apex:includeScript value="{!URLFOR($Resource.JQuery_1_7_2)}"/>
  <apex:includeScript value="{!URLFOR($Resource.jquery_qtip_min_js)}"/>

 

 

Thanks,

Altran

 

SFFSFF

Why are you calling Salesforce APIs from within Visualforce? That doesn't make any sense - that's what the controller is for.

AltranAltran

Hi,

 

 

Because we need to use javascript and query Force.com objects. Is there a way to call apex controller methods from within the javascript?

 

Thanks,

Altran 

Janet GuoJanet Guo

You can use JavaScript with Visualforce the same way you can use JavaScript in HTML. Here's a snippet to get you started.

 

You can also access an Apex method through JavaScript by using custom SOAP Web service calls.

 

The JavaScript would look something like this:

var result = sforce.apex.execute(
                        'ApexClass', // class name
			'query', // methodName
			{ // arguments listed here
			    arg: '{!Opportunity.Id}',
			});

 

where the Apex class might look something like this:

global class ApexClass{
       WebService static void query(String arg){
// Do whatever you need to do as if you were instead a normal Apex method
} }

 

If you need to get a result from the Apex class inside the JavaScript, just dump all of it into a list and return it at the end of the Apex method. Then use the JavaScript to parse the results.