I am able to list and download any item that the Type=Attachment with no issue.
I can get a list of items where the Type=File.
How can I Download the items that are Files? I am using Salesforce Classic.
My SOQL query to get all files (where LinkedEntityId is the opportunity):
/services/data/v40.0/query/?q=SELECT+ContentDocumentId+FROM+ContentDocumentLink+WHERE+LinkedEntityId='0066f000018z4Fb'
the result:
stdClass Object
(
[totalSize] => 3
[done] => 1
[records] => Array
(
[0] => stdClass Object
(
[attributes] => stdClass Object
(
[type] => ContentDocumentLink
[url] => /services/data/v40.0/sobjects/ContentDocumentLink/06A6f00000MEMwkEAH
)
[ContentDocumentId] => 0696f00000FfoNEAAZ
)
.......
so then:
"/services/data/v40.0/sobjects/ContentVersion/0696f00000FfoNEAAZ/VersionData";
and the result:
[{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]1
I am trying to download Items 1,2, and 4
After trying what you mentioned:
/services/data/v40.0/query/?q=SELECT+Id,ContentDocumentId+FROM+ContentVersion+WHERE+ContentDocumentId='06A6f00000MEMwkEAH'
stdClass Object
(
[totalSize] => 0
[done] => 1
[records] => Array
(
)
)