# How to get portfolio ratings using the API?

**URL:** <https://community.sonarsource.com/t/how-to-get-portfolio-ratings-using-the-api/78146>\
**Category:** SonarQube Server / Community Build\
**Created:** [November 30, 2022, 11:34am UTC](https://community.sonarsource.com/t/how-to-get-portfolio-ratings-using-the-api/78146 "2022-11-30T11:34:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgarcia](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dgarcia](https://community.sonarsource.com/u/dgarcia)\
**Post date:** [November 30, 2022, 11:34am UTC](https://community.sonarsource.com/t/how-to-get-portfolio-ratings-using-the-api/78146/1 "2022-11-30T11:34:08Z")

</div>

I’m trying to get the portfolio ratings that I see in the web, but using the API. I’m using the following call:

[https://sonarqube.cloud-dev.wolterskluwer.eu/api/measures/component?component=HCM&metricKeys=releasability\_rating,reliability\_rating,security\_rating,security\_review\_rating,sqale\_rating](https://sonarqube.cloud-dev.wolterskluwer.eu/api/measures/component?component=HCM&metricKeys=releasability_rating,reliability_rating,security_rating,security_review_rating,sqale_rating)

The results in the web and in the API are these ones:

Releasability Reliability Vulnerabilities Review Maintainability\*\*  
B A A A A WEB  
2.0 3.0 2.0 4.0 1.0 API

Assuming that 1 = A and 5 = E, the mapped letters are different except in releasability, that seems to match for this and other portfolios. For the maintainability rating, can you tell me if the values goes from 1 to 5 as the rest, or from 0 to 1 as I read in the documentation? Why don’t match the reliability, vulnerabilities and review ratings for the portfolios?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![dgarcia](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dgarcia](https://community.sonarsource.com/u/dgarcia)\
**Post date:** [November 30, 2022, 3:21pm UTC](https://community.sonarsource.com/t/how-to-get-portfolio-ratings-using-the-api/78146/2 "2022-11-30T15:21:21Z")

</div>

Hello, checking the data of the portfolios in the web, there are shown the ratings for new code first and for overall code second. The ratings that the API returns in the call I do are the overall code ones. How could I get the new code ratings with the API, too?
