简体   繁体   中英

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 (ie 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:)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM