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

API calls from batch

HI i was just wondering can you call a REST API service from a batch class?



And also the API resonpose can only take one request in 3 secs. So can is there can we make a API call with a time delay in it?


Any help will be much appreciated.





The batch size you can keep is 5 and the maximum no of calls allowed per batch context is 10. Remember to mention Allowcallouts=true on batch context.

You can’t make a callout when there are pending operations in the same transaction. Things that result in pending operations are DML statements, asynchronous Apex (such as future methods and batch Apex jobs), scheduled Apex, or sending email. You can make callouts before performing these types of operations.