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
guisimguisim 

Retrieving all Attachment body with the least API calls

Hi !

 

I want to download the binary body of all the attachments in my organization. I'd like to do so with the least amount of API calls.

It is my understanding that the SOAP API returns a single body (in base64) for each "page" of result (aka you need to use "queryMore" once for every attachment)

 

The problem with this approach is that it costs one API call for each attachment. For other objects where there is no base64 field, you can easily retrieve 1000 items within a single page.

 

The REST API is similar. You can get multiple attachments within a single response but the response does not contain the body itself. It contains an URL to get the body.. so you end up having to do one extra call anyway.

 

Is there a way to get multiple body within a single response ?

 

What is the most "API call" efficient way to get all the attachment bodies ?

 

Thanks !