I'm developing a desktop app using JIRA Cloud API. I want to get all issues but it's limited to 1000 max per request.
I tried to use while function with the statement; if the total number of issues if bigger than retrieved issues, then repeat the REST request. See the code below.
But unfortunately, this did not work. In fact, it crashed.
client.get(`${host}/rest/api/2/search?jql=assignee=currentuser()&startAt=0&maxResults=1000`, authParams, function(data, response){
issues = data.issues;
total = data.total;
while(issues.length < total){
client.get(`${host}/rest/api/2/search?jql=assignee=currentuser()&startAt=${issues.length + 1}&maxResults=1000`, authParams, function(data, response){
issues = issues.concat(data.issues);
});
}
}); Can anyone help? Thanks!