restapisalesforcesalesforce-lightningsalesforce-chatter

How to get a list of all the attached files of the specific sobject record?


Salesforce has two different UIs and in accordance with it, it has the possibility to store attached files differently.

Two files were uploaded via the classic UI. They marked as attachments and I know how to get them using request to GET /services/data/v47.0/sobjects/Attachment

I want to find all the files that were uploaded through the new UI associated with this 'NewAccount2020'. How can I achieve my goal using REST API?

I guess these files can be retrieved using Chatter REST API. However, I did not find anything that could solve my problem.

enter image description here


Solution

  • Attachments in Lightning are stored as ContentDocument type, within Files.
    This blog post walks through how to access the attachments for a record, plus an example Js app to download the files: https://crmcog.com/retrieve-sfdc-attachments-using-rest/