JIRA /rest/api/2/user call problem

Hi,

I have a question concerning return value of API call mentioned above. Documentation example https://docs.atlassian.com/jira/REST/latest/#d2e4021 :

{
    "self": "http://www.example.com/jira/rest/api/2/user?username=fred",
    "name": "fred",
    "emailAddress": "fred@example.com",
    "avatarUrls": {
        "24x24": "http://www.example.com/jira/secure/useravatar?size=small&ownerId=fred",
        "16x16": "http://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred",
        "32x32": "http://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred",
        "48x48": "http://www.example.com/jira/secure/useravatar?size=large&ownerId=fred"
    },
    "displayName": "Fred F. User",
    "active": true,
    "timeZone": "Australia/Sydney",
    "groups": {
        "size": 3,
        "items": []
    }
}

Am trying to find to which groups the user belongs to. However there doesnt seem to be any groups visible in "groups" section ("items" list is empty) in spite of the fact that "size" is actually 3. Is this a bug or did I just misunderstood something ?

I could also perform following call https://docs.atlassian.com/jira/REST/latest/#d2e2010 but it needs admin permission which doesnt seem safe in our environment since the task will be automatic.

Thanks in advanced Marek


1 answer

1 accepted

Hey Marek,

to get the the groups you have to add an extra parameter like in following example call

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

Cheers Julian

Hey Julian,

thank you, helped me a lot.

Marek

then fell free to accept my answer ;-)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

119 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you