Update SonarCloud project new code definition through API

Is it possible to update SonarCloud project new code definition through API? Since we have about 1000 projects, it is a lot of work to make this updates manually.

Hey there.

POST api/settings/set can be used to manipulate the sonar.leak.period setting.

I’m curious to know what the situations are where you need to update the New Code Period for all projects.

Hello Colin,

Thank you your answer.
We create Sonar Projects through API and we need New Code because we have set conditions in the Quality Gate for New Code. We have a large number of projects and we want to update all the existing projects by a script.
I have tried to update new code with this but is not working
Web API (sonarqube.com)

The set settings API probably needs to call this API twice, once to set the leak period and then again to set the leak type. It may require using x-form-url-encoded as well.