How do you get the groupId required by the Crowd group-level-admin REST method

Dale F July 9, 2019

In my environment we create a collection of groups in Crowd to support role based access controls. We recently upgraded to Crowd Data Center and want to take advantage of the ability to distribute administration of groups.

The group-level-admin set of REST methods seems like it supports this, however, all them require groupId, which isn't the name of the group. I've tested the following rest methods, but none of them include the group ID needed by the group-level-admin methods:

  • GET /rest/admin/1.0/group/search/{directoryId}
  • GET /rest/usermanagement/1/group
  • GET /rest/usermanagement/1/search
  • POST /rest/usermanagement/1/search
  • POST /rest/usermanagement/1/group

The POST /rest/admin/1.0/groups/query method returns the group ID, but this only works if someone is already configured to be an admin of the group, which won't be the case in my environment.

Strangely enough POST /rest/admin/1.0/users/search and GET /rest/admin/1.0/directory/managed return the user ID and directory ID, but the equivalent functionality for groups doesn't.

How can I, through the Crowd REST interface get the group ID of a group if I only know the name of the group and the directory it is in?

If that functionality isn't there, are there any plugins that provide it, or plans to add it in the future? Even through the web interface I couldn't find a way to see the group ID. It seems odd that these REST methods would be added, but not a way to get the information that they require.

Thank you

2 answers

3 votes
Dale F July 10, 2019

A bit of trial and error it looks like the groupId is <directory ID>-<base 64 encoded group name>.

Since the Crowd REST documentation doesn't mention this, can anybody comment if this method of creating the groupId is something that can be relied upon?

Maximilian Ewert September 12, 2019

Crazy, but works for us!

Joe Jadamec September 18, 2019

that groupid format worked for me.   disappionted this is not mentioned anywhere in the REST API documentation!

0 votes
Heiko February 17, 2020

@Dale FHey you write in your that yout get the user ID with the POST /rest/admin/1.0/users/search can you show me how, please? i'm searchin since a lot of tim for a solution to get the crowd userId but i just find the a solution to get the user key

Dale F February 18, 2020

Here's a snippet of Python code that will generate the groupid

import base64
def get_id(directory_id, group_name):
    return ('{}-{}'.format(
                directory_id,
                base64.b64encode(group_name.encode('utf8')).decode(),
               ))

Like Heiko likes this
Heiko February 19, 2020

Hey Dale thanks for your reply. But that's not what I'm searching for. I wrote an post 2 weeks ago. https://community.atlassian.com/t5/Crowd-questions/How-to-get-the-userId-of-an-specific-user-for-the-audit-Log/qaq-p/1299406#M5303 maybe you know what i searching for and have a solution for me.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events