0

In looking at the Apex Developer Guide, I see examples of how to use Apex REST to perform actions with Salesforce but I would like to know if Apex REST can interact with other REST APIs to pull binary data for copying documents from another source? I'm not sure if this would require some kind of encapsulation of the other REST API calls in an Apex script, but I'm trying to do it in a way to where the code is stored in Salesforce and calls the third-party REST API to transfer the data

closed as unclear what you're asking by Sebastian Kessel, David Reed, glls, Brian Mansfield, battery.cord May 21 '18 at 17:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

Yes, you can call any endpoint you've authorized during an Apex REST transaction. Normal synchronous limits apply (6MB maximum response size). Some types of payloads may be more challenging than others because of Apex Code's limited support for binary data, but as long as the REST API you're trying to call is reasonably designed, it shouldn't be a problem. You can use the getResponseAsBlob method of HttpResponse to read the binary data, which you can then directly into an Attachment, Document, ContentDocument, etc.

Not the answer you're looking for? Browse other questions tagged or ask your own question.