I am trying to efficiently find all the JIRA issues that were closed in the last week. Does anyone know how to do this in a nice way?
My messy solution right now is to loop over every issue in a project and compare its closing date and time to the current time. However, the loop must start and end with given keys, such as PROJECT-1000 to PROJECT-2000. This isn’t very satisfying having to hardcode these values in and I don’t want to have to increase the upper bound from 2000 to something higher every time more issues are added. I could choose a very large number that will almost certainly be larger than the highest id number (scan until PROJECT-7777777), but this slows down the program way too much.
(Keep in mind that even old issues with small ids may be closed very recently, meaning that it won’t work to just scan over issues that were created since the last running of the application.)
Any suggestions for an elegant way of doing this?
You can create a filter using the JQL, and then access it using the SOAP API.
First, to create the filter, use a query of this sort:
Than, you can access your filter using the
getIssuesFromFilterWithLimitSOAP function.By the way, If for any future reason you want to find the highest issue key, check out this answer.
EDIT
To find the filter ID, go to http://your.jira.com/ManageFilters.jspa (Manage Filters) and choose the filter. Then in the URL you will see the
requestId.As @C.Williamson said, there’s also getIssuesFromJqlSearch(token, jqlQuery, maxIssuesReturned), which saves the use of a filter by executing the JQL directly.