Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to see 'Last Modified By' and 'Last Modified Date' of an Inactive user record?

Srilata Meka October 20, 2021

Hello all,

We are Jira Cloud users. Reaching out to you all with few queries

1. How to get the list of Inactive users?

2. We are creating a POC for automating 'Inactivating user record(s)' using Informatica. This is to replace a manual process. How to obtain the 'Last Modified By' and 'Last Modified Date' of an Inactive user record?

3. How to activate an Inactive user in Jira Cloud instance (for testing purpose)?

I see that there are several apps out there for 'Managing Inactive users for Jira' but would prefer a solution without having to install any app.

Any help is highly appreciated!

Thanks in advance!

2 answers

Suggest an answer

Log in or Sign up to answer
3 votes
Mark Simpson October 21, 2021

@Srilata Meka,

To retrieve a comprehensive list of users, use this RESTAPI endpoint, substituting your site GUID in the {SITEGUID} field

https://admin.atlassian.com/gateway/api/adminhub/um/site/{SITEGUID}/users?count=100&start-index=1

Users can only be gathered 100 at a time, so increment the "start-index" field by 100 each time until all records are received.

Each JSON record returned has an "activeStatus": field that returns either "DISABLED" or "ENABLED". This answers point (1) above.

Also, each record also contains a "presence" field that is the last login time:

"presence": "2021-09-17T12:28:53.653554Z"

That answers point (2) above.

To activate an inactive user, use this RESTAPI point:

POST to:

https://admin.atlassian.com/gateway/api/users/{USERGUID}/activate
The USER GUID is available in each record under the field "id", also found within the JSON record. This answers part (3) of your question.
Also, in case anyone needs it, to deactivate a user record, POST to 
https://admin.atlassian.com/gateway/api/adminhub/um/site/{SITEGUID}/users/{USERGUID}/deactivate
Best,
Mark
Srilata Meka October 21, 2021

Thank you @Mark Simpson for such detailed response!

Like Mark Simpson likes this
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2021

@Mark Simpson Great answer. Can you point us to some online documentation for this Admin API? It appears to be separate from the normal Jira Cloud REST API.

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2021

Thanks @Mark Simpson, but I don't see the /api/users and /api/adminhub requests documented at that link. 

Mark Simpson October 21, 2021

Apologies @Mykenna Cepek 

I'll have a look around my notes later tonight and advise.

Best,

Mark

Mark Simpson October 21, 2021

@Mykenna Cepek - from my notes, I can only find references to other community posts where these RESTAPI endpoints are mentioned. Indeed, in the first post Petter Gonçalves from Atlassian suggests that "the endpoint is not official, not documented, and may change over time."

For user retrieval my starting point reference was:

https://community.atlassian.com/t5/Jira-Software-questions/How-to-export-users-in-CSV-file-by-API/qaq-p/1390780

 

For deactivating users, I found this syntax here:

https://community.atlassian.com/t5/Jira-questions/How-to-disable-multiple-users-in-Jira-Cloud-by-script/qaq-p/1326293

Best,

Mark

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2021

This sounds like a concern for some standalone automation. From @Mark Simpson's first link above:

...as a possible workaround, you can grab the cookie from an active site-admin session from the browser and then use it to authenticate a REST API POST request...

and:

...this is just a workaround, the endpoint is not official, not documented, and may change over time.

Cookies expire, of course. This doesn't sound like a solid option for a general desire to help "managing users". 

But this approach might be ok for a manual, one-time (or occasional) thing -- some bulk cleanup, for example.

2 votes
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 20, 2021

To get a list of inactive users, the Jira Cloud REST API call to "Bulk get users" includes a field per-user for "active".

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-post

I don't see that any of the User related API calls include any "Last Modified" metadata per user record. Might be worth trying some of the User API calls just to ensure that the docs aren't out of date.

I'm not sure that data is persisted, although I could see that it might be in the audit log for a period of time. However, the Jira Admin UI does not currently seem to show any "Last Modified By" data when activating / inactivating users, and neither does the Audit Log.

I believe that Apps have more access to Jira internals than the REST API offers.

You can manually activate an inactive user in the Jira Admin UI for Users by clicking the "Grant site access" link. It's recommended to review the individual products they will then be able to access.

Srilata Meka October 20, 2021

Thank you @Mykenna Cepek for such detailed & prompt response! Let me try out Jira Cloud REST API calls & will share my findings.

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2021

I also noticed that the Jira Cloud REST API does include some access to the Jira Audit Log:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-audit-records/#api-rest-api-3-auditing-record-get

There might be some data in there about who changed User Records.

More about the Audit Log in general here:

https://support.atlassian.com/jira-cloud-administration/docs/audit-activities-in-jira-applications/

Like Srilata Meka likes this
TAGS
AUG Leaders

Atlassian Community Events