[SalesForce] Most API call efficient way to retrieve all attachment bodies

I need 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 attachment 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 to download the body from this URL.

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

EDIT:
The solution needs to be automated. I suspect the bulk API might do what I need.

Best Answer

If this is a one time export or monthly export that needs to be done, you can use the Monthly Export Service built in to Salesforce. Go to Setup->Data management->Data Export and click "Export Now" or "Schedule Export" and make sure "Include images, documents, and attachments" is checked along with any other data you want to export. Salesforce will export the data, zip it up and e-mail you when the export is available for download.

Related Topic