0

I am trying to pull in an attachment from a case in salesforce to a separate web application. I am able to get the ContentDocument properties but not the actual binary.

Here is the endpoint I am using now to get the properties.

/services/data/v41.0/sobjects/ContentDocument/0690n000000A1a1AAC

I saw in older posts that when this was stored in the attachments object you could just as /body at the end. That doesn't work for the ContentDocument.

Any direction to documentation would be appreciated.

  • pretty sure you have to fetch the contentVersion for that – glls Mar 22 '18 at 18:27
  • @glls and that object connects to the contentDocument I am assuming. I'll take a look at that. – Crash667 Mar 22 '18 at 18:35
  • indeed, via ContentDocumentId – glls Mar 22 '18 at 18:36
  • @glls That looks to be it. Then its the VersionData part of the object? I see a contentBodyId? Also if you put that as an answer, I will accept it. Otherwise I will add the answer myself. – Crash667 Mar 22 '18 at 18:43
0

To get the the raw data of the document, you actually need to query ContentVersion, which is related via the ContentDocumentId.

From there, you can access the VersionData field (amongst others)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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