Issues with extracting metrics for individual project from SonarQube

Hi Guys,

  • I am using SonarQube version 7.1 and trying to extract the metrics and quality gate related to individual projects
  • I was using Python SonarQube API to extract these data before our company upgraded to version 7.1.
    api/resources web service Deprecated since sonarqube5.4, so we cannot use it anymore.
  • I have also tried using getting data using CURL command via Web API and using this URL https:/MYHOST/api/metrics/search?resource=Value&metrics=Value, but I keep getting the whole list of possible values for metrics instead of values of metrics for the particular project.

I am new to this, so maybe I am not using the URL the way it should be. I’d appreciate any help in this regard.
If you guys have a better/smarter way to extract those metrics, please share with us.

Hi,

The difference between metrics and measures is a little confusing, and I don’t think we’ve documented the difference anywhere.

A metric is something you can take measurements of. Real life examples are temperature and weight

A measure is the value of a metric at a point in time. E.G. the current temperature, versus the temperature at this time yesterday.

That’s why when you search metrics, you just get a list of things that can be measured. Try the measures service instead: https://sonarcloud.io/web_api/api/measures/component

Ann

1 Like

Thanks a lot Ann, I can access the “measures” now :slight_smile: