Get all quality gate information for all projects through sonarqube api (version 8.4.2)

816 views Asked by At

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.

1

There are 1 answers

1
David M. Karr On BEST ANSWER

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.