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
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

20,948 views 2 7
Join discussion

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