Newer Version Available
Post a Feed Element with a Code Block
This example posts a feed element that includes a code block.
- Resource
- /chatter/feed-elements
- HTTP method
- POST
- Request body
-
Feed Item Input
This Feed Item 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: Markup Begin request body, one Message Segment Input: Text request body, and one Message Segment Input: Markup End request body.
- Request body example
-
1{ 2 "body":{ 3 "messageSegments":[ 4 { 5 "markupType" : "Code", 6 "type" : "MarkupBegin" 7 }, 8 { 9 "text" : "<script>var i, t = 0;\nfor (i = 0; i < 5; i++) {\n t += 10 i;\n}\n</script>", 11 "type" : "Text" 12 }, 13 { 14 "markupType" : "Code", 15 "type" : "MarkupEnd" 16 } 17 ] 18 }, 19 "subjectId":"me", 20 "feedElementType":"FeedItem" 21} - Returns
- Feed Item