11-10-2021 02:25 AM
Which rest API to use in order to list the groups that belong to a specific user
11-10-2021 02:28 AM
api/2.0/groups/list-parents
--data '{ "user_name": "someone@example.com" }'
11-10-2021 02:29 AM
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
11-10-2021 02:31 AM
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 .
11-10-2021 02:41 AM
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
11-12-2021 03:46 PM
@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.
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