How to get the total number of issues of a JIRA Project?

Since JIRA API only allows to make a search request with a max result of 1000 issues, I need to know if there is a way to get the total number of issues a project so I can iterate through all thousands of issues.

IRestResponse responseIssues = client.Execute(new RestRequest("search?jql=project=" + "\"DATPROJECT\"" + "&maxResults=5000&fields=assignee,summary,timetracking,resolutiondate,resolution,worklog", Method.GET));

I am currently doing like the code above but I only get 1000 results and not 5000 that I need. I know that I can use the filter "startAt" to iterate over all results but I don't know how many issues exist.

Any ideas?

Answers


The search rest point returns total number of issues for a given JQL search. Example result from documentation

{
"expand": "names,schema",
"startAt": 0,
"maxResults": 50,
"total": 1,
"issues": [
    {
        "expand": "",
        "id": "10001",
        "self": "http://www.example.com/jira/rest/api/2/issue/10001",
        "key": "HSP-1"
    }
]

}

This "total":1 value is the one you're looking for.


Hey from rest Api I don't find any rest where you can get all issue.but if you want all issue you can get it from java side. if you need total number of issues use

long getIssueCountForProject (Long projectId)

and if you want all issues and want to iterate it use

Collection<Long> getIssueIdsForProject (Long projectId)

please refer atlassian documentation for all this method.

Thank you.


You can use maxResults=0 to get only descriptive data omitting the actual results.

For example, if we want to know the amount of open issues for the currently logged in user:

rest/api/2/search?jql=project=SP+AND+statusCategory!=3+AND+assignee+in+(currentUser())&maxResults=0

The result:

{
  "startAt": "0",
  "maxResults": "0",
  "total": "68",
  "issues": [
  ]
}

The "total" field here is just what we need.


Need Your Help

QueryRunner Insert method Return Type

java sql spring apache-commons-dbutils

I am using Apache Commons DBUtils according to QueryRunner#insert method in its documentation,insert return the generic type of ResultSetHandler. I have a BR_Author object at my project.

json query response value shows undefined

javascript json odata sapui5

I am consuming ODATA service to get the resulting dataset from a table. I get the data in JSON format like as shown below.