Newer Version Available

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

Post a Rich-Text Comment

This example posts a comment that includes two paragraphs, one in bold, and an extra line break between them.

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 three Message Segment Input: Text request bodies, four Message Segment Input: Markup Begin request bodies, and four Message Segment Input: Markup End request bodies.

Request body example
1{
2   "body":{
3      "messageSegments":[
4         {
5            "markupType" : "Paragraph",
6            "type" : "MarkupBegin"
7         },
8         {
9            "markupType" : "Bold",
10            "type" : "MarkupBegin"
11         },
12         {
13             "text" : "First line of text.",
14             "type" : "Text"
15         },
16         {
17            "markupType" : "Bold",
18            "type" : "MarkupEnd"
19         },
20         {
21            "markupType" : "Paragraph",
22            "type" : "MarkupEnd"
23         },
24         {
25            "markupType" : "Paragraph",
26            "type" : "MarkupBegin"
27         },
28         {
29            "text" : " ",
30            "type" : "Text"
31         },
32         {
33            "markupType" : "Paragraph",
34            "type" : "MarkupEnd"
35         },
36         {
37            "markupType" : "Paragraph",
38            "type" : "MarkupBegin"
39         },
40         {
41            "text" : "Second line of text.",
42            "type" : "Text"
43         },
44         {
45            "markupType" : "Paragraph",
46            "type" : "MarkupEnd"
47         }
48      ]
49   }
50}
Returns
Comment