I am making a callout and then trying to insert the data and then immediately I make another callout followed by insert operation. This process continues for users matching my criteria. How to avoid below exception?
I know that its not allowed to do a callout and a DML in series. But as per the requirement I need to follow this process.
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out
Note: I cannot use future method since I am running this process in a batch class.