API for project administrative values

For a project, in Administration > Branches & Pull Requests, a REGEX can be defined for the “Long living branches pattern”.

Is there an API call I can use to view and edit this value based on the project’s KEY value? I’ve been looking through the webapi but haven’t been able to find something like this.

Hello
You may use api/settings/set and api/settings/values e.g.:

c:\>curl -u <user>:<pass> http://localhost:9000/api/settings/values?keys=sonar.branch.longLivedBranches.regex
{"settings":[{"key":"sonar.branch.longLivedBranches.regex","value":"(branch|releasee)-.*","parentValue":"(branch|release)-.*"}]}

but note that this is a global setting. If you have different patterns for different projects you may include them in the global regex.

Also note, that the Branch Management was simplified starting from SonarQube 8.1 and the there is no longer distinction between Short-Lived and Long-Lived branches:

Best,
Michal

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.