How to fetch metric details per component (file) with Sonarqube APIs

Viewed 148

I need to get the value of a few metrics for a specific component (a specific java class) for each analysis.

As an example, I need to get something like:

Analysis Component Complexity ncloc
f1234 /mypackage/a.java 10 150
f1235 /mypackage/a.java 10 155

I can get the details of the metric, I guess related to the last analysis.

Here is the API call I am using for the details. As an example, I can get

Does anybody know how to get the same metrics for all the analysis or for a specific analysis? I might get the list of analysis with the api http://sonar63.rd.tut.fi/api/project_analyses/search?project=org:apache:zookeper2&ps=500 but I cannot find a way to pass the analysis id to the measures api.

1 Answers

You should try api/measures/search_history endpoint. You should be able to reach documentation at <sonarqube_instance_url>/web_api/api/measures/search_history.

Related