Is there an endpoint in the API that returns certain metrics for certain projects?

I’m using SonarQube CE 8.9.6 and I need access through the REST API to the coverage, duped lines, bugs, vulnerabilities and tech debt ratio for a set of 22 projects.

I’m getting all the project keys in the server with /api/components/search and then filtering out the ones I don’t need. Then I’m getting the metrics I’m interested in by calling /api/measures/component, with the caveat of making one call per project key.

This approach is slow (each call takes some time) and I was wondering if there was an endpoint that returns the metrics I want for the project keys that I have, all in one call.

If not, is there an endpoint like /api/measures/component_tree that instead of returning a tree of child projects it returns a set of all projects in the instance? Then I could get the whole cake and leave out the projects I’m not interested in.

Thank you


The API we’ve exposed is what we built to populate the UI. That’s why I generally tell people “to master the API, use the UI”. The place in the UI I can think of that lists metrics for multiple projects is the Projects page. A little Developer Tools snooping gets me a /api/measures/search query that might be useful…


Thank you kindly @ganncamp

It worries me that it’s an internal API but it’s exactly what I was looking for :+1:t3:


To be clear, the APIs we truly consider internal (and thus likely to change without notice) are marked internal. The ones exposed by default are considered stable.


I’ll keep an eye on it when we do our next update since that API is marked as Internal.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.