How to generate the statistic of JIRA projects and issues quickly?

YJ Huang April 27, 2020

Is there a way to quickly know how many projects and issues in JIRA?

The statistic should include the following information:

- List of projects (Fields: Project name, Project Lead)
- Numbers of projects assigned to specific Project Lead (Fields: Project Lead, project amount)
- Issue amount of specific project in each status (Fields: Project name, Backlog, Done,
In Progress, To Do)

I know there is [API][1] that can be used, do you have any suggestions?


[1]: https://docs.atlassian.com/software/jira/docs/api/REST/8.8.1/#api/2/issuetype-getIssueType

2 answers

1 accepted

1 vote
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 29, 2020

Hello @YJ Huang ,

Thanks for reaching out and just a note before I dig to deep into the explanations, as you noted this query is for Jira Server in the tags, just incase anyone else finds this thread looking for the same solution but are on Jira cloud platform I wanted to point out that the links below are specific to Jira Server but If you do find this and are on Jira Cloud make sure to referance the corresponding Jira Cloud API docs as the process will be similar however the endpoints will have slight variations between v2 and v3 rest on the two platforms.

Referencing the options you are looking for:

  1. List of projects (Fields: Project name, Project Lead)
  2. Numbers of projects assigned to specific Project Lead (Fields: Project Lead, project amount)
  3. Issue amount of specific project in each status (Fields: Project name, Backlog, Done,
    In Progress, To Do)

First, I am using the Jira Server platform REST API documentation you noted in your description and again at the following link, which is specific to Jira version 8.8.1 as a referance point for the API calls noted below:

To touch on item 1 and 2 in the list above there are a few location you would want to look You can use the REST API to get the list of all projects and the project lead via:

/rest/api/2/project?expand=lead

and you can get the fields via /rest/api/2/issue/createmeta expanding on the desired project key as described in the KB:

 Alternatively check out the following thread noting an option to do this using an add-on:

For item 3 getting an issue count, you can use a combination of JQL search terms to display the desired content and using the endpoint

 /rest/api/2/search?jql=YOUR_JQL_QUERY 

look at the resulting object and It will contain an attribute "total" which is the count of issues returned by the JQL.  Run the call on a loop one call per status to get the count of each, as an example if you are looking for the number of issues in project ASDF in status "To Do"  run a get on:

 /rest/api/2/search?jql=project%20%3D%20ASDF%20AND%20status%20%3D%20"To%20Do"%20

The JQL could also be leveraged for the items above in 1 and two as well if you are looking for number of issues under a project lead you could use the JQL "project in projectsLeadByUser('username')" to get the total on everything under that lead.

and a full list of JQL search terms and the corresponding operations and functions can be found at:

Let me know if this clarifies the details you were looking for or if you have any additional questions.

Regards,
Earl

1 vote
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 29, 2020

Hello @YJ Huang

Thank you for reaching out.

Indeed, I believe you can find the information you need by using Jira REST API or CSV export.

In order to better understand what information you exactly need and confirm we are on the same page, please allow me to go a little bit further on each request:

 

1 - List of projects (Fields: Project name, Project Lead)

The following REST API might return the project list you need:

GET rest/api/2/project/search?expand=lead

Since it is a paginated request, it returns only 50 projects per request. Use pagination parameters to return more values if you have more than 50 projects on your site.

Additionally, you can use the Expand parameter to return any other fields you need.

 

2 - Numbers of projects assigned to specific Project Lead (Fields: Project Lead, project amount)

There is no REST API that returns the exact count of projects you have, however, you can return a list of projects ordered by project lead:

GET rest/api/2/project/search?orderByowner

 

3 - Issue amount of specific project in each status (Fields: Project name, Backlog, Done,
In Progress, To Do)

You can use the following REST API to return issues based in a JQL query, also using the Expand parameter to return the fields you need:

GET /rest/api/2/search?jql=project=yourproject

 

Additional to that, I believe that the CSV export functionality can also return the information you need, in case you are not very familiar with JSON format. CSV export is based on issues, however, you could easily use a spreadsheet software (LibreOffice, Excel, etc) to properly collect the number of values (projects, project leads, etc) in each column and collect the information you need.

You can check the documentation below for more information about both Jira REST API and CSV export features:

JIRA Server REST API 

How to export to CSV 

Let us know if you have any questions.

Suggest an answer

Log in or Sign up to answer