Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get more than 500 issues from SonarQube api

Tags:

sonarqube

I'm using the SonarQube API in a java tool to process issues and add comments to them/change the issue status (e.g. wont fix)

The api/issues/search function has a page size limitation of 500 max. I have more than 500 issues and need to read this. I thought of performing mulitpule queries, but the issue keys are not numberical so I can not just increment and perform a query on the next 500.

Is there any way I can handle more than 500 issues from the API? I thought a workaround would be to get the list of issue keys from the api and query in batches, but this doesnt seem possible.

like image 725
ubergam3r Avatar asked Dec 08 '25 17:12

ubergam3r


1 Answers

  • Short answer : no, it's not possible to get more than 500 issues in a single web service call.

  • Long answer : you should try to use a hook (either by using a plugin or by using a web hook) that is triggered on each project analysis => You'll then be able to browse all project's issues using pagination : api/issues/search?componentKeys=PROJECT_KEY&ps=500&p=1, then api/issues/search?componentKeys=PROJECT_KEY&ps=500&p=2, etc.

    The total number of items can be found in the response, under "paging" -> "total".

like image 87
Julien L. - SonarSource Team Avatar answered Dec 13 '25 00:12

Julien L. - SonarSource Team



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!