How to get a list of groups that a user belongs to using jira rest api?

Andrei Iorga November 25, 2020

Hello, I am using jira server and I want to get a list of the groups that a user belongs to based on the username or user email. According to this documentation:

 https://docs.atlassian.com/software/jira/docs/api/REST/8.13.1/#api/2/user-getUser

 I should get such a list of groups when I call the Get User endpoint. However unlike the documentation, I have an empty "items" field in the response body. Is there a way to solve this or any way to get this list of groups? Thank you.

 

Screenshot from 2020-11-25 12-25-49.png

2 answers

1 accepted

5 votes
Answer accepted
Daniel Ebers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 28, 2020

Hi Andrei,

not the first time this was mentioned but too early to give up.

It was said that this works instead:

/rest/api/2/user?username=username&expand=groups

Could you please try?

Thanks,
Daniel

Dave Menconi January 6, 2023

I tried and it worked for me. /rest/api/2/user?username=username&expand=groups
I'm running 18.22.3 and I'm an admin.

 

Yeah the question was asked 2 years ago but, believe me, it's still relevant. 

 

Thanks Daniel!

 

Dave

Like Sean Cooper likes this
0 votes
Bloompeak Support
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 25, 2020

Hi @Andrei Iorga ,

I am not sure, but can it be the case that it requires the requestor of the REST call to have admin rights? That is, if you are not admin, jira does not allow to view groups of another user.

Andrei Iorga November 25, 2020

Hi @Bloompeak Support  thank you for your answer. I have tried the REST with a requestor with admin rights and the response is the same.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events