0

I have list of projects in my sonarqube dashboard, how can I get quality information like code coverage, code smell, vulnerability, and other details of all the projects in a single api call (sonarqube web api) ?

Referred web-api documentaion (https://next.sonarqube.com/sonarqube/web_api/), but not able to get much help from it.

Dan
  • 651
  • 1
  • 14
  • 31

1 Answers1

1

The following is a short excerpt from code that gets some metrics from a scan after it is completed:

"curl -s -X GET -u ${authString} \'${sonarProps['sonar.host.url']}/api/measures/component?" +
    "metricKeys=coverage,duplicated_lines_density" +
    "&component=${sonarQubeProjectName}&branch=${branchName}\'"

The syntax of the property references are unimportant for your question. Notice the list of "metricKeys" being supplied.

David M. Karr
  • 14,317
  • 20
  • 94
  • 199
  • the above will work but I have to trigger it for every project and it will become messy if I have 100+ projects, Are there any other endpoints that I can use to get all projects metrics in a single API call? – Dan Nov 06 '20 at 08:08