I need assistance in obtaining a list of users who were added starting from a specified date. Currently, I have the following code snippet:
from jira import JIRA
jira_instance = JIRA('<your-jira-url>',
basic_auth=('your_username', 'your_password'))
user_list = jira_instance.search_users(".")
for individual in user_list:
jira_member = jira_instance.user(individual.name)
print(jira_member)
However, I’m struggling to include a date filter and specify a project within the query. Is there an effective method to list users beginning from a certain date, or how can I modify the search_users
function to incorporate such a query? Thank you for your help!
Integrating an additional database or logging mechanism for tracking user addition dates might be beneficial. By storing necessary metadata when a user is first added, perhaps in a separate table, you can easily query this information alongside other user attributes. Subsequently, you can update your script to retrieve and filter users from this dataset using standard SQL queries based on your desired date. This solution requires initial setup but offers efficient retrieval of user data over time.
While the JIRA API does provide powerful functionalities, unfortunately, it does not natively support filtering users based on their creation date directly. However, you could work around this limitation by fetching all users and then, in your code, apply your date filter. You could retrieve the list of all the users first as you have done, then check each user’s properties using jira_instance.user(individual.name)
to determine when the user was added. This way, although it might not be the most performant due to the high number of potential requests, you can create a custom filter based on your specified date within your Python code.
If you’re looking to filter by user creation date, you could pair your existing Jira data with an external tracking service that records these timestamps separately. Then you can sync or cross-reference to extract users created post a specific date. This isn’t native to Jira but can be af workaround.