how can i get the each status counts?

wonseock.kim March 2, 2016

i want to get the each status counts.

for example, from the below json, i can get the total number

but i want to know the each status counts. (open : ??ea, In Progress : ??ea, Closed : ??ea, etc..)

{

  • "expand":"schema,names",
  • "startAt":100,
  • "maxResults":50,
  • "total":6625,
  • "issues":[
  • ~~~~~~~~~
  • ]
  • }

4 answers

1 accepted

0 votes
Answer accepted
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 2, 2016

Here's one a bit "hacky" solution:

Call the two dimentional filter statistics gadget REST endpoint with the proper parameters and parse the result. Here's a sample URL:

rest/gadget/1.0/twodimensionalfilterstats/generate?filterId=filter-11604&xstattype=statuses&ystattype=statuses&sortDirection=asc&sortBy=natural&numberToShow=5')

Where filter-11604 is the a filter you created that has the JQL you need i.e. componentMatch(~~~~~~)

wonseock.kim March 2, 2016

shall i create the filter?

"~~~~~" are changable values. So i can't register the filter with the certain value

Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 2, 2016

You need to have a filter, so this might not work for you then. You can try implementing a REST endpoint which returns the results you need. To do that you can write a plugin using JAVA or write a scripted REST endpoint using Script Runner

https://scriptrunner.adaptavist.com/latest/jira/rest-endpoints.html

0 votes
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 2, 2016

I don't think you can achieve that using the JIRA REST API with just 1 REST call. You have to make separate call for each status (include the status in the jql query). 

0 votes
wonseock.kim March 2, 2016

i use REST API, rest/api/2/search?jql=component in componentMatch(~~~~~~)&fields=key,summary,status&maxResults=500

0 votes
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 2, 2016

Are you trying to get these from a script which calls the REST API ? Or you just need to see this information somewhere, because you can see this on a dashboard.

Suggest an answer

Log in or Sign up to answer