Search code examples
sonarqubedevops

SonarQube REST APIs : Read Metrics


I am using SonarQube version 6.7.1

I am trying to get JSON Response for our projects sonarQube statistics Just want simple details like

  • Bug count, vulnerability count , % code duplication , code coverage
  • Tried URL http://sonar-server:9000/api/metrics&json=true but got error Unknown url, can someone point out correct URL
  • End Aim is to store Above counts for each run in time series DB .. any suggestions how to do it ?

May be i am not reading / understanding documentation clearly , possibly a pointer to tutorial or example or some other pointers will help me,


Solution

  • Try to use sonarqube.server.com:9000/api/metrics/domains, I am able to get json response from this.

    APIs that you can use are listed at:

    sonarqube.server.com:9000/web_api/api/metrics/domains/search

    but just remove "web_api" while calling, to get json response.