Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get all issues in jira with REST API-plugin development

Ivana Srebrenova June 2, 2022 edited

Hello everyone.

For my plugin development I need to implement a dropdown field with all the issues in a jira server.

I use a REST API call, firstly to get the total number of issues, and then I pull one by one issue and append them into the input field. I do this one by one, to get around the problem with 50 maxResults with one REST API request.

The execution of the script is slow, and sometimes the script don't get all the issues.

Can I optimize this REST API call, or maybe someone can help me with another kind of solution? Thank you

AJS.$.ajax({
url: AJS.contextPath() + "/rest/api/2/search",
type: "GET",
dataType : 'JSON',
success: function(response){
var totalNumber=response.total;
.......
for(let i=0;i<totalNumber;i++){
AJS.$.ajax({

url: AJS.contextPath() + `/rest/api/2/search?maxResults=1&startAt=${startAt}`,
type: "GET",
dataType : 'JSON',
success: function(response1){

 

1 answer

0 votes
Djiga Sene June 3, 2022

Hi, 

Try to use single select asynchronously https://aui.atlassian.com/aui/latest/docs/single-select.html,  filter the results automatically when typing.

Ivana Srebrenova June 6, 2022

Thank you for the response,

but anyway because of the too many get REST API calls, the browser responds with 

Failed to load resource: net::ERR_INSUFFICIENT_RESOURCES" error

url: AJS.contextPath() + `/rest/api/2/search?maxResults=1&startAt=${startAt}`,
type: "GET",
dataType : 'JSON',
success: function(response1){

I get some of the issues appended on the field, but at some the REST call fails due to thousand AJAX requests.

Suggest an answer

Log in or Sign up to answer