when I am trying to get project list getting empty array

sunil-gakhar-onebcg July 16, 2019

when I am trying to get project list getting empty array using https://xxxxx.atlassian.net/rest/api/3/project I am getting empty array although projects and issues are present in jira account . 

2 answers

1 accepted

1 vote
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 17, 2019

Hi Sunil,

The Endpoint you are hitting "GET /rest/api/3/project" is the correct endpoint for Jira Cloud, so there is more than likely a permissions issue for the user calling the end point, as covered in the API doc for the endpoint:

Projects are returned only where the user has Browse Projects or Administer projects project permission for the project

Can you check and verify that the user has the appropriate permissions on the projects to return a result set.

Regards,
Earl

1 vote
sunil-gakhar-onebcg July 17, 2019

Thanks Earl,

Got it now I am getting all issues/projects but it is returning me only 100 records in one request Can I get  all issues in single request Although I am passing maxResults=200000.

 

Regards,

Sunil 

Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 18, 2019

Hi Sunil,

Awesome And Great the hear, thanks for sharing the results.

The max results variable can defiantly throw a wrench in the expected result set when you are pulling larger data sets, and I'm just adding some additional info here for referance or incase anyone else runs into this thread with the same issue looking for some additional details.

Just adding the &maxResults=amount_you_want to the end of a URL used in your call should do the trick in most cases and there are some additional details on on passing in max results variables into your query in the following KB article:

Regards,
Earl

sunil-gakhar-onebcg July 19, 2019

Thanks Earl , But when I passing 1000 to maxResults it giving not more than 100 records I want all issues in single request and I am not sure how many result will return then how can I pass  &maxResults=amount_you_want before knowing how many total issues Earl Could you provide me solution regarding this .

 

Regards,

Sunil 

Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 19, 2019

Hi Sunil,

Great Question, and sorry for any confusion as I missed a point here on a distinction between Server and Cloud and as your on cloud the above details hit a blocker. 

Cloud has a limitation in place, that can be mitigated on a Server install with container modifications and the option to restart if a error occurs however as Cloud Admins cannot restart the instance on their own, and overwhelming this endpoint has a high potential to crash the system which in effect causes huge impact on restart delays whenever a incident occurred.  For the maxResults variable the returned value has a capped maxResult set to prevent the container from running out of memory and crashing while calling large data sets or something we have seen frequently is when accidentally triggering a infinite loop using a scripted API request in effect hammering an instance with repeated large data set calls for an instant fail over.  

Some additional details on this change can be seen in This Report, which notes the following:

In principle, our recommended solution is to rely on pagination to retrieve the desired number of results in chunks for any API that supports startAt parameter. We also recommend that REST API clients systematically confirm maxResults value when making the requests to prevent disruptions whenever these limits change. That being said, we updated the related Knowledge Base article, which was inaccurately suggesting the default value of response results to be 1000.

And for some additional info in the Workaround the solution here is:

You can use the startAt parameter to get the other results (if more than 100 are returned). /search endpoint implements pagination api which can be used to retrieve all the required data.  

Regards,
Earl

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events