Getting Maintainability Rating with API

Hello,
I am using sonarcloud (version 10.4) and trying to fetch Maintainability Rating using the fetch endpoint
https://sonarcloud.io/api/measures/component?component=**&metricKeys=sqale_rating

which gives me an output
{
“metric”: “sqale_rating”,
“value”: “1.0”,
“bestValue”: true
}

In documentation it says " The default maintainability rating grid is: A=0-0.05 , B=0.06-0.1 , C=0.11-0.20 , D=0.21-0.5 , E=0.51-1"

As per this in UI dashboard I should see E but I see A for Maintainability Rating on New Code.

How can I get the actual data i.e. if the score is A, B or C…

Hi,

Welcome to the community!

This is the actual data. You’re seeing it the way it’s stored, before it’s interpreted to a letter grade by the front-end code.

 
HTH,
Ann

how to interpret the value then?

Hi,

Through the UI? :smiley:

To be honest, I don’t remember which way the scale goes, whether 1 is E or A. But it should be easy to get yourself oriented by comparing the data coming back from the raw API with what’s showing up in the UI at the moment.

 
HTH,
Ann

1 Like

After further inspection, the value is the position of the rating.
1 => A
2 => B
3 => C
4 => D
5 => E

1 Like