Newer Version Available

This content describes an older version of this product. View Latest

Post a Comment and Include a File from Salesforce

Post a comment with a Salesforce file in Chatter.

This example posts a comment with a file that has already been uploaded to Salesforce. To upload a new file, see Uploading Binary Files.

Resource
/chatter/feed-elements/feedElementId/capabilities/comments/items
HTTP method
POST
Request body
Comment Input

This Comment Input request body includes a body property that is a Message Body Input request body. In this example, the Message Body Input request body includes a messageSegments property that has one Message Segment Input: Text request body.

This Comment Input request body also includes a capabilities property that is a Comment Capabilities Input request body. In this example, the Comment Capabilities Input includes a content property that is a Content Capability Input request body.

Request parameter
text
Request body example
1{
2   "body":{
3      "messageSegments":[
4         {
5            "type":"Text",
6            "text":"Please take a look at this file."
7         }
8      ]
9   },
10   "capabilities":{
11      "content":{
12         "contentDocumentId":"069D00000001pyS"
13      }
14   }
15}
Returns
Comment