# How to Use the SOAP API With Attachments

By default, CopyStorm will use the Salesforce REST API for Attachments and other tables which contain BASE64 columns. REST is used by default because it minimizes the amount of memory needed by CopyStorm (See the technical details section at the end of this document is you are interested in the details).

If using the REST API is a problem then a simple CopyStorm configuration file change can force the SOAP API to be used instead. The primary need we have seen for this is when a local virus checker or network filter is blocking attachment downloads from Salesforce.

## Make CopyStorm use the SOAP API for Attachments

Open the file \[CopyStorm]/config/TableRuleRegistry.xml and change:

`<TableRule name="Attachment" predicate="bodyLength&lt;800000000" />`

to

`<TableRule name="Attachment" predicate="bodyLength&lt;800000000" useRestAPI="false"/>`

Alternatively, if you are using a custom directory of CopyStorm configuration files, simply add the following rule to your private TableRuleRegistry.xml file.

`<TableRule name="Attachment" useRestAPI="false"/>`

## Technical Details

Since Salesforce SOAP API returns an entire attachment in a single response, the amount of memory required to parse the response and send the attachment to a target database can be huge (for huge attachments). The Salesforce REST API can be used to avoid loading an entire attachment into memory. Here is why:

* The REST API returns an attachment BODY as a hyperlink.
* CopyStorm downloads the hyperlink to a temporary file (taking very little memory).
* The temporary file is loaded directly into the target database without ever being loaded into CopyStorm memory. No all database support this feature but those that do minimize CopyStorm memory usage.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.capstorm.com/frequently-asked-questions/problems-solutions/how-to-use-the-soap-api-with-attachments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
