Being Jira Admin, we need to get the login details like login count and last login for the list of all users from Jira-Software-users group through REST API as database access is restricted for our enterprise.
Hi @jeevitha
This may not be 100% right as I asked gpt and have not tested it or cleaned it up but it should be a good starting point for code:
import requests
# Base URL for your Jira instance
base_url = "https://your-jira-instance.com/rest/api/3"
# Jira Software Users group name
group_name = "jira-software-users"
# Jira API authentication (replace with your credentials or use OAuth)
auth = ("username", "password")
# Get users in the Jira Software Users group
group_members_url = f"{base_url}/group/member?groupname={group_name}"
response = requests.get(group_members_url, auth=auth)
group_members = response.json()["values"]
# Iterate over each user in the group
for user in group_members:
user_key = user["key"]
user_details_url = f"{base_url}/user?username={user_key}"
user_response = requests.get(user_details_url, auth=auth)
user_details = user_response.json()
# Print user details (you can customize this)
print(f"User: {user_details['displayName']} ({user_details['email']})")
# Implement logic to retrieve user activity, e.g., last login or activity date
# You may need to search for issues where the user is the assignee or reporter
# and extract the latest activity date from those issues.
This library is generally easier to use: https://github.com/pycontribs/jira
However developers actually have a separate Atlassian community so it may be best to ask there: https://community.developer.atlassian.com
They are going to be more experienced in this matter.
Hope this helps!
Best,
Clark
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.