How to get issue count using JQL in jira?

I need to get issue count based on filter using JQL.

for ex.

filter-> project in(ADMIN,MANGMNT) AND "Name" ~ "admin"

JQL needs to be used through REST API.

please help

2 answers

1 accepted

There is no REST resource that returns ONLY the count, but you can use /rest/api/2/search?jql=YOUR_JQL_QUERY and then look at the result object. It will contain an attribute "total" which is the count you want.

Straight from the api doc:

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

 
0 vote

Save the filter and look at it - most of the ways of viewing a filter will give you totals.

Note that JQL is NOT SQL, and it doesn't have anything to say about the results it pulls back. All it does is give other parts ofthe system list of issues to work with.

Thanks Nic.

Would you suggest an alternate way to get only count via any REST API method?

Run the filter and then write some code that adds up the totals in whatever application is you've written the REST code into

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,327 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot