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
Satish Kumar LalamSatish Kumar Lalam 

how do I attach file to FeedItem record using rest api?

VinayVinay (Salesforce Developers) 
Hi Satish,

Check similar ask below to attach to feed Item using Rest API.

https://salesforce.stackexchange.com/questions/333242/how-to-get-access-to-attachments-in-case-feed-item-using-rest-api

Please mark as Best Answer if above information was helpful.

Thanks,
Arun Kumar 1141Arun Kumar 1141

Hi Satish,

To attach a file to a FeedItem record using the Salesforce REST API, authenticate and obtain an access token, create the FeedItem record with the desired message, retrieve the FeedItem ID, attach the file to the FeedItem using the parent ID, and verify the attachment.

If above answer helped you mark it as best answer.

Thank You!

fransecca jeanfransecca jean
According to my knowledge obtain the necessary authentication credentials and access token to make authenticated requests to the REST API. This typically involves registering a connected app in your Salesforce org and obtaining the client ID and client secret or authenticate your API request by including the access token in the request header. You can do this by including an "Authorization" header with the value "Bearer [access_token]". Create the FeedItem record by making a POST request to the appropriate endpoint. The endpoint for creating FeedItems is usually /services/data/vXX.X/chatter/feed-items/. Set the required fields for the FeedItem record. At a minimum, you need to specify the body field, which contains the content of the feed item. You can also provide additional fields like attachment, capabilities, and feedElementType.
fransecca jeanfransecca jean
As i know where a user is asking how to access attachments in a Case Feed Item using the Salesforce REST API so you need to obtain the ID of the Case Feed Item for which you want to retrieve attachments and replace vXX.X with the appropriate Salesforce API version, and CaseFeedItemId with the ID of the Case Feed Item obtained in step 1. After that once you have the attachments' ContentDocumentId, you can use the following REST API endpoint to retrieve the details.  https://www.targetpayandbenefits.review/