Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Need API help to identify users last activity dates

Scott Reopelle
Contributor
January 31, 2020

I'm writing scripts to help my company identify Jira/Confluence users who have not logged in for some amount of time and disable their accounts.

I've looked at the endpoint for getting all users and there's not information returned regarding login info. I checked each of the user options and it appears that none contain that field. 

Can someone help me identify where that information exists using the API?

2 answers

0 votes
Zoryana Bohutska _SaaSJet_
Atlassian Partner
February 6, 2020

Hello @Scott Reopelle 

Alternatively, you can try the additional plugin, such as our Issue History. It allows you to view all history of changes that have been made with the issues. You can optionally filter issue list by the user who made changes. That will help you see the entire activity history of a particular user, including the time of his /her last activity.

issue history.png

Hope it helps

Best Regards

0 votes
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 3, 2020

Hello @Scott Reopelle

Welcome to Atlassian Community!

Unfortunately, It is not possible to return only the specific date/time a user logged for the last time in any products, however, this information can be collected together with other details by using the expand=attributes parameter and checking the productPresenceList:

https://xxxxx.atlassian.net/admin/rest/um/1/user?email=xxxxx&expand=attributes

Screen Shot 2020-02-03 at 16.28.48.png

Can you check if the call above works for what you need?

In order to specifically get that information, I recommend you vote and watch the suggestion created below to increase its priority and also receive notifications about any updates:

Add "Last Jira login date" and "Last Confluence login date" to REST API user calls 

Let us know if you have any questions.

Scott Reopelle
Contributor
February 4, 2020

I'm unable to connect and continue to get "User failed to authenticate". I am using my API key, but it's unclear if that only works when I call api.atlassian.com or if I can use that for my workspace as well..

Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 6, 2020

Hello Scott,

Can you please provide us what are the steps you are taking to authenticate? also, are you facing the same error when you simply run that call in your browser?

Additional to that, please make sure your user is configured as a site-admin to get that kind of information from the API call.

Lars Stuber October 6, 2020

@Petter Gonçalves is this endpoint: https://xxxxxxx.atlassian.net/admin/rest/um/1/user?username=xxxx&expand=attributes working for JIRA cloud? I tried to call this via Postman and username+api key, but its failing. Even though I am Site + Org admin

Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 7, 2020

Hello @Lars Stuber

The username parameter was deprecated from Jira REST API due to the GDPR implementation:

Deprecation notice and migration guide for major changes to Jira Cloud REST APIs to improve user privacy 

That being said, you must use the AccountId or email parameters to properly return the users, as mentioned in the documentation below:

Jira REST API 

Akhil Agarwal September 2, 2021

@Petter Gonçalves, Replaced the username with accountId but did not get the last login in the response. Apparently "expand" only accepts groups and applictionRoles.

Is there any other way to get the last login activity of the user?

Thank you,

Akhil

Barrett Smith
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 21, 2021

I see the same as Akhil reported: expand only accepts groups and applicationRoles

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events