function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Joe Prempeh 7Joe Prempeh 7 

How can I access Files in Notes and Attachments through REST API?

I am looking for a way to access the Notes and Attachments section on a custom object called Assets__c. I am using the Force.com REST API to access the platform, and on the UI, there is a notes and attachment section that lists the files that have been uploaded using Chatter. I want to know the URL and method by which I can access these files and how/if I will get a direct link to those attachments that I can then use client side.

Any help would be incredible! Thanks!
Best Answer chosen by Joe Prempeh 7
Daniel BallingerDaniel Ballinger
You might find the Working with Salesforce Files (https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/features_files.htm) documentation useful to get the REST resource that lists the related files. At a guess I'd say try /chatter/feeds/record/​recordId/feed-elements

A direct SOQL query is also possible against Note (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_note.htm) and Attachment (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_attachment.htm)

All Answers

Daniel BallingerDaniel Ballinger
You might find the Working with Salesforce Files (https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/features_files.htm) documentation useful to get the REST resource that lists the related files. At a guess I'd say try /chatter/feeds/record/​recordId/feed-elements

A direct SOQL query is also possible against Note (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_note.htm) and Attachment (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_attachment.htm)
This was selected as the best answer
Amack DawgAmack Dawg
Thanks for the link @Daniel Ballinger- I have tried a basci query with the REST API in Workbench but workbench is not recognizing the endpoint (I am using API version 41.0)


Here are the calls I have tried so far:

GET /connect/files/describe
GET /connect/files/[recordId]

GET /services/data/v41.0/sobjects/SalesforceFiles

We converted our Attachements/Notes into the Lightning Files system a few months back, and I am trying to specifically access a file's Record Id:
0690P000002hZOF
^ Does that even look like the Object prefix for the Files sobject? I wish Salesforce gave mapping table that let users map prefixes to the Object name...