cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Which rest API to use in order to list the groups that belong to a specific user

Mohit_m
Valued Contributor II

Which rest API to use in order to list the groups that belong to a specific user

5 REPLIES 5

Prabakar
Databricks Employee
Databricks Employee

api/2.0/groups/list-parents

--data '{ "user_name": "someone@example.com" }'

Mohit_m
Valued Contributor II

Please check the below curl command example which invokes list-parents endpoint from the Groups API. It can be extended/modified based on the requirements.

It retrieves all groups in which a given user or group is a member. 

This method is non-recursive; it returns all groups in which the given user or group is a member but not the groups in which those groups are members. 

Example:

curl --netrc -X GET \

https://xxxxx.cloud.databricks.com/api/2.0/groups/list-parents \

--data '{ "user_name": "someone@example.com" }' \

| jq .

Reference documentation from more details:

https://docs.databricks.com/dev-tools/api/latest/groups.html#list-parents

Hubert-Dudek
Esteemed Contributor III

Hi there is groups API.

https://docs.databricks.com/dev-tools/api/latest/groups.html

There is example API call to list members of the group:

curl --netrc -X GET \
https://dbc-a1b2345c-d6e7.cloud.databricks.com/api/2.0/groups/list-members \
--data '{ "group_name": "reporting-department" }' \
| jq .

Hi @Hubert Dudekโ€‹ the API list-members will list all the members of the group, but here the question is to list all the groups of a user. So list-parents is the API to be used. This will give all groups in which a given user or group is a member.

https://docs.databricks.com/dev-tools/api/latest/groups.html#list-parents

jose_gonzalez
Databricks Employee
Databricks Employee

@Mohit Miglaniโ€‹ ,

Make sure to select the best option so the post will be moved to the top and will help in case more users have this question in the future.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group