Dear Community,
I want to configure my Bitbucket Data Center (Atlassian Bitbucket v8.9.12) repository Workflow > Branches configuration via REST API.
Sadly, I could only find the REST API documentation for Bitbucket Cloud here The Bitbucket Cloud REST API (atlassian.com) to configure the branching model.
But it doesn't seem to be available in the Bitbucket Data Center version. Or at least I could not find it in the REST API documentation The Bitbucket Data Center REST API (atlassian.com).
Thanks for a hint.
Best Regards,
Daniel
Hi Daniel and welcome to the Atlassian Community!
I was looking for this a while ago and I found the answer in this comment on a feature request.
There is an endpoint but is not official. It has been working for years though...
PUT <bitbucket-url>/rest/branch-utils/1.0/projects/{projectKey}/repos/{repositorySlug}/branchmodel/configuration
{ "development":{ "refId":"refs/heads/develop", "useDefault":false }, "types":[ { "id":"BUGFIX", "displayName":"Bugfix", "enabled":true, "prefix":"bugfix/" }, { "id":"FEATURE", "displayName":"Feature", "enabled":true, "prefix":"feature/" }, { "id":"HOTFIX", "displayName":"Hotfix", "enabled":false, "prefix":"hotfix/" }, { "id":"RELEASE", "displayName":"Release", "enabled":true, "prefix":"release/" } ] }
Use GET on the same endpoint to view the current branching model of the repo.
I hope this helps!
@Charlie Misonne Thanks for the helpful response. Do you maybe know if the other settings under branches Automatic merging, Automatic branch merging behavior and Branch deletion on merge are also configurable via the API?
Update: Found this for automatic merging [BSERV-4894] Display auto-merge status using REST API. - Create and track feature requests for Atlassian products. -> Solved
Still looking for branch-deletion-on-merge but should work via the same endpoint I guess --> But what's the key which must be used?
/rest/branch-utils/1.0/projects/{PROJECT_KEY}/repos/{REPO_SLUG}/<whats the key here?>/enabled
UPDATE 2: Found it here Bitbucket REST API to set 'Branch deletion on merge' - DevOps Stack Exchange
It's /rest/branch-utils/latest/projects/{project_key}/delete-after-merge and to set it to ON sent a POST request with {"enabled": true}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
You got everything you needed now? :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.