google-api-nodejs-client
google-api-nodejs-client copied to clipboard
API to get Groups that a user belongs to?
Hello - are there any APIs available to determine which groups a user belongs to? I'm having a hard time figuring out how to do this. Ideally, I would like to pass in the email address of a user and get back a list of groups.
Any help is appreciated!
@joetito1 As the documentation states. You can provide customer and userKey. The userKey will show you all groups that the user provided is a part of.
GET https://admin.googleapis.com/admin/directory/v1/groups?customer=abc123&[email protected]
If that doesn't work for some reason, then you can use the query method. Adding [email protected] to the query option will return all the groups he's a part of.
GET https://admin.googleapis.com/admin/directory/v1/groups?customer=abc123&[email protected]
Also posting this thread for more reference: https://github.com/googleapis/google-api-nodejs-client/issues/2515
Thank you @OrKarstoft!