Listing Jira user details with Last login and Role of the user(admin or normalUser) through REST api

sushanth_shettigar February 22, 2021

We are writing node script to list all the user with last login date and role of the user(admin or normal user) in Jira. We are not able to find any related api in the documentation which provides last login date and role.

Is there any REST api's which can help us to retrieve last login date and role(admin or normal user) of all users?and what is the minimum access level for jira token to call those api?

Kindly confirm.

2 answers

0 votes
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.
February 27, 2021

Hi @sushanth_shettigar

for the part of "last login" information you are looking for is a Suggestion open with Atlassian.
Clicking on "Vote for this issue" could help Atlassian in prioritizing the Suggestion.
In case you click on "watch" you will be notified about the progress.
https://jira.atlassian.com/browse/ID-6965

For the rest of your question I can see you receive some valuable information already.

Regards,
Daniel

0 votes
Prince Nyeche
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.
February 22, 2021

Hi @sushanth_shettigar 

Welcome to community! Such an API to list the last login doesn't exist or is not public yet. And I don't think this option would be available without some form of Atlassian access feature.

Likewise, the minimum requirement needed for a user to use the api basically depends on the permission the user has on the instance or projects. To call the roles a user belong to, you basically need the Administer Jira permission to retrieve such information.

sushanth_shettigar February 22, 2021

@Prince Nyeche Could you please provide api document to list all the user with role? which api is used to list role of the user?

Prince Nyeche
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.
February 22, 2021

Hi, I provided the api to list the user roles above. However to get the users, you will need to combine multiple apis to achieve that. 

sushanth_shettigar February 22, 2021

ok, thank you

sushanth_shettigar February 22, 2021

@Prince Nyeche I think i framed wrong question, sorry for that.

Is this api check with user is admin or normal user? if not can you please provide api that list the user is admin or normal user?

Prince Nyeche
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.
February 23, 2021

Hi @sushanth_shettigar 

You need to be an admin before you can query an api to list all the users on the instance. However, knowing which user is admin or not depends on your user group. You can use the group api to determine if a user is in a certain group to differentiate if they are admin or normal users.

Check your Jira admin hub to determine the admin groups that are available on your instance first, then you can be able to distinguish them.

sushanth_shettigar February 23, 2021

@Prince Nyeche Thanks for the update.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events