Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkHttpResponseW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkJsonObjectW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkHttpResponseW resp;
HCkStringBuilderW sbResponseBody;
HCkJsonObjectW jResp;
int respStatusCode;
const wchar_t *text;
const wchar_t *motifColor;
const wchar_t *motifLargeIconUrl;
const wchar_t *motifMediumIconUrl;
const wchar_t *motifSmallIconUrl;
const wchar_t *motifSvgIconUrl;
const wchar_t *referenceId;
const wchar_t *referenceUrl;
const wchar_t *AdditionalLabel;
const wchar_t *CommunityNickname;
const wchar_t *CompanyName;
const wchar_t *DisplayName;
const wchar_t *FirstName;
const wchar_t *Id;
BOOL IsActive;
BOOL IsInThisCommunity;
const wchar_t *LastName;
const wchar_t *Color;
const wchar_t *LargeIconUrl;
const wchar_t *MediumIconUrl;
const wchar_t *SmallIconUrl;
const wchar_t *SvgIconUrl;
const wchar_t *MySubscription;
const wchar_t *Name;
const wchar_t *Message;
const wchar_t *FullEmailPhotoUrl;
const wchar_t *LargePhotoUrl;
const wchar_t *MediumPhotoUrl;
const wchar_t *PhotoVersionId;
const wchar_t *SmallPhotoUrl;
const wchar_t *StandardEmailPhotoUrl;
const wchar_t *v_Url;
const wchar_t *Reputation;
const wchar_t *Title;
const wchar_t *v_Type;
const wchar_t *actorUrl;
const wchar_t *UserType;
BOOL IsRichText;
const wchar_t *Text;
BOOL IsBookmarkedByCurrentUser;
BOOL IsLikedByCurrentUser;
const wchar_t *LikesMessage;
const wchar_t *MyLike;
int CurrentPageToken;
const wchar_t *CurrentPageUrl;
const wchar_t *NextPageToken;
const wchar_t *NextPageUrl;
const wchar_t *PreviousPageToken;
const wchar_t *PreviousPageUrl;
int Total;
BOOL CanContextUserUpdateIsClosed;
BOOL IsClosed;
const wchar_t *PageCurrentPageToken;
const wchar_t *PageCurrentPageUrl;
const wchar_t *PageNextPageToken;
const wchar_t *PageNextPageUrl;
const wchar_t *PagePreviousPageToken;
const wchar_t *PagePreviousPageUrl;
int PageTotal;
BOOL IsEditRestricted;
const wchar_t *IsEditableByMeUrl;
const wchar_t *LastEditedBy;
const wchar_t *LastEditedDate;
int LatestRevision;
const wchar_t *RelativeLastEditedDate;
int Count;
BOOL IsMutedByMe;
BOOL IsReadByMe;
const wchar_t *LastReadDateByMe;
const wchar_t *FeedEntityStatus;
BOOL IsApprovableByMe;
BOOL CanAssignTopics;
int DownVoteCount;
const wchar_t *MyVote;
int UpVoteCount;
const wchar_t *ApplicationName;
const wchar_t *ApplicationUrl;
const wchar_t *createdDate;
BOOL v_event;
const wchar_t *feedElementType;
BOOL hasVerifiedComment;
const wchar_t *headerIsRichText;
const wchar_t *headerText;
const wchar_t *id;
BOOL isDeleteRestricted;
BOOL isSharable;
const wchar_t *modifiedDate;
const wchar_t *originalFeedItem;
const wchar_t *originalFeedItemActor;
const wchar_t *Label;
const wchar_t *LabelPlural;
const wchar_t *parentId;
const wchar_t *MotifColor;
const wchar_t *MotifLargeIconUrl;
const wchar_t *MotifMediumIconUrl;
const wchar_t *MotifSmallIconUrl;
const wchar_t *MotifSvgIconUrl;
const wchar_t *parentMySubscription;
const wchar_t *parentName;
const wchar_t *parentType;
const wchar_t *parentUrl;
const wchar_t *photoUrl;
const wchar_t *relativeCreatedDate;
const wchar_t *v_type;
const wchar_t *url;
const wchar_t *visibility;
int i;
int count_i;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// Adds the "Authorization: Bearer <access_token>" header.
CkHttpW_putAuthToken(http,L"<access_token>");
resp = CkHttpW_QuickRequest(http,L"POST",L"Item");
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
return;
}
sbResponseBody = CkStringBuilderW_Create();
CkHttpResponseW_GetBodySb(resp,sbResponseBody);
jResp = CkJsonObjectW_Create();
CkJsonObjectW_LoadSb(jResp,sbResponseBody);
CkJsonObjectW_putEmitCompact(jResp,FALSE);
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkJsonObjectW_emit(jResp));
respStatusCode = CkHttpResponseW_getStatusCode(resp);
wprintf(L"Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkHttpResponseW_header(resp));
wprintf(L"Failed.\n");
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
return;
}
CkHttpResponseW_Dispose(resp);
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "actor": {
// "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"
// },
// "body": {
// "isRichText": false,
// "messageSegments": [
// {
// "text": "New Feed Item",
// "type": "Text"
// }
// ],
// "text": "New Feed Item"
// },
// "capabilities": {
// "associatedActions": {
// "platformActionGroups": [
// ]
// },
// "bookmarks": {
// "isBookmarkedByCurrentUser": false
// },
// "chatterLikes": {
// "isLikedByCurrentUser": false,
// "likesMessage": null,
// "myLike": null,
// "page": {
// "currentPageToken": 0,
// "currentPageUrl": "/services/data/v58.0/chatter/feed-elements/0D5.../capabilities/chatter-likes/items",
// "items": [
// ],
// "nextPageToken": null,
// "nextPageUrl": null,
// "previousPageToken": null,
// "previousPageUrl": null,
// "total": 0
// }
// },
// "close": {
// "canContextUserUpdateIsClosed": true,
// "isClosed": false
// },
// "comments": {
// "page": {
// "currentPageToken": null,
// "currentPageUrl": "/services/data/v58.0/chatter/feed-elements/0D5.../capabilities/comments/items",
// "items": [
// ],
// "nextPageToken": null,
// "nextPageUrl": null,
// "previousPageToken": null,
// "previousPageUrl": null,
// "total": 0
// }
// },
// "edit": {
// "isEditRestricted": false,
// "isEditableByMeUrl": "/services/data/v58.0/chatter/feed-elements/0D5.../capabilities/edit/is-editable-by-me",
// "lastEditedBy": null,
// "lastEditedDate": null,
// "latestRevision": 1,
// "relativeLastEditedDate": null
// },
// "interactions": {
// "count": 0
// },
// "mute": {
// "isMutedByMe": false
// },
// "readBy": {
// "isReadByMe": true,
// "lastReadDateByMe": "2023-11-22T11:06:07.000Z",
// "page": {
// "currentPageToken": null,
// "currentPageUrl": "/services/data/v58.0/chatter/feed-elements/0D5.../capabilities/read-by/items?pageSize=3",
// "items": [
// ],
// "nextPageToken": null,
// "nextPageUrl": null,
// "previousPageToken": null,
// "previousPageUrl": null,
// "total": 0
// }
// },
// "status": {
// "feedEntityStatus": "Published",
// "isApprovableByMe": true
// },
// "topics": {
// "canAssignTopics": true,
// "items": [
// ]
// },
// "upDownVote": {
// "downVoteCount": 0,
// "myVote": "None",
// "upVoteCount": 0
// }
// },
// "clientInfo": {
// "applicationName": "Postman Playground",
// "applicationUrl": null
// },
// "createdDate": "2023-11-22T11:06:07.000Z",
// "event": false,
// "feedElementType": "FeedItem",
// "hasVerifiedComment": false,
// "header": {
// "isRichText": null,
// "messageSegments": [
// {
// "motif": {
// "color": "1B96FF",
// "largeIconUrl": "/img/icon/profile64.png",
// "mediumIconUrl": "/img/icon/profile32.png",
// "smallIconUrl": "/img/icon/profile16.png",
// "svgIconUrl": null
// },
// "reference": {
// "id": "005...",
// "url": "/services/data/v58.0/chatter/users/005..."
// },
// "text": "Name",
// "type": "EntityLink"
// }
// ],
// "text": "Name"
// },
// "id": "0D5...",
// "isDeleteRestricted": false,
// "isSharable": false,
// "modifiedDate": "2023-11-22T11:06:07.000Z",
// "originalFeedItem": null,
// "originalFeedItemActor": null,
// "parent": {
// "entityLabel": {
// "label": "Account",
// "labelPlural": "Accounts"
// },
// "id": "001...",
// "motif": {
// "color": "5867E8",
// "largeIconUrl": "/img/icon/accounts64.png",
// "mediumIconUrl": "/img/icon/accounts32.png",
// "smallIconUrl": "/img/icon/accounts16.png",
// "svgIconUrl": null
// },
// "mySubscription": null,
// "name": "Burlington Textiles Corp of America",
// "type": "Account",
// "url": "/services/data/v58.0/chatter/records/001..."
// },
// "photoUrl": "https://<my_domain>/profilephoto/729.../T",
// "relativeCreatedDate": "Just now",
// "type": "TextPost",
// "url": "/services/data/v58.0/chatter/feed-elements/0D5...",
// "visibility": "InternalUsers"
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
AdditionalLabel = CkJsonObjectW_stringOf(jResp,L"actor.additionalLabel");
CommunityNickname = CkJsonObjectW_stringOf(jResp,L"actor.communityNickname");
CompanyName = CkJsonObjectW_stringOf(jResp,L"actor.companyName");
DisplayName = CkJsonObjectW_stringOf(jResp,L"actor.displayName");
FirstName = CkJsonObjectW_stringOf(jResp,L"actor.firstName");
Id = CkJsonObjectW_stringOf(jResp,L"actor.id");
IsActive = CkJsonObjectW_BoolOf(jResp,L"actor.isActive");
IsInThisCommunity = CkJsonObjectW_BoolOf(jResp,L"actor.isInThisCommunity");
LastName = CkJsonObjectW_stringOf(jResp,L"actor.lastName");
Color = CkJsonObjectW_stringOf(jResp,L"actor.motif.color");
LargeIconUrl = CkJsonObjectW_stringOf(jResp,L"actor.motif.largeIconUrl");
MediumIconUrl = CkJsonObjectW_stringOf(jResp,L"actor.motif.mediumIconUrl");
SmallIconUrl = CkJsonObjectW_stringOf(jResp,L"actor.motif.smallIconUrl");
SvgIconUrl = CkJsonObjectW_stringOf(jResp,L"actor.motif.svgIconUrl");
MySubscription = CkJsonObjectW_stringOf(jResp,L"actor.mySubscription");
Name = CkJsonObjectW_stringOf(jResp,L"actor.name");
Message = CkJsonObjectW_stringOf(jResp,L"actor.outOfOffice.message");
FullEmailPhotoUrl = CkJsonObjectW_stringOf(jResp,L"actor.photo.fullEmailPhotoUrl");
LargePhotoUrl = CkJsonObjectW_stringOf(jResp,L"actor.photo.largePhotoUrl");
MediumPhotoUrl = CkJsonObjectW_stringOf(jResp,L"actor.photo.mediumPhotoUrl");
PhotoVersionId = CkJsonObjectW_stringOf(jResp,L"actor.photo.photoVersionId");
SmallPhotoUrl = CkJsonObjectW_stringOf(jResp,L"actor.photo.smallPhotoUrl");
StandardEmailPhotoUrl = CkJsonObjectW_stringOf(jResp,L"actor.photo.standardEmailPhotoUrl");
v_Url = CkJsonObjectW_stringOf(jResp,L"actor.photo.url");
Reputation = CkJsonObjectW_stringOf(jResp,L"actor.reputation");
Title = CkJsonObjectW_stringOf(jResp,L"actor.title");
v_Type = CkJsonObjectW_stringOf(jResp,L"actor.type");
actorUrl = CkJsonObjectW_stringOf(jResp,L"actor.url");
UserType = CkJsonObjectW_stringOf(jResp,L"actor.userType");
IsRichText = CkJsonObjectW_BoolOf(jResp,L"body.isRichText");
Text = CkJsonObjectW_stringOf(jResp,L"body.text");
IsBookmarkedByCurrentUser = CkJsonObjectW_BoolOf(jResp,L"capabilities.bookmarks.isBookmarkedByCurrentUser");
IsLikedByCurrentUser = CkJsonObjectW_BoolOf(jResp,L"capabilities.chatterLikes.isLikedByCurrentUser");
LikesMessage = CkJsonObjectW_stringOf(jResp,L"capabilities.chatterLikes.likesMessage");
MyLike = CkJsonObjectW_stringOf(jResp,L"capabilities.chatterLikes.myLike");
CurrentPageToken = CkJsonObjectW_IntOf(jResp,L"capabilities.chatterLikes.page.currentPageToken");
CurrentPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.chatterLikes.page.currentPageUrl");
NextPageToken = CkJsonObjectW_stringOf(jResp,L"capabilities.chatterLikes.page.nextPageToken");
NextPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.chatterLikes.page.nextPageUrl");
PreviousPageToken = CkJsonObjectW_stringOf(jResp,L"capabilities.chatterLikes.page.previousPageToken");
PreviousPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.chatterLikes.page.previousPageUrl");
Total = CkJsonObjectW_IntOf(jResp,L"capabilities.chatterLikes.page.total");
CanContextUserUpdateIsClosed = CkJsonObjectW_BoolOf(jResp,L"capabilities.close.canContextUserUpdateIsClosed");
IsClosed = CkJsonObjectW_BoolOf(jResp,L"capabilities.close.isClosed");
PageCurrentPageToken = CkJsonObjectW_stringOf(jResp,L"capabilities.comments.page.currentPageToken");
PageCurrentPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.comments.page.currentPageUrl");
PageNextPageToken = CkJsonObjectW_stringOf(jResp,L"capabilities.comments.page.nextPageToken");
PageNextPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.comments.page.nextPageUrl");
PagePreviousPageToken = CkJsonObjectW_stringOf(jResp,L"capabilities.comments.page.previousPageToken");
PagePreviousPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.comments.page.previousPageUrl");
PageTotal = CkJsonObjectW_IntOf(jResp,L"capabilities.comments.page.total");
IsEditRestricted = CkJsonObjectW_BoolOf(jResp,L"capabilities.edit.isEditRestricted");
IsEditableByMeUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.edit.isEditableByMeUrl");
LastEditedBy = CkJsonObjectW_stringOf(jResp,L"capabilities.edit.lastEditedBy");
LastEditedDate = CkJsonObjectW_stringOf(jResp,L"capabilities.edit.lastEditedDate");
LatestRevision = CkJsonObjectW_IntOf(jResp,L"capabilities.edit.latestRevision");
RelativeLastEditedDate = CkJsonObjectW_stringOf(jResp,L"capabilities.edit.relativeLastEditedDate");
Count = CkJsonObjectW_IntOf(jResp,L"capabilities.interactions.count");
IsMutedByMe = CkJsonObjectW_BoolOf(jResp,L"capabilities.mute.isMutedByMe");
IsReadByMe = CkJsonObjectW_BoolOf(jResp,L"capabilities.readBy.isReadByMe");
LastReadDateByMe = CkJsonObjectW_stringOf(jResp,L"capabilities.readBy.lastReadDateByMe");
PageCurrentPageToken = CkJsonObjectW_stringOf(jResp,L"capabilities.readBy.page.currentPageToken");
PageCurrentPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.readBy.page.currentPageUrl");
PageNextPageToken = CkJsonObjectW_stringOf(jResp,L"capabilities.readBy.page.nextPageToken");
PageNextPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.readBy.page.nextPageUrl");
PagePreviousPageToken = CkJsonObjectW_stringOf(jResp,L"capabilities.readBy.page.previousPageToken");
PagePreviousPageUrl = CkJsonObjectW_stringOf(jResp,L"capabilities.readBy.page.previousPageUrl");
PageTotal = CkJsonObjectW_IntOf(jResp,L"capabilities.readBy.page.total");
FeedEntityStatus = CkJsonObjectW_stringOf(jResp,L"capabilities.status.feedEntityStatus");
IsApprovableByMe = CkJsonObjectW_BoolOf(jResp,L"capabilities.status.isApprovableByMe");
CanAssignTopics = CkJsonObjectW_BoolOf(jResp,L"capabilities.topics.canAssignTopics");
DownVoteCount = CkJsonObjectW_IntOf(jResp,L"capabilities.upDownVote.downVoteCount");
MyVote = CkJsonObjectW_stringOf(jResp,L"capabilities.upDownVote.myVote");
UpVoteCount = CkJsonObjectW_IntOf(jResp,L"capabilities.upDownVote.upVoteCount");
ApplicationName = CkJsonObjectW_stringOf(jResp,L"clientInfo.applicationName");
ApplicationUrl = CkJsonObjectW_stringOf(jResp,L"clientInfo.applicationUrl");
createdDate = CkJsonObjectW_stringOf(jResp,L"createdDate");
v_event = CkJsonObjectW_BoolOf(jResp,L"event");
feedElementType = CkJsonObjectW_stringOf(jResp,L"feedElementType");
hasVerifiedComment = CkJsonObjectW_BoolOf(jResp,L"hasVerifiedComment");
headerIsRichText = CkJsonObjectW_stringOf(jResp,L"header.isRichText");
headerText = CkJsonObjectW_stringOf(jResp,L"header.text");
id = CkJsonObjectW_stringOf(jResp,L"id");
isDeleteRestricted = CkJsonObjectW_BoolOf(jResp,L"isDeleteRestricted");
isSharable = CkJsonObjectW_BoolOf(jResp,L"isSharable");
modifiedDate = CkJsonObjectW_stringOf(jResp,L"modifiedDate");
originalFeedItem = CkJsonObjectW_stringOf(jResp,L"originalFeedItem");
originalFeedItemActor = CkJsonObjectW_stringOf(jResp,L"originalFeedItemActor");
Label = CkJsonObjectW_stringOf(jResp,L"parent.entityLabel.label");
LabelPlural = CkJsonObjectW_stringOf(jResp,L"parent.entityLabel.labelPlural");
parentId = CkJsonObjectW_stringOf(jResp,L"parent.id");
MotifColor = CkJsonObjectW_stringOf(jResp,L"parent.motif.color");
MotifLargeIconUrl = CkJsonObjectW_stringOf(jResp,L"parent.motif.largeIconUrl");
MotifMediumIconUrl = CkJsonObjectW_stringOf(jResp,L"parent.motif.mediumIconUrl");
MotifSmallIconUrl = CkJsonObjectW_stringOf(jResp,L"parent.motif.smallIconUrl");
MotifSvgIconUrl = CkJsonObjectW_stringOf(jResp,L"parent.motif.svgIconUrl");
parentMySubscription = CkJsonObjectW_stringOf(jResp,L"parent.mySubscription");
parentName = CkJsonObjectW_stringOf(jResp,L"parent.name");
parentType = CkJsonObjectW_stringOf(jResp,L"parent.type");
parentUrl = CkJsonObjectW_stringOf(jResp,L"parent.url");
photoUrl = CkJsonObjectW_stringOf(jResp,L"photoUrl");
relativeCreatedDate = CkJsonObjectW_stringOf(jResp,L"relativeCreatedDate");
v_type = CkJsonObjectW_stringOf(jResp,L"type");
url = CkJsonObjectW_stringOf(jResp,L"url");
visibility = CkJsonObjectW_stringOf(jResp,L"visibility");
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"body.messageSegments");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
text = CkJsonObjectW_stringOf(jResp,L"body.messageSegments[i].text");
v_type = CkJsonObjectW_stringOf(jResp,L"body.messageSegments[i].type");
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"capabilities.associatedActions.platformActionGroups");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"capabilities.chatterLikes.page.items");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"capabilities.comments.page.items");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"capabilities.readBy.page.items");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"capabilities.topics.items");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"header.messageSegments");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
motifColor = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].motif.color");
motifLargeIconUrl = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].motif.largeIconUrl");
motifMediumIconUrl = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].motif.mediumIconUrl");
motifSmallIconUrl = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].motif.smallIconUrl");
motifSvgIconUrl = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].motif.svgIconUrl");
referenceId = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].reference.id");
referenceUrl = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].reference.url");
text = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].text");
v_type = CkJsonObjectW_stringOf(jResp,L"header.messageSegments[i].type");
i = i + 1;
}
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
}
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/chatter/feed-elements?feedElementType=FeedItem&subjectId=<USER_GROUP_RECORD_ID>&text=New Feed Item
Postman Collection Item JSON
{
"name": "Feed Elements, Post and Search",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
}
},
"request": {
"method": "POST",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/chatter/feed-elements?feedElementType=FeedItem&subjectId=<USER_GROUP_RECORD_ID>&text=New Feed Item",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"chatter",
"feed-elements"
],
"query": [
{
"key": "feedElementType",
"value": "FeedItem",
"description": "Feed elements are the top-level objects that a feed contains. The feed element type describes the characteristics of that feed element. One of these values:\nBundle—A container of feed elements. A bundle also has a body made up of message segments that can always be gracefully degraded to text-only values.\nFeedItem—A feed item has a single parent and is scoped to one community or across all communities. A feed item can have capabilities such as bookmarks, canvas, content, comment, link, poll. Feed items have a body made up of message segments that can always be gracefully degraded to text-only values.\nRecommendation—A recommendation is a feed element with a recommendations capability. A recommendation suggests records to follow, groups to join, or applications that are helpful to the context user."
},
{
"key": "subjectId",
"value": "<USER_GROUP_RECORD_ID>"
},
{
"key": "text",
"value": "New Feed Item"
}
]
},
"description": "Feed item and comment bodies have a 10,000 character limit. Because this limit can change, we recommend that clients make a describeSObjects() call on the FeedItem or FeedComment object. To determine the maximum number of allowed characters, look at the length of the Body or CommentBody field.\n\nhttps://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_feed_element.htm"
},
"response": [
{
"name": "Successful Feed Elements, Post and Search",
"originalRequest": {
"method": "POST",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/chatter/feed-elements?feedElementType=FeedItem&subjectId=001...&text=New Feed Item",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"chatter",
"feed-elements"
],
"query": [
{
"key": "feedElementType",
"value": "FeedItem",
"description": "Feed elements are the top-level objects that a feed contains. The feed element type describes the characteristics of that feed element. One of these values:\nBundle—A container of feed elements. A bundle also has a body made up of message segments that can always be gracefully degraded to text-only values.\nFeedItem—A feed item has a single parent and is scoped to one community or across all communities. A feed item can have capabilities such as bookmarks, canvas, content, comment, link, poll. Feed items have a body made up of message segments that can always be gracefully degraded to text-only values.\nRecommendation—A recommendation is a feed element with a recommendations capability. A recommendation suggests records to follow, groups to join, or applications that are helpful to the context user."
},
{
"key": "subjectId",
"value": "001..."
},
{
"key": "text",
"value": "New Feed Item"
}
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 22 Nov 2023 11:06:07 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 \"actor\": {\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 \"body\": {\n \"isRichText\": false,\n \"messageSegments\": [\n {\n \"text\": \"New Feed Item\",\n \"type\": \"Text\"\n }\n ],\n \"text\": \"New Feed Item\"\n },\n \"capabilities\": {\n \"associatedActions\": {\n \"platformActionGroups\": []\n },\n \"bookmarks\": {\n \"isBookmarkedByCurrentUser\": false\n },\n \"chatterLikes\": {\n \"isLikedByCurrentUser\": false,\n \"likesMessage\": null,\n \"myLike\": null,\n \"page\": {\n \"currentPageToken\": 0,\n \"currentPageUrl\": \"/services/data/v58.0/chatter/feed-elements/0D5.../capabilities/chatter-likes/items\",\n \"items\": [],\n \"nextPageToken\": null,\n \"nextPageUrl\": null,\n \"previousPageToken\": null,\n \"previousPageUrl\": null,\n \"total\": 0\n }\n },\n \"close\": {\n \"canContextUserUpdateIsClosed\": true,\n \"isClosed\": false\n },\n \"comments\": {\n \"page\": {\n \"currentPageToken\": null,\n \"currentPageUrl\": \"/services/data/v58.0/chatter/feed-elements/0D5.../capabilities/comments/items\",\n \"items\": [],\n \"nextPageToken\": null,\n \"nextPageUrl\": null,\n \"previousPageToken\": null,\n \"previousPageUrl\": null,\n \"total\": 0\n }\n },\n \"edit\": {\n \"isEditRestricted\": false,\n \"isEditableByMeUrl\": \"/services/data/v58.0/chatter/feed-elements/0D5.../capabilities/edit/is-editable-by-me\",\n \"lastEditedBy\": null,\n \"lastEditedDate\": null,\n \"latestRevision\": 1,\n \"relativeLastEditedDate\": null\n },\n \"interactions\": {\n \"count\": 0\n },\n \"mute\": {\n \"isMutedByMe\": false\n },\n \"readBy\": {\n \"isReadByMe\": true,\n \"lastReadDateByMe\": \"2023-11-22T11:06:07.000Z\",\n \"page\": {\n \"currentPageToken\": null,\n \"currentPageUrl\": \"/services/data/v58.0/chatter/feed-elements/0D5.../capabilities/read-by/items?pageSize=3\",\n \"items\": [],\n \"nextPageToken\": null,\n \"nextPageUrl\": null,\n \"previousPageToken\": null,\n \"previousPageUrl\": null,\n \"total\": 0\n }\n },\n \"status\": {\n \"feedEntityStatus\": \"Published\",\n \"isApprovableByMe\": true\n },\n \"topics\": {\n \"canAssignTopics\": true,\n \"items\": []\n },\n \"upDownVote\": {\n \"downVoteCount\": 0,\n \"myVote\": \"None\",\n \"upVoteCount\": 0\n }\n },\n \"clientInfo\": {\n \"applicationName\": \"Postman Playground\",\n \"applicationUrl\": null\n },\n \"createdDate\": \"2023-11-22T11:06:07.000Z\",\n \"event\": false,\n \"feedElementType\": \"FeedItem\",\n \"hasVerifiedComment\": false,\n \"header\": {\n \"isRichText\": null,\n \"messageSegments\": [\n {\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 \"reference\": {\n \"id\": \"005...\",\n \"url\": \"/services/data/v58.0/chatter/users/005...\"\n },\n \"text\": \"Name\",\n \"type\": \"EntityLink\"\n }\n ],\n \"text\": \"Name\"\n },\n \"id\": \"0D5...\",\n \"isDeleteRestricted\": false,\n \"isSharable\": false,\n \"modifiedDate\": \"2023-11-22T11:06:07.000Z\",\n \"originalFeedItem\": null,\n \"originalFeedItemActor\": null,\n \"parent\": {\n \"entityLabel\": {\n \"label\": \"Account\",\n \"labelPlural\": \"Accounts\"\n },\n \"id\": \"001...\",\n \"motif\": {\n \"color\": \"5867E8\",\n \"largeIconUrl\": \"/img/icon/accounts64.png\",\n \"mediumIconUrl\": \"/img/icon/accounts32.png\",\n \"smallIconUrl\": \"/img/icon/accounts16.png\",\n \"svgIconUrl\": null\n },\n \"mySubscription\": null,\n \"name\": \"Burlington Textiles Corp of America\",\n \"type\": \"Account\",\n \"url\": \"/services/data/v58.0/chatter/records/001...\"\n },\n \"photoUrl\": \"https://<my_domain>/profilephoto/729.../T\",\n \"relativeCreatedDate\": \"Just now\",\n \"type\": \"TextPost\",\n \"url\": \"/services/data/v58.0/chatter/feed-elements/0D5...\",\n \"visibility\": \"InternalUsers\"\n}"
}
]
}