Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcAdditionalLabel
LOCAL lcAnnouncement
LOCAL lcBannerPhotoUrl
LOCAL lcBannerPhotoVersionId
LOCAL lcV_Url
LOCAL lnCanHaveChatterGuests
LOCAL lcCommunity
LOCAL lcDescription
LOCAL lcEmailToChatterAddress
LOCAL lnFileCount
LOCAL lcId
LOCAL lcText
LOCAL lcTitle
LOCAL lnIsArchived
LOCAL lnIsAutoArchiveDisabled
LOCAL lnIsBroadcast
LOCAL lcLastFeedElementPostDate
LOCAL lnMemberCount
LOCAL lcColor
LOCAL lcLargeIconUrl
LOCAL lcMediumIconUrl
LOCAL lcSmallIconUrl
LOCAL lcSvgIconUrl
LOCAL lcMyRole
LOCAL lcId
LOCAL lcMySubscriptionUrl
LOCAL lcName
LOCAL lcAdditionalLabel
LOCAL lcCommunityNickname
LOCAL lcCompanyName
LOCAL lcDisplayName
LOCAL lcFirstName
LOCAL lcOwnerId
LOCAL lnIsActive
LOCAL lnIsInThisCommunity
LOCAL lcLastName
LOCAL lcMotifColor
LOCAL lcMotifLargeIconUrl
LOCAL lcMotifMediumIconUrl
LOCAL lcMotifSmallIconUrl
LOCAL lcMotifSvgIconUrl
LOCAL lcMySubscription
LOCAL lcName
LOCAL lcMessage
LOCAL lcFullEmailPhotoUrl
LOCAL lcLargePhotoUrl
LOCAL lcMediumPhotoUrl
LOCAL lcPhotoVersionId
LOCAL lcSmallPhotoUrl
LOCAL lcStandardEmailPhotoUrl
LOCAL lcPhotoUrl
LOCAL lcReputation
LOCAL lcOwnerTitle
LOCAL lcV_Type
LOCAL lcOwnerUrl
LOCAL lcUserType
LOCAL lcPendingRequests
LOCAL lcPhotoFullEmailPhotoUrl
LOCAL lcPhotoLargePhotoUrl
LOCAL lcPhotoMediumPhotoUrl
LOCAL lcPhotoPhotoVersionId
LOCAL lcPhotoSmallPhotoUrl
LOCAL lcPhotoStandardEmailPhotoUrl
LOCAL lcPhotoUrl
LOCAL lcV_type
LOCAL lcUrl
LOCAL lcVisibility
LOCAL lcCurrentPageUrl
LOCAL lcNextPageUrl
LOCAL lcPreviousPageUrl
LOCAL i
LOCAL lnCount_i
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://domain.com/services/data/v{{version}}/chatter/groups",loSbResponseBody)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponseBody
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loHttp.LastHeader
? "Failed."
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "currentPageUrl": "/services/data/v58.0/chatter/groups",
* "groups": [
* {
* "additionalLabel": null,
* "announcement": null,
* "bannerPhoto": {
* "bannerPhotoUrl": "https://<my_domain>/profilephoto/0F9/B",
* "bannerPhotoVersionId": null,
* "url": "/services/data/v58.0/chatter/groups/0F9.../banner-photo"
* },
* "canHaveChatterGuests": false,
* "community": null,
* "description": "Test group",
* "emailToChatterAddress": "0F9...@post.2o-i6mbeaq.eu25.chatter.salesforce.com",
* "fileCount": 0,
* "id": "0F9...",
* "information": {
* "text": null,
* "title": null
* },
* "isArchived": false,
* "isAutoArchiveDisabled": false,
* "isBroadcast": false,
* "lastFeedElementPostDate": "2023-11-22T11:25:37.000Z",
* "memberCount": 1,
* "motif": {
* "color": "1B96FF",
* "largeIconUrl": "/img/icon/groups64.png",
* "mediumIconUrl": "/img/icon/groups32.png",
* "smallIconUrl": "/img/icon/groups16.png",
* "svgIconUrl": null
* },
* "myRole": "GroupOwner",
* "mySubscription": {
* "id": "0FB...",
* "url": "/services/data/v58.0/chatter/group-memberships/0FB..."
* },
* "name": "Test",
* "owner": {
* "additionalLabel": null,
* "communityNickname": "User1696423780773910041",
* "companyName": "Salesforce",
* "displayName": "Firstname",
* "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": "Firstname",
* "outOfOffice": {
* "message": ""
* },
* "photo": {
* "fullEmailPhotoUrl": "https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0IogXzXAXaYKJnuWCNQmXymRq?fromEmail=1",
* "largePhotoUrl": "https://<my_domain>/profilephoto/7292o000000oAgZ/F",
* "mediumPhotoUrl": "https://<my_domain>/profilephoto/7292o000000oAgZ/M",
* "photoVersionId": "729...",
* "smallPhotoUrl": "https://<my_domain>/profilephoto/7292o000000oAgZ/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"
* },
* "pendingRequests": null,
* "photo": {
* "fullEmailPhotoUrl": "https://<my_domain>/img/userprofile/default_group_profile_200_v2.png?fromEmail=1",
* "largePhotoUrl": "https://<my_domain>/profilephoto/0F9/F",
* "mediumPhotoUrl": "https://<my_domain>/profilephoto/0F9/M",
* "photoVersionId": null,
* "smallPhotoUrl": "https://<my_domain>/profilephoto/0F9/T",
* "standardEmailPhotoUrl": "https://<my_domain>/img/userprofile/default_group_profile_45_v2.png?fromEmail=1",
* "url": "/services/data/v58.0/chatter/groups/0F9.../photo"
* },
* "type": "CollaborationGroup",
* "url": "/services/data/v58.0/chatter/groups/0F9...",
* "visibility": "PublicAccess"
* }
* ],
* "nextPageUrl": null,
* "previousPageUrl": null
* }
* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
lcCurrentPageUrl = loJResp.StringOf("currentPageUrl")
lcNextPageUrl = loJResp.StringOf("nextPageUrl")
lcPreviousPageUrl = loJResp.StringOf("previousPageUrl")
i = 0
lnCount_i = loJResp.SizeOfArray("groups")
DO WHILE i < lnCount_i
loJResp.I = i
lcAdditionalLabel = loJResp.StringOf("groups[i].additionalLabel")
lcAnnouncement = loJResp.StringOf("groups[i].announcement")
lcBannerPhotoUrl = loJResp.StringOf("groups[i].bannerPhoto.bannerPhotoUrl")
lcBannerPhotoVersionId = loJResp.StringOf("groups[i].bannerPhoto.bannerPhotoVersionId")
lcV_Url = loJResp.StringOf("groups[i].bannerPhoto.url")
lnCanHaveChatterGuests = loJResp.BoolOf("groups[i].canHaveChatterGuests")
lcCommunity = loJResp.StringOf("groups[i].community")
lcDescription = loJResp.StringOf("groups[i].description")
lcEmailToChatterAddress = loJResp.StringOf("groups[i].emailToChatterAddress")
lnFileCount = loJResp.IntOf("groups[i].fileCount")
lcId = loJResp.StringOf("groups[i].id")
lcText = loJResp.StringOf("groups[i].information.text")
lcTitle = loJResp.StringOf("groups[i].information.title")
lnIsArchived = loJResp.BoolOf("groups[i].isArchived")
lnIsAutoArchiveDisabled = loJResp.BoolOf("groups[i].isAutoArchiveDisabled")
lnIsBroadcast = loJResp.BoolOf("groups[i].isBroadcast")
lcLastFeedElementPostDate = loJResp.StringOf("groups[i].lastFeedElementPostDate")
lnMemberCount = loJResp.IntOf("groups[i].memberCount")
lcColor = loJResp.StringOf("groups[i].motif.color")
lcLargeIconUrl = loJResp.StringOf("groups[i].motif.largeIconUrl")
lcMediumIconUrl = loJResp.StringOf("groups[i].motif.mediumIconUrl")
lcSmallIconUrl = loJResp.StringOf("groups[i].motif.smallIconUrl")
lcSvgIconUrl = loJResp.StringOf("groups[i].motif.svgIconUrl")
lcMyRole = loJResp.StringOf("groups[i].myRole")
lcId = loJResp.StringOf("groups[i].mySubscription.id")
lcMySubscriptionUrl = loJResp.StringOf("groups[i].mySubscription.url")
lcName = loJResp.StringOf("groups[i].name")
lcAdditionalLabel = loJResp.StringOf("groups[i].owner.additionalLabel")
lcCommunityNickname = loJResp.StringOf("groups[i].owner.communityNickname")
lcCompanyName = loJResp.StringOf("groups[i].owner.companyName")
lcDisplayName = loJResp.StringOf("groups[i].owner.displayName")
lcFirstName = loJResp.StringOf("groups[i].owner.firstName")
lcOwnerId = loJResp.StringOf("groups[i].owner.id")
lnIsActive = loJResp.BoolOf("groups[i].owner.isActive")
lnIsInThisCommunity = loJResp.BoolOf("groups[i].owner.isInThisCommunity")
lcLastName = loJResp.StringOf("groups[i].owner.lastName")
lcMotifColor = loJResp.StringOf("groups[i].owner.motif.color")
lcMotifLargeIconUrl = loJResp.StringOf("groups[i].owner.motif.largeIconUrl")
lcMotifMediumIconUrl = loJResp.StringOf("groups[i].owner.motif.mediumIconUrl")
lcMotifSmallIconUrl = loJResp.StringOf("groups[i].owner.motif.smallIconUrl")
lcMotifSvgIconUrl = loJResp.StringOf("groups[i].owner.motif.svgIconUrl")
lcMySubscription = loJResp.StringOf("groups[i].owner.mySubscription")
lcName = loJResp.StringOf("groups[i].owner.name")
lcMessage = loJResp.StringOf("groups[i].owner.outOfOffice.message")
lcFullEmailPhotoUrl = loJResp.StringOf("groups[i].owner.photo.fullEmailPhotoUrl")
lcLargePhotoUrl = loJResp.StringOf("groups[i].owner.photo.largePhotoUrl")
lcMediumPhotoUrl = loJResp.StringOf("groups[i].owner.photo.mediumPhotoUrl")
lcPhotoVersionId = loJResp.StringOf("groups[i].owner.photo.photoVersionId")
lcSmallPhotoUrl = loJResp.StringOf("groups[i].owner.photo.smallPhotoUrl")
lcStandardEmailPhotoUrl = loJResp.StringOf("groups[i].owner.photo.standardEmailPhotoUrl")
lcPhotoUrl = loJResp.StringOf("groups[i].owner.photo.url")
lcReputation = loJResp.StringOf("groups[i].owner.reputation")
lcOwnerTitle = loJResp.StringOf("groups[i].owner.title")
lcV_Type = loJResp.StringOf("groups[i].owner.type")
lcOwnerUrl = loJResp.StringOf("groups[i].owner.url")
lcUserType = loJResp.StringOf("groups[i].owner.userType")
lcPendingRequests = loJResp.StringOf("groups[i].pendingRequests")
lcPhotoFullEmailPhotoUrl = loJResp.StringOf("groups[i].photo.fullEmailPhotoUrl")
lcPhotoLargePhotoUrl = loJResp.StringOf("groups[i].photo.largePhotoUrl")
lcPhotoMediumPhotoUrl = loJResp.StringOf("groups[i].photo.mediumPhotoUrl")
lcPhotoPhotoVersionId = loJResp.StringOf("groups[i].photo.photoVersionId")
lcPhotoSmallPhotoUrl = loJResp.StringOf("groups[i].photo.smallPhotoUrl")
lcPhotoStandardEmailPhotoUrl = loJResp.StringOf("groups[i].photo.standardEmailPhotoUrl")
lcPhotoUrl = loJResp.StringOf("groups[i].photo.url")
lcV_type = loJResp.StringOf("groups[i].type")
lcUrl = loJResp.StringOf("groups[i].url")
lcVisibility = loJResp.StringOf("groups[i].visibility")
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/chatter/groups
Postman Collection Item JSON
{
"name": "List of Groups",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {}
},
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/chatter/groups",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"chatter",
"groups"
]
},
"description": "A list of all the groups in the organization. Get information about groups or create a group.\n\nhttps://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_groups_ListOfGroups.htm"
},
"response": [
{
"name": "Successful List of Groups",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/chatter/groups",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"chatter",
"groups"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 22 Nov 2023 11:25:52 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 \"currentPageUrl\": \"/services/data/v58.0/chatter/groups\",\n \"groups\": [\n {\n \"additionalLabel\": null,\n \"announcement\": null,\n \"bannerPhoto\": {\n \"bannerPhotoUrl\": \"https://<my_domain>/profilephoto/0F9/B\",\n \"bannerPhotoVersionId\": null,\n \"url\": \"/services/data/v58.0/chatter/groups/0F9.../banner-photo\"\n },\n \"canHaveChatterGuests\": false,\n \"community\": null,\n \"description\": \"Test group\",\n \"emailToChatterAddress\": \"0F9...@post.2o-i6mbeaq.eu25.chatter.salesforce.com\",\n \"fileCount\": 0,\n \"id\": \"0F9...\",\n \"information\": {\n \"text\": null,\n \"title\": null\n },\n \"isArchived\": false,\n \"isAutoArchiveDisabled\": false,\n \"isBroadcast\": false,\n \"lastFeedElementPostDate\": \"2023-11-22T11:25:37.000Z\",\n \"memberCount\": 1,\n \"motif\": {\n \"color\": \"1B96FF\",\n \"largeIconUrl\": \"/img/icon/groups64.png\",\n \"mediumIconUrl\": \"/img/icon/groups32.png\",\n \"smallIconUrl\": \"/img/icon/groups16.png\",\n \"svgIconUrl\": null\n },\n \"myRole\": \"GroupOwner\",\n \"mySubscription\": {\n \"id\": \"0FB...\",\n \"url\": \"/services/data/v58.0/chatter/group-memberships/0FB...\"\n },\n \"name\": \"Test\",\n \"owner\": {\n \"additionalLabel\": null,\n \"communityNickname\": \"User1696423780773910041\",\n \"companyName\": \"Salesforce\",\n \"displayName\": \"Firstname\",\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\": \"Firstname\",\n \"outOfOffice\": {\n \"message\": \"\"\n },\n \"photo\": {\n \"fullEmailPhotoUrl\": \"https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0IogXzXAXaYKJnuWCNQmXymRq?fromEmail=1\",\n \"largePhotoUrl\": \"https://<my_domain>/profilephoto/7292o000000oAgZ/F\",\n \"mediumPhotoUrl\": \"https://<my_domain>/profilephoto/7292o000000oAgZ/M\",\n \"photoVersionId\": \"729...\",\n \"smallPhotoUrl\": \"https://<my_domain>/profilephoto/7292o000000oAgZ/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 \"pendingRequests\": null,\n \"photo\": {\n \"fullEmailPhotoUrl\": \"https://<my_domain>/img/userprofile/default_group_profile_200_v2.png?fromEmail=1\",\n \"largePhotoUrl\": \"https://<my_domain>/profilephoto/0F9/F\",\n \"mediumPhotoUrl\": \"https://<my_domain>/profilephoto/0F9/M\",\n \"photoVersionId\": null,\n \"smallPhotoUrl\": \"https://<my_domain>/profilephoto/0F9/T\",\n \"standardEmailPhotoUrl\": \"https://<my_domain>/img/userprofile/default_group_profile_45_v2.png?fromEmail=1\",\n \"url\": \"/services/data/v58.0/chatter/groups/0F9.../photo\"\n },\n \"type\": \"CollaborationGroup\",\n \"url\": \"/services/data/v58.0/chatter/groups/0F9...\",\n \"visibility\": \"PublicAccess\"\n }\n ],\n \"nextPageUrl\": null,\n \"previousPageUrl\": null\n}"
}
]
}