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
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" } ] }
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
Thanks!
Setting "maxResults=0" only returns the metadata without the rows if you're only interested in the total:
rest/api/2/search?jql=project=YOUR_PROJECT&maxResults=0
Is there an straight JQL equivalent for this ?
Nice, thanks Bill
If you want to get issue count output you can setup query using generate api
for example if you want project base issue count then you can apply this rest api for that
URL :- "/rest/gadget/1.0/stats/generate.json?projectOrFilterId=jql-ORDER+BY+created+DESC&statType=project&includeResolvedIssues=true&sortDirection=desc&sortBy=total"
Hear in "projectOrFilterId" you can set your jql query and "statType" as like a groupBy.
Well you can could just do a normal JQL query
issuetype = 'Test' and TestRunStatus = "pass" and assignee = <UserName>
Then tools will give a count for the query
A bit of a bodge but does tell you what you need to know
Execute a CURL command for your project specifically like this on command line and pipe more. The first line shows "total" issues in your project
e.g
COMMAND
\curl -D- -u username:password -X GET -H "Content-Type: application/json" http://localhost:8081/rest/api/2/search?jql=project='ABC' | more
OUTPUT
...
100 501k 0 501k 0 0 501k 0 --:--:-- --:--:-- --:--:-- 892k{"expand":"schema,names","startAt":0,"maxResults":50,"total":219,"issues":[{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields"
....
I need to get the record count and then show it on confluence - is this possible?
You are in luck @namrata singhal for confluence this is built in.1: When editing add "Jira Issue/Filter"2: After you have made your filter. Select "Display Options" and the "Total Issue Count"
Is there a way to change the font type/size of the displayed count in confluence?
I need to count of tickets for each project. I tried above mentioned API but it's returning me error
Invalid JQL query specified for chart \'ORDER+BY+created+DESC\'
I tried with another API wherein projectOrFilterId=jsql-create+>+created and I got same issue again.
API works if I give a hardcoded project id though.
Thanks
This has a limitation, it will not show the actual count for entries more than 1000.
The best way I have found, using Zephyr Jira is to use the options under Export, inside the Filters page.
Once you have created your jql query, Click on Export, you will see the Print list option.
Clicking on Print List will open a new tab with the same list from the last page.
It will also give you this line: 1 – ### of ### as at: Day/Month/Year Time.
That ### is the number you are looking for.
Print List Option:
Printed List:
Add this onto your JQL to get the count (assuming you have Adaptavist ScriptRunner):
issueFunction in aggregateExpression("count", "reporter.count{it}")
It looks like you're new here. Sign in or register to get started.