3
votes

How do I get the measures (like code-coverage, technical debt, complexity, nloc, ...) of a certain build version (eg. 1.0.0.20) from the api of SonarQube?

My goal is to get these information and display it along with some-other info pertaining to that version got from other sources like bitbucket.

I am able to only see the measures of the current (latest) build (eg. 1.0.0.45) version through the api/measure/component api link.

Although, I can see these measures for individual builds through the UI under the compare option. But how to get it through rest api?

SonarQube Version 5.5

Plugins:

  • sonar-scoverage-plugin-5.1.3.jar
  • sonar-scm-git-plugin-1.2.jar
  • sonar-scalastyle-plugin-0.0.1-SNAPSHOT.jar
  • sonar-javascript-plugin-2.11.jar
1
Please be more precise, otherwise you'll have a lot of -1 :(. So please explain exactly what you are trying to do, the version of SonarQube and the plugins you are using. - Julien L. - SonarSource Team
i have seen a lot of questions asking the same information,but none of them had satisfying answers. - Saurabh
Maybe because the questions you've found were also not enough precise... - Julien L. - SonarSource Team

1 Answers

1
votes

First of all, SonarQube 5.5 is old, you should first consider using the latest LTS (5.6) in order to be able to get feedbacks.

Versions of projects can be found by using :

  • api/events/index (it's replaced by api/project_analyses/search in 6.3) -> it will return you the date of analysis on which there's a version.

And in order to get measures from the past, you can use :

  • api/timemachine/index (it's replaced by api/measures/search_history in 6.3) -> you'll be able to found the measures from the version you want.