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
Cloud AtlasCloud Atlas 

System.CalloutException: Exceeded max size limit of 6000000

Hello,
I am making a callout to an external API and am getting limit exception as the response seesm to be greater than 6 MB limit.
I already knew the Governor Limits but due to certain constraints we couldn't chunk out the response from database side.
Now SFDC needs to process the reponse correctly.

Does any one have an idea how can I divide the response into groups  so as to be able to process them correctly, without getting limit exception??

The callout is being made via Batch Job.
Since I am still writing the batch job, I tested the response with Anonymous Block and the exception occurred.
Will the batch job be able to divide and handle the response ??

Any help is appreciated.
Thanks!
Best Answer chosen by Cloud Atlas
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Cloud,
  •  This error message is due to a maximum size of call out response which is 6MB.This error is typical because of the following issue 
              a) (Maximum size of callout request or response) 
              b) maximum allowed heap size (6MB sync / 12MB async).  I hope it will be helpful.

Please mark it as best answer if the information is informative.

BestRegards
RahulKumar

  (https://help.salesforce.com/apex/HTViewSolution?urlname=How-to-avoid-the-Apex-heap-limit-error&language=en_US )