Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Sonarqube Metrics (i.e. vulnerabilities: A; B; C; D; E) Ratings via the web api

Please assist with the above. I have successfully implemented a web api to sonarqube and I am able to get values for the metrics I specify in the web api (ref: https://gazelle.ihe.net/sonar/web_api/api/measures)

The problem I have is, I want to get the metrics ratings (i.e A; B; C; D) for each metric. and the api only returns the values and not the ratings.

I also tried using component_tree and type by the ratings are not returned.

Please assist:)

like image 907
P. Sithole Avatar asked Sep 18 '25 05:09

P. Sithole


1 Answers

The answer to this question is as follows:

  • The 'vulnerabilities' ratings (A,B,C,D,E) are represented by the metricKey 'security_rating', as vulnerabilities are under Security in sonarqube
  • Web API Request call: sonarqubeurl/api/measures/component?metricKeys=security_rating
  • The 'security_rating' is structured as follows: (1=A,2=B,3=C,4=D,5=E), it returns numbers (corresponding to the alphabets) instead of alphabets.

I hope this helps others as well

like image 185
P. Sithole Avatar answered Sep 19 '25 21:09

P. Sithole