Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_AltText
string ls_HtmlTag
string ls_MarkupType
string ls_Text
integer li_IsRichText
string ls_Text
integer li_IsEditRestricted
string ls_IsEditableByMeUrl
string ls_LastEditedBy
string ls_LastEditedDate
integer li_LatestRevision
string ls_RelativeLastEditedDate
string ls_FeedEntityStatus
integer li_IsApprovableByMe
integer li_DownVoteCount
string ls_MyVote
integer li_UpVoteCount
integer li_IsVerifiableByMe
integer li_IsVerified
string ls_IsVerifiedByAnonymized
string ls_LastVerifiedByUser
string ls_LastVerifiedDate
string ls_ClientInfo
string ls_CreatedDate
string ls_Id
string ls_V_Url
string ls_Id
integer li_IsDeleteRestricted
string ls_CurrentPageToken
string ls_CurrentPageUrl
string ls_NextPageToken
string ls_NextPageUrl
string ls_PreviousPageToken
string ls_PreviousPageUrl
integer li_Total
string ls_LikesMessage
string ls_ModerationFlags
string ls_MyLike
string ls_ParentId
string ls_ParentUrl
string ls_RelativeCreatedDate
integer li_ThreadLevel
string ls_ThreadParentId
string ls_V_type
string ls_Url
string ls_AdditionalLabel
string ls_CommunityNickname
string ls_CompanyName
string ls_DisplayName
string ls_FirstName
string ls_UserId
integer li_IsActive
integer li_IsInThisCommunity
string ls_LastName
string ls_Color
string ls_LargeIconUrl
string ls_MediumIconUrl
string ls_SmallIconUrl
string ls_SvgIconUrl
string ls_MySubscription
string ls_Name
string ls_Message
string ls_FullEmailPhotoUrl
string ls_LargePhotoUrl
string ls_MediumPhotoUrl
string ls_PhotoVersionId
string ls_SmallPhotoUrl
string ls_StandardEmailPhotoUrl
string ls_PhotoUrl
string ls_Reputation
string ls_Title
string ls_V_Type
string ls_UserUrl
string ls_UserType
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "body": {
// "messageSegments": [
// {
// "type": "Text",
// "text": "Editing a comment"
// }
// ]
// }
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("body.messageSegments[0].type","Text")
loo_Json.UpdateString("body.messageSegments[0].text","Editing a comment")
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Http.SetRequestHeader("Content-Type","application/json")
loo_SbRequestBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_Resp = loo_Http.PTextSb("GET","https://domain.com/services/data/v{{version}}/chatter/comments/:COMMENT_ID",loo_SbRequestBody,"utf-8","application/json",0,0)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "body": {
// "isRichText": true,
// "messageSegments": [
// {
// "altText": null,
// "htmlTag": "p",
// "markupType": "Paragraph",
// "text": "",
// "type": "MarkupBegin",
// "url": null
// },
// {
// "text": "Comment",
// "type": "Text"
// },
// {
// "htmlTag": "p",
// "markupType": "Paragraph",
// "text": "\n",
// "type": "MarkupEnd"
// }
// ],
// "text": "Comment\n"
// },
// "capabilities": {
// "edit": {
// "isEditRestricted": false,
// "isEditableByMeUrl": "/services/data/v58.0/chatter/comments/0D7.../capabilities/edit/is-editable-by-me",
// "lastEditedBy": null,
// "lastEditedDate": null,
// "latestRevision": 1,
// "relativeLastEditedDate": null
// },
// "status": {
// "feedEntityStatus": "Published",
// "isApprovableByMe": true
// },
// "upDownVote": {
// "downVoteCount": 0,
// "myVote": "None",
// "upVoteCount": 0
// },
// "verified": {
// "isVerifiableByMe": false,
// "isVerified": false,
// "isVerifiedByAnonymized": null,
// "lastVerifiedByUser": null,
// "lastVerifiedDate": null
// }
// },
// "clientInfo": null,
// "createdDate": "2023-11-22T11:19:50.000Z",
// "feedElement": {
// "id": "0D5...",
// "url": "/services/data/v58.0/chatter/feed-elements/0D5..."
// },
// "id": "0D7...",
// "isDeleteRestricted": false,
// "likes": {
// "currentPageToken": null,
// "currentPageUrl": "/services/data/v58.0/chatter/comments/0D7.../likes",
// "items": [
// ],
// "nextPageToken": null,
// "nextPageUrl": null,
// "previousPageToken": null,
// "previousPageUrl": null,
// "total": 0
// },
// "likesMessage": null,
// "moderationFlags": null,
// "myLike": null,
// "parent": {
// "id": "005...",
// "url": "/services/data/v58.0/chatter/users/005..."
// },
// "relativeCreatedDate": "Just now",
// "threadLevel": 0,
// "threadParentId": null,
// "type": "TextComment",
// "url": "/services/data/v58.0/chatter/comments/0D7...",
// "user": {
// "additionalLabel": null,
// "communityNickname": "User1696423780773910041",
// "companyName": "Salesforce",
// "displayName": "Name",
// "firstName": "Firstname",
// "id": "005...",
// "isActive": true,
// "isInThisCommunity": true,
// "lastName": "Name",
// "motif": {
// "color": "1B96FF",
// "largeIconUrl": "/img/icon/profile64.png",
// "mediumIconUrl": "/img/icon/profile32.png",
// "smallIconUrl": "/img/icon/profile16.png",
// "svgIconUrl": null
// },
// "mySubscription": null,
// "name": "Name",
// "outOfOffice": {
// "message": ""
// },
// "photo": {
// "fullEmailPhotoUrl": "https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0IogXzXAXaYKJnuWCNQmXymRq?fromEmail=1",
// "largePhotoUrl": "https://<my_domain>/profilephoto/729.../F",
// "mediumPhotoUrl": "https://<my_domain>/profilephoto/729.../M",
// "photoVersionId": "729...",
// "smallPhotoUrl": "https://<my_domain>/profilephoto/729.../T",
// "standardEmailPhotoUrl": "https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0Ioi-dtynkoFWsl46as__TDFU?fromEmail=1",
// "url": "/services/data/v58.0/connect/user-profiles/005.../photo"
// },
// "reputation": null,
// "title": null,
// "type": "User",
// "url": "/services/data/v58.0/chatter/users/005...",
// "userType": "Internal"
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
li_IsRichText = loo_JResp.BoolOf("body.isRichText")
ls_Text = loo_JResp.StringOf("body.text")
li_IsEditRestricted = loo_JResp.BoolOf("capabilities.edit.isEditRestricted")
ls_IsEditableByMeUrl = loo_JResp.StringOf("capabilities.edit.isEditableByMeUrl")
ls_LastEditedBy = loo_JResp.StringOf("capabilities.edit.lastEditedBy")
ls_LastEditedDate = loo_JResp.StringOf("capabilities.edit.lastEditedDate")
li_LatestRevision = loo_JResp.IntOf("capabilities.edit.latestRevision")
ls_RelativeLastEditedDate = loo_JResp.StringOf("capabilities.edit.relativeLastEditedDate")
ls_FeedEntityStatus = loo_JResp.StringOf("capabilities.status.feedEntityStatus")
li_IsApprovableByMe = loo_JResp.BoolOf("capabilities.status.isApprovableByMe")
li_DownVoteCount = loo_JResp.IntOf("capabilities.upDownVote.downVoteCount")
ls_MyVote = loo_JResp.StringOf("capabilities.upDownVote.myVote")
li_UpVoteCount = loo_JResp.IntOf("capabilities.upDownVote.upVoteCount")
li_IsVerifiableByMe = loo_JResp.BoolOf("capabilities.verified.isVerifiableByMe")
li_IsVerified = loo_JResp.BoolOf("capabilities.verified.isVerified")
ls_IsVerifiedByAnonymized = loo_JResp.StringOf("capabilities.verified.isVerifiedByAnonymized")
ls_LastVerifiedByUser = loo_JResp.StringOf("capabilities.verified.lastVerifiedByUser")
ls_LastVerifiedDate = loo_JResp.StringOf("capabilities.verified.lastVerifiedDate")
ls_ClientInfo = loo_JResp.StringOf("clientInfo")
ls_CreatedDate = loo_JResp.StringOf("createdDate")
ls_Id = loo_JResp.StringOf("feedElement.id")
ls_V_Url = loo_JResp.StringOf("feedElement.url")
ls_Id = loo_JResp.StringOf("id")
li_IsDeleteRestricted = loo_JResp.BoolOf("isDeleteRestricted")
ls_CurrentPageToken = loo_JResp.StringOf("likes.currentPageToken")
ls_CurrentPageUrl = loo_JResp.StringOf("likes.currentPageUrl")
ls_NextPageToken = loo_JResp.StringOf("likes.nextPageToken")
ls_NextPageUrl = loo_JResp.StringOf("likes.nextPageUrl")
ls_PreviousPageToken = loo_JResp.StringOf("likes.previousPageToken")
ls_PreviousPageUrl = loo_JResp.StringOf("likes.previousPageUrl")
li_Total = loo_JResp.IntOf("likes.total")
ls_LikesMessage = loo_JResp.StringOf("likesMessage")
ls_ModerationFlags = loo_JResp.StringOf("moderationFlags")
ls_MyLike = loo_JResp.StringOf("myLike")
ls_ParentId = loo_JResp.StringOf("parent.id")
ls_ParentUrl = loo_JResp.StringOf("parent.url")
ls_RelativeCreatedDate = loo_JResp.StringOf("relativeCreatedDate")
li_ThreadLevel = loo_JResp.IntOf("threadLevel")
ls_ThreadParentId = loo_JResp.StringOf("threadParentId")
ls_V_type = loo_JResp.StringOf("type")
ls_Url = loo_JResp.StringOf("url")
ls_AdditionalLabel = loo_JResp.StringOf("user.additionalLabel")
ls_CommunityNickname = loo_JResp.StringOf("user.communityNickname")
ls_CompanyName = loo_JResp.StringOf("user.companyName")
ls_DisplayName = loo_JResp.StringOf("user.displayName")
ls_FirstName = loo_JResp.StringOf("user.firstName")
ls_UserId = loo_JResp.StringOf("user.id")
li_IsActive = loo_JResp.BoolOf("user.isActive")
li_IsInThisCommunity = loo_JResp.BoolOf("user.isInThisCommunity")
ls_LastName = loo_JResp.StringOf("user.lastName")
ls_Color = loo_JResp.StringOf("user.motif.color")
ls_LargeIconUrl = loo_JResp.StringOf("user.motif.largeIconUrl")
ls_MediumIconUrl = loo_JResp.StringOf("user.motif.mediumIconUrl")
ls_SmallIconUrl = loo_JResp.StringOf("user.motif.smallIconUrl")
ls_SvgIconUrl = loo_JResp.StringOf("user.motif.svgIconUrl")
ls_MySubscription = loo_JResp.StringOf("user.mySubscription")
ls_Name = loo_JResp.StringOf("user.name")
ls_Message = loo_JResp.StringOf("user.outOfOffice.message")
ls_FullEmailPhotoUrl = loo_JResp.StringOf("user.photo.fullEmailPhotoUrl")
ls_LargePhotoUrl = loo_JResp.StringOf("user.photo.largePhotoUrl")
ls_MediumPhotoUrl = loo_JResp.StringOf("user.photo.mediumPhotoUrl")
ls_PhotoVersionId = loo_JResp.StringOf("user.photo.photoVersionId")
ls_SmallPhotoUrl = loo_JResp.StringOf("user.photo.smallPhotoUrl")
ls_StandardEmailPhotoUrl = loo_JResp.StringOf("user.photo.standardEmailPhotoUrl")
ls_PhotoUrl = loo_JResp.StringOf("user.photo.url")
ls_Reputation = loo_JResp.StringOf("user.reputation")
ls_Title = loo_JResp.StringOf("user.title")
ls_V_Type = loo_JResp.StringOf("user.type")
ls_UserUrl = loo_JResp.StringOf("user.url")
ls_UserType = loo_JResp.StringOf("user.userType")
i = 0
li_Count_i = loo_JResp.SizeOfArray("body.messageSegments")
do while i < li_Count_i
loo_JResp.I = i
ls_AltText = loo_JResp.StringOf("body.messageSegments[i].altText")
ls_HtmlTag = loo_JResp.StringOf("body.messageSegments[i].htmlTag")
ls_MarkupType = loo_JResp.StringOf("body.messageSegments[i].markupType")
ls_Text = loo_JResp.StringOf("body.messageSegments[i].text")
ls_V_type = loo_JResp.StringOf("body.messageSegments[i].type")
ls_Url = loo_JResp.StringOf("body.messageSegments[i].url")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("likes.items")
do while i < li_Count_i
loo_JResp.I = i
i = i + 1
loop
destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"body": {
"messageSegments": [
{
"type": "Text",
"text": "Editing a comment"
}
]
}
}'
https://domain.com/services/data/v{{version}}/chatter/comments/:COMMENT_ID
Postman Collection Item JSON
{
"name": "Comment",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {},
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"body\": {\n \"messageSegments\": [\n {\n \"type\": \"Text\",\n \"text\": \"Editing a comment\"\n }\n ]\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/chatter/comments/:COMMENT_ID",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"chatter",
"comments",
":COMMENT_ID"
],
"variable": [
{
"key": "COMMENT_ID",
"value": "0D7..."
}
]
},
"description": "Get information about, edit, or delete a comment.\nTo post a comment, use Feed Elements Capability, Comments Items.\n\nhttps://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_comments_specific.htm#connect_resources_comments_specific"
},
"response": [
{
"name": "Successful Comment",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"body\": {\n \"messageSegments\": [\n {\n \"type\": \"Text\",\n \"text\": \"Editing a comment\"\n }\n ]\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/chatter/comments/:COMMENT_ID",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"chatter",
"comments",
":COMMENT_ID"
],
"variable": [
{
"key": "COMMENT_ID",
"value": "0D72o00000E8dNiCAJ"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 22 Nov 2023 11:20:42 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "{\n \"body\": {\n \"isRichText\": true,\n \"messageSegments\": [\n {\n \"altText\": null,\n \"htmlTag\": \"p\",\n \"markupType\": \"Paragraph\",\n \"text\": \"\",\n \"type\": \"MarkupBegin\",\n \"url\": null\n },\n {\n \"text\": \"Comment\",\n \"type\": \"Text\"\n },\n {\n \"htmlTag\": \"p\",\n \"markupType\": \"Paragraph\",\n \"text\": \"\\n\",\n \"type\": \"MarkupEnd\"\n }\n ],\n \"text\": \"Comment\\n\"\n },\n \"capabilities\": {\n \"edit\": {\n \"isEditRestricted\": false,\n \"isEditableByMeUrl\": \"/services/data/v58.0/chatter/comments/0D7.../capabilities/edit/is-editable-by-me\",\n \"lastEditedBy\": null,\n \"lastEditedDate\": null,\n \"latestRevision\": 1,\n \"relativeLastEditedDate\": null\n },\n \"status\": {\n \"feedEntityStatus\": \"Published\",\n \"isApprovableByMe\": true\n },\n \"upDownVote\": {\n \"downVoteCount\": 0,\n \"myVote\": \"None\",\n \"upVoteCount\": 0\n },\n \"verified\": {\n \"isVerifiableByMe\": false,\n \"isVerified\": false,\n \"isVerifiedByAnonymized\": null,\n \"lastVerifiedByUser\": null,\n \"lastVerifiedDate\": null\n }\n },\n \"clientInfo\": null,\n \"createdDate\": \"2023-11-22T11:19:50.000Z\",\n \"feedElement\": {\n \"id\": \"0D5...\",\n \"url\": \"/services/data/v58.0/chatter/feed-elements/0D5...\"\n },\n \"id\": \"0D7...\",\n \"isDeleteRestricted\": false,\n \"likes\": {\n \"currentPageToken\": null,\n \"currentPageUrl\": \"/services/data/v58.0/chatter/comments/0D7.../likes\",\n \"items\": [],\n \"nextPageToken\": null,\n \"nextPageUrl\": null,\n \"previousPageToken\": null,\n \"previousPageUrl\": null,\n \"total\": 0\n },\n \"likesMessage\": null,\n \"moderationFlags\": null,\n \"myLike\": null,\n \"parent\": {\n \"id\": \"005...\",\n \"url\": \"/services/data/v58.0/chatter/users/005...\"\n },\n \"relativeCreatedDate\": \"Just now\",\n \"threadLevel\": 0,\n \"threadParentId\": null,\n \"type\": \"TextComment\",\n \"url\": \"/services/data/v58.0/chatter/comments/0D7...\",\n \"user\": {\n \"additionalLabel\": null,\n \"communityNickname\": \"User1696423780773910041\",\n \"companyName\": \"Salesforce\",\n \"displayName\": \"Name\",\n \"firstName\": \"Firstname\",\n \"id\": \"005...\",\n \"isActive\": true,\n \"isInThisCommunity\": true,\n \"lastName\": \"Name\",\n \"motif\": {\n \"color\": \"1B96FF\",\n \"largeIconUrl\": \"/img/icon/profile64.png\",\n \"mediumIconUrl\": \"/img/icon/profile32.png\",\n \"smallIconUrl\": \"/img/icon/profile16.png\",\n \"svgIconUrl\": null\n },\n \"mySubscription\": null,\n \"name\": \"Name\",\n \"outOfOffice\": {\n \"message\": \"\"\n },\n \"photo\": {\n \"fullEmailPhotoUrl\": \"https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0IogXzXAXaYKJnuWCNQmXymRq?fromEmail=1\",\n \"largePhotoUrl\": \"https://<my_domain>/profilephoto/729.../F\",\n \"mediumPhotoUrl\": \"https://<my_domain>/profilephoto/729.../M\",\n \"photoVersionId\": \"729...\",\n \"smallPhotoUrl\": \"https://<my_domain>/profilephoto/729.../T\",\n \"standardEmailPhotoUrl\": \"https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0Ioi-dtynkoFWsl46as__TDFU?fromEmail=1\",\n \"url\": \"/services/data/v58.0/connect/user-profiles/005.../photo\"\n },\n \"reputation\": null,\n \"title\": null,\n \"type\": \"User\",\n \"url\": \"/services/data/v58.0/chatter/users/005...\",\n \"userType\": \"Internal\"\n }\n}"
}
]
}