Forums

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

How to get more than 50 tickets via API with Powershell ?

Mathieu Roos July 6, 2023

Hi Community,

Please help me, I am stuck...

I have a powershell script that extracts tickets using the JIRA API.

Works fine but I can only get the first 50 tickets. I found this page (https://confluence.atlassian.com/jirakb/changing-maxresults-parameter-for-jira-rest-api-779160706.html) about changing the "startAt" attribute in the query but I can't make it work.

With this code, I don't get any error message but it seems like my query is ignored because I get tickets from another project.

I alos tried using a hash table that I convert to JSON with the same result...

Here is the code : 

 

$jql = "{`"jql`": `""+("project=CRAP",`"startAt`":50,`"maxResults`":50}"
$url = ('https://myinstance.atlassian.net/rest/api/2/search?{0}' -f $jql)

$getFromJql = Invoke-WebRequest -Uri $url -Headers $Headers -Method GET -UseBasicParsing

 

Thanks in advance,

Mathieu

1 answer

1 accepted

0 votes
Answer accepted
Himanshi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2023

Hello @Mathieu Roos , 

Welcome to community !

You can try to change these values "startAt`":50,`"maxResults`":50"

to "startAt: 1, maxResults`":50

Then "startAt: 51,`"maxResults:101 Basically it a indexing and pagination technique. 

Suggested on Feature request:

You may reading more about indexing along for the pagination  in the document and feature request above. Hope you would help you. 

Have a nice day!

Mathieu Roos August 11, 2023

Sorry for the late reply.

Works fine :-)

Thanks a lot

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events