JIRA /rest/api/2/user call problem

Marek Kidon November 5, 2013

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

0 votes
Answer accepted
JulianA
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 5, 2013

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

Marek Kidon November 5, 2013

Hey Julian,

thank you, helped me a lot.

Marek

JulianA
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 5, 2013

then fell free to accept my answer ;-)

Suggest an answer

Log in or Sign up to answer