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
paul-lmipaul-lmi 

question on batch apex and HTTP callouts

knowing that the callout limit is 10 per Apex transaction, I just wanted to confirm that this would be per batch execution, and not 10 total for the whole batch.

 

For instance, if I have a batch that is to iterate over 10 records in a table, and I set the batch scope to 1, I'd be able to execute a max of 10 callouts per record that I'm iterating in the batch.  Does that sound right?

 

I'm looking to "synch" our community from a 3rd party platform via webservices, every couple hours, rather than execute callouts on every page load that needs the data, so we can reduce latency on Visualforce pages where this content can be "cached" in Salesforce objects instead of on demand.

SennahSennah

AFAIK it's 10 per context. That means also when you process more then one record in one batch you'll only have 10 callouts.

Can you put more then one record into one callout maybe?

paul-lmipaul-lmi

I can't do more than one per callout.  Each callout would be returning a set of threads based on the ID of a forum that's I'd pass to the callout.

forecast_is_cloudyforecast_is_cloudy

Paul - you're correct. All Apex governor limits are reset after each execution of an Apex Batch job. You would therefore get 10 HTTP callouts for each batch execution.

paul-lmipaul-lmi

tyvm

JarrettKJarrettK

I am researching a similar scenario.  I am going to need to call an external webservice on 500 records.  The webservice is not provisioned for more than one detail item per request.  What is the best way to approach this?