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
Shyamala VaradharajanShyamala Varadharajan 

How to download file through REST API in which size is more than 15 MB

Hi All,

In LWC screen I have a Export button where on click of that button I'm making an API callout(Synchronous Call). In response I'm getting size more than 25 MB. How to handle this as the size is very huge. Please help.
HarshHarsh (Salesforce Developers) 
Hi Shyamala,
  • You can use the HttpResponse method getBodyAsBlob to fetch the response as a file. In Async mode, this has a limit of 12 MB.
  • Get the authentication done in apex and using the access token do the callout from Javascript where these limits won't apply.
For more details please refer to the below links.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_api_calls_platform.htm 
 
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm

Please mark it as Best Answer if the above information was helpful.

Thanks.
 
Shyamala VaradharajanShyamala Varadharajan
Hi Harsh,

Thank you so much for the response. even if I use the getBodyAsBlob method and change it to async , if the size of the file goes more than 12MB then again its an issue. Is there any other work around for this?