This is an extension of a previous post that I did, on returning all of the users in a Jira Cloud instance.
The request was for a script that returns all users in a Jira Cloud instance who have been inactive for over 30 days. Unfortunately, only part of this request is doable. The Jira Cloud REST API does not currently provide any way of returning login or access timestamp information. The most it will tell you is whether a user account is active or inactive. The only way to get access information is to export the Jira userbase through the Atlassian portal.
So the script below simply returns all Jira users in a Cloud instance who have an inactive account. If/when the day comes that Atlassian adds login information to the API, I’ll update this post.
import groovy.json.JsonSlurper
def sb = []
def page = 0
def lastPage = false
while (lastPage == false) {
//run this loop until we detect the last page of results
def x = 0
//Every time the loop runs, set x to 0. We use x to count the number of users returned in this batch of results
def getUsers = get("/rest/api/2/user/search?query=&maxResults=200&startAt=" +