How to get SonarQube Issues Report via API

Viewed 470

Is there a way to get an issues report by querying the SonarQube web API?

With previous versions of SonarQube, I was able to generate an HTML report after each build but this feature looks like it's been deprecated in newer installments.

At the moment, I'm trying this bit of code

curl -u foo:bar https://sonar.example.com/api/issues/search?pageSize=100&componentKeys=my-app&metricKeys=violations,ncloc,line

But it errors with {"errors":[{"msg":"The 'component' parameter is missing"}]

Ideally, what I'm after is to just get the lines of code, the number of bugs, vulnerabilities, and Code smells in each run/scan.

Something like thisenter image description here

But through querying the API after each analysis.

Is this possible, please?

0 Answers
Related