What is the metric value for security ratings (measure) in SonarQube

I’m using SonarQube community edition version 8.9.9 (hosted on AWS EC2). I have projects on GitLab repo and have configured its CI/CD pipeline to generate the code quality report using the web API calls by using python-sonarqube-api (GitHub - shijl0925/python-sonarqube-api: Python wrapper for the SonarQube (Community Edition and Enterprise Edition) and SonarCloud API.).
Now, the problem is when I make call this POST method

get_component_with_specified_measures(component="my_project",
                                                                 branch="develop",
                                                                 fields="metrics,periods",
                                                                 metricKeys="code_smells,bugs,vulnerabilities")

(refer api/measures — SonarQube Client with Python 1.3.5 documentation) , in response, I just get the metric (security_ratings) as a float value like 1.0. Whereas, I was expecting the response like A, B, etc.

Q1) Do we have anything out of box method, where I can get the security ratings like A,B, etc instead of float values?
Q2) If not then may I know if there any documentation link (as I did not find anything official) or can provide me the remaining float values for B,C, etc so that I can do mapping at my end.

Would really appreciate a resolution on this.

Cheers

Hi,

Welcome to the community!

I believe the UI is mapping the floats to letters. The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.

You may also find this guide helpful.

 
HTH,
Ann