Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get full output of filter execution using powershell script?

While running url for cloud jira filter getting 110 Jiras. But while calling that service using powershell script(Rest API) getting  only 50 jiras as output.
Is there any way to get all the jiras in issues object?
Please suggest

1 answer

0 votes

Hello @Sreejesh Padippura Veettil ,

Welcome to the Atlassian Community!

If I understand correctly what you are trying to call a REST API endpoint to search for issues from a power-shell script, but this is only returning 50 results instead of the 110 results you get when you run the same query in Jira.

Can you kindly confirm my understanding is correct or provide more details?

 

Now, if my understanding is correct, depending on the REST API endpoint called this can actually be the expected behavior and you simply need to cycle through the results, as mentioned in the Jira Cloud REST API - Pagination documentation:

Pagination

The Jira REST API uses pagination to improve performance. Pagination is enforced for operations that could return a large collection of items. When you make a request to a paginated resource, the response wraps the returned array of values in a JSON object with paging metadata. For example:

Copy
{
    "startAt" : 0,
    "maxResults" : 50,
    "total": 200,
    "isLast": false,
    "values": [
        { /* result 0 */ },
        { /* result 1 */ },
        { /* result 2 */ }
    ]
}
  • startAt is the index of the first item returned in the page.
  • maxResults is the maximum number of items that a page can return. Each operation can have a different limit for the number of items returned, and these limits may change without notice. To find the maximum number of items that an operation could return, set maxResults to a large number—for example, over 1000—and if the returned value of maxResults is less than the requested value, the returned value is the maximum.
  • total is the total number of items contained in all pages. This number may change as the client requests the subsequent pages, therefore the client should always assume that the requested page can be empty. Note that this property is not returned for all operations.
  • isLast indicates whether the page returned is the last one. Note that this property is not returned for all operations.

 

In other words, you will need to run multiple request having different value for startAt until you get all the results.

In your script you can achieve this by doing something like below example:

 

while(isLast!=true) {
   startAt = startAt + maxResult;
}

 

Finally, there is a Feature Request open in our system asking to increase the value for maxResults:

You may want to vote and watch the above feature request so that you will get notified in case of any update. The  feature will be addressed according to the Implementation of New Features Policy

 

I hope this helps.

 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center Apps Program coming soon

G’day Bamboo customers, As we approach GA for Bamboo Data Center , we would like to inform you that the Data Center Apps Program for Bamboo starts this quarter. How long does it take? We are g...

69 views 0 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you