Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Querying JIRA to Produce Counts of Issues by Different Type

Tags:

jira

jql

Suppose I have the following JIRA filter.

project = XXX AND resolution = Unresolved AND assignee in (EMPTY) ORDER BY Type asc, priority desc

I use it to see all unassigned issues in a certain project and pull from for triage.

Every now-and-then, I need to know how many are in each Type, i.e., I actually want a count for each.

How could I modify this query to do that or write a new one that accomplishes the same thing?

like image 993
MadPhysicist Avatar asked Jan 31 '19 16:01

MadPhysicist


1 Answers

Remember that JQL isn't SQL - it just operates on tickets and returns lists of them for other parts of JIRA to consume, and doesn't really have a mechanism for counting results.

That said, you can use the JIRA REST API's /search endpoint along with maxResults=0 to construct JQL queries for each Type you care about, and the endpoint will give you a total value for that ticket Type:

https://jira.url/rest/api/latest/search?jql=project%20=%20XXX%20AND%20resolution%20=%20Unresolved%20AND%20assignee%20in%20%28EMPTY%29%20AND%20Type%20=%20Task&maxResults=0

Results in this output for Type=Task:

{
    "startAt":0,
    "maxResults":0,
    "total":123,
    "issues":[]
}
like image 160
Adil B Avatar answered Oct 06 '22 23:10

Adil B