We are using SonarQube ver 5.6.6. My requirement is to fetch metrics for all the projects currently in use, through the SonarQube API. I am able to get the same, using the below API URL.
http://sqserver/api/resources?metrics=ncloc,coverage
The list returned by the API is huge. It includes all the projects created in SonarQube, from the beginning. Many of those projects are not active any more. So, I want to exclude those projects from the API response. How can I achieve this? Is there any way to specify multiple project names in the URL in the same way as we mention multiple metrics.
Try using the
api/measures/component
service instead. You'll be able to specifycomponentKey
to narrow the result to only the projects you want.