How to get SonarQube metrics from previous build versions via api?
How do I get the api of SonarQube (e.g. code coverage, technical debt, complexity, nloc, ...) of a specific assembly version (e.g. 1.0.0.20)?
My goal is to get this information and display it along with some information related to this version from other sources like bitbucket.
I can only see measurements of the current (latest) assembly version (e.g. 1.0.0.45) using the api/measure/component
api link .
Although, I can see these measures for individual assemblies through the UI with 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
source to share
First of all, SonarQube 5.5 is old, you must first use the latest LTS (5.6) to be able to get feedback.
Project versions can be found using:
- api / events / index (it is replaced with api / project_analyses / search in 6.3) -> it will give you the date of the analysis that the version is on.
And in order to take action from the past, you can use:
- api / timemachine / index (it is replaced by api / measure / search_history in 6.3) -> you should be able to find measures from the version you need.
source to share