Get historical rating on "new code" via APIs

Hi, I wanted to get the new code rating for a given point in the past, e.g. on code that changed
between 1st and 31st of January 2022, is this possible?

I have tried this api call:

https://sonarcloud.io/api/measures/component?metricKeys=new_reliability_rating&component=myComponentKey&since=2022-01-01T00:00:00+0000

but it is not giving me the expected results, instead it is giving me the rating of the latest ‘new code’ (i.e. the last 30 days as of today as defined in the project settings)

I have also tried to add the following to the call above to explicitly limit the historical definition of ‘new code’ but to no avail &to=2022-01-31T00:00:00+0000

Hi,

We don’t store historical values for new code metrics because once it’s historical… it’s not new anymore. New code metrics really are a Zen, in-the-moment kind of thing.

 
HTH,
Ann

Thanks @ganncamp.

Just to clarify, regardless of how I define ‘new code’ in my projects there is no way for me to get Sonar’s ratings on only code that has changed between two arbitrary dates, right?

Hi,

Correct. You can pull the overall values for two dates, but not on new code.

 
Ann