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.
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.
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/
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,
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!