0

I was using "http://sonarserver:9000/api/resources?metrics=ncloc,bugs,vulnerabilities" to get the details of all the projects for sonar 6.0.

After upgrading to 6.4 this url does not work and I am not able to find the alternative for this under the web_api changes page.

Please let me know if anyone knows about an alternative to this.

Error: {"errors":[{"msg":"Unknown url : /api/resources"}]}

Manas
  • 177
  • 3
  • 13

1 Answers1

1

Per WebAPI documentation (embedded in your own SonarQube server, linked at the footer): api/resources/index is deprecated since 5.4 (i.e. a super long time ago).

The documentation even provides some guidance:

if you need one component with measures: api/measures/component

That will get you the measures you need for a given project. You can use other APIs to get the list of projects (e.g. api/components/search). See Web API docs for the full listing of possibilities.

Nicolas B.
  • 7,245
  • 17
  • 29
  • Yes true....Just tried with http://sonarserver:9000/api/measures/component?componentKey=edi-dep-tool&metricKeys=ncloc,coverage,bugs and it seemed to work for one project but I need metrics of all the projects together – Manas Jul 25 '17 at 13:31
  • @Manas : no can do. It's an API though, just loop through the list of projects (e.g. using _api/components/search_ as I mentioned, with _qualifiers=TRK_ ) and get the measures for each project. – Nicolas B. Jul 25 '17 at 13:36