Extracting Rejected Issue Counts from JIRA API using Klipfolio

Hey folks,

I’m stuck trying to get some data from JIRA using Klipfolio. What I need is:

  1. All issues marked as ‘rejected’ in a specific month
  2. How many times each issue was rejected

I’ve tried a couple of queries but they’re not quite giving me what I want. One shows the history for a single issue, and the other counts rejected issues for a project and sprint. But I can’t figure out how to get both the monthly rejected issues and their rejection counts.

Anyone have experience with JIRA Query Language who can point me in the right direction? I’d really appreciate some help on this!

Here’s a dummy code snippet of what I’m trying to achieve:

function getMonthlyRejections(month, year) {
  let rejectedIssues = [];
  let rejectionCounts = {};

  // Query JIRA API here
  // Process the data
  // Populate rejectedIssues and rejectionCounts

  return { rejectedIssues, rejectionCounts };
}

Thanks in advance!

hey Claire29, have you tried using JQL with the ‘status was’ operator? something like:

project = YourProject AND status was Rejected AND statusChanged >= startOfMonth(-1) AND statusChanged <= endOfMonth(-1)

this should give u all issues rejected last month. for rejection counts, you might need to use the changelog API. hope this helps!

Having worked extensively with JIRA and Klipfolio, I can suggest an approach that might solve your problem. You’ll want to use a combination of JQL and the JIRA REST API. Start with a JQL query to get all issues that were in a ‘Rejected’ state during your specified month:

project = YourProject AND status WAS Rejected DURING (startOfMonth(), endOfMonth())

This will give you the base set of issues. Then, use the JIRA REST API to fetch the changelog for each issue. You can count the number of transitions to ‘Rejected’ in the changelog.

In Klipfolio, you might need to create a custom data source that combines these API calls. It’s a bit complex, but it should give you exactly what you need. Remember to paginate your results if you’re dealing with a large number of issues.

I’ve dealt with similar JIRA data extraction challenges before. One approach that worked for me was combining JQL with the REST API. First, use JQL to fetch the rejected issues:

project = YourProject AND status CHANGED TO Rejected DURING (startOfMonth(), endOfMonth())

Then, for each issue, query the changelog to count status transitions to ‘Rejected’. You’ll need to make multiple API calls, but it gives precise results.

For implementation, consider using a scripting language like Python with the JIRA library. It simplifies API interactions and data processing. Just be mindful of rate limits if you’re dealing with a large number of issues.

Also, caching results can significantly improve performance if you’re running this query frequently. Good luck with your project!