1

If you want to join a private Chatter group via the Chatter REST API you're supposed to send a POST request to:

/services/data/<<Version>>/chatter/groups/<<GroupId>>/members/requests

with the body:

{
  "userId" : "me"
}

Which is all well and good. However, if you're an Administrator (i.e. you have the Modify All Data permission) you don't have to request, you can just join which is via a different URL. If you hit the above URL as an Administrator you get this back:

errorCode: NOT_MODIFIED

message: Administrators should create memberships directly on the group instead of requesting memberships

So the quesiton is this: does the Chatter REST API itself provide a means for you knowing which URL to hit in advance?

I assume that somehow, somewhere it does, since the standard Salesforce UI shows "Join" if you're an Administrator, as opposed to "Ask to Join" if you're not.

1

You can use the Organization resource (GET /connect/organization) and inspect the userSettings.canModifyAllData property of the response to determine whether or not the user issuing the request is an admin user.

If the user is an admin user, POST to the Group Members resource to join the group.

  • Didn't occur to me to look under /connect. Thanks, exactly what I was looking for! – Matt Lacey Jul 30 '15 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.