+ Start a Discussion
Jamie ThompsonJamie Thompson 

Leave a public group with chatter api

Hello everyone,

Can anyone point me towards API documentations for how to leave a public group which I have involved as a member?  
I want to leave a group in a mobile app - so need to call this and make available in app.
KaranrajKaranraj
Jamie - Send the HTTP Delete the below chatter API to leave a public group
/chatter/group-memberships/membershipId
Note - Membership IDs are returned from the /chatter/groups/groupId/memberships resource.
JSON example
{   
    "role" : "GroupManager",
    "userId" : "005B0000000Ge16"
}
The role of the member. One of these values:
  • GroupManager
  • StandardMember
Refer the below link for more details https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_group_memberships.htm

Thanks,
Karanraj
alouie_sfdcalouie_sfdc
Thanks, Karanraj. In addition, when you get information about a group via GET /chatter/groups/<groupId> or GET /chatter/groups, one of the properties in the group detail response body is mySubscription:

https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_responses_group_detail.htm

If the user is a member of the group, the mySubscription ID is the group membership ID, which you can use in either DELETE /chatter/group-memberships/<membershipId> or DELETE /chatter/subscriptions/<subscriptionId> to leave the group.