Is there a way to retrieve ratings(A,B,C,D,E) displayed in sonarqube dashboard through web api?

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this


What have you tried?


I’m looking for the exact same information.

I’ve found the internal /api/components/search_projects endpoint; the facets part of the response seems to give the data underlying the A,B,C,D,E ratings, but surely there must be a way to get the actual value for a given project?

Hi @npadgen,

Take a look at api/measures/component.


Thanks Ann, that’s exactly the one I was after!

1 Like

Hi @ganncamp,
I ran the query with reliability_rating and bugs metrices against a project, and the json I received is this:
“component”: {
“id”: “AXC17lSq7PFARIY52Mtz”,
“key”: “bsg_cib-app-service”,
“name”: “bsg_cib-app-service”,
“qualifier”: “TRK”,
“measures”: [
“metric”: “reliability_rating”,
“value”: “5.0”,
“bestValue”: false
“metric”: “bugs”,
“value”: “290”,
“bestValue”: false

I was curious to see how the rating could be 5.0 when there are 290 bugs and then I noticed that the reliability_rating is for the “new code” which doesn’t have any bug (I ran two scan successively without any code change) whereas the “bugs” count of 290 is overall. I couldn’t locate a api from where I can get the overall reliability_rating, and not the new_code. Any tips?


Hi @amitbasu,

I believe 5.0 corresponds to E not A. But even if it didn’t, it’s entirely unrelated to the number of open Bugs. The Security and Reliability ratings tie to the severity of the worst open issue.

I don’t understand why you think that. If the metrics related to new code, they would have “new” in the keys.

You’re going to use the same API to get the current values of any of the metrics. It’s just a question of what metric keys you feed in to the request.


A post was split to a new topic: Problem with WebAPI

2 posts were merged into an existing topic: Problem with WebAPI