Jira Rest API - Get User information JSON response

Hello Community,

I have run into an issue with the User Rest API provided by Jira.

I can succesfully fetch the information related to any user and visualize it in JSON format. I utilize the following API call:

<Jira Base URL>/rest/api/2/user?username=jiraUserName

This returns me all the information pertaining to a user, including the groups the user is in as well as the applicationRoles associated with said user.

For somereason the last two fields I mention need to be expanded. 

They show up as following before being expanded:

"groups":{"size":3,"items":[]},"applicationRoles":{"size":1,"items":[]},"expand":"groups,applicationRoles"

They show up as follows after being expanded with the new url:  

<Jira Base URL>/rest/api/2/user?username=jiraUserName&expand=group,applicationRoles.

"groups":{"size":3,"items":[{"name":"jira-administrators","self":"<Jira Base URL>/rest/api/2/group?groupname=jira-administrators"},{"name":"jira-infosec","self":"<Jira Base URL>/rest/api/2/group?groupname=jira-infosec"},{"name":"jira-users","self":"<Jira Base URL>/rest/api/2/group?groupname=jira-users"}]},"applicationRoles":{"size":1,"items":[{"key":"jira-software","name":"JIRA Software"}]},"expand":"groups,applicationRoles"

Regardless of when I expand or not, when I try to fetch the JSON data returned from the API by going "data.groups" I am returned with "undefined", where data is all the data returned by the API.

I am wondering if anyone can tell me how to fetch the data inside "groups" and "applicationRoles".

-Roberto

1 answer

1 accepted

0 votes

So, are you trying to get all members of the group by expanding it? If so try the "/rest/api/2/group" or "/rest/api/2/group/members" resource, depending on your version.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,782 views 11 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot