user3693913
user3693913

Reputation:

Jira REST Java Client get all issues using searchJql

I am trying to get all issues from the project using JQL query but get only 50, I know that it is a problem, but how I can figure out with it?

Promise<SearchResult> searchJqlPromiseTest = client.getSearchClient().searchJql("project = UARECR ");
for (Issue issue : searchJqlPromiseTest.claim().getIssues()) {
    System.out.println(issue.getId());
}

Upvotes: 1

Views: 3795

Answers (2)

David Soroko
David Soroko

Reputation: 9086

searchJql (in v 5.2.5) has this signature:

searchJql(String jql, Integer maxResults, Integer startAt, Set<String> fields)

If maxResults is null, a default value is assumed which seems to be 50. If maxResults is specified, it still possible that the Jira instance is configured to never return more then a predefined number of results.

This means that you need to examine the value SearchResult.total and repeatedly execute searchJql while bumping up startAt.

Upvotes: 0

Somaiah Kumbera
Somaiah Kumbera

Reputation: 7489

Use this function, which accepts 4 params:

Jira rest API searchRestClient.searchJql

Now you can set the maxResults value. Since you are not setting it, it is defaulting to 50

Upvotes: 0

Related Questions