Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Bamboo REST API to create branches

Maybe I missed it, but is there a Bamboo API to create branches? There seems to be ones to GET branches, but I'd like to create new branches. The Bamboo polling mechanism works, but polling is much slower than a push mechanism.

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted

Hello Arthur,

I believe there is an undocumented API for creating arbitrary branch-plan since Bamboo 5.0. Usage gist:

curl -X PUT --user admin:admin http://localhost:8085/rest/api/latest/plan/PROJ-PLAN/branch/yourNewBranchName?vcsBranch="/refs/heads/myBranch"

(the "yourNewBranchName" is the name of the plan-branch visible in Bamboo UI, and the "vcsBranch" parameter defines which branch should be used when polling your source code repository)

Does this help you?


That's exactly what I wanted, thank you!

Now I'm wondering, is there a way to modify the task that branches run vs master? For example, we use Maven and our master build does a mvn clean deploy, whereas the branch I'd like to do a mvn clean verify (not deploy). Perhaps this is worth a separate question.

@Nicholas: I believe both answers are "no".

Do you have access to the Bamboo sources?

This is perfect. Is this documented anywhere? Can you modify the description as part of the same request? I've tried


Are any of the other parameters that can be modified in the branch editor GUI modifiable via the REST API?

Or does this all require Bamboo source access?

(Does every on-site Bamboo license holder have source access? If so, I gotta make some calls around the office... )

We're a Bamboo OnDemand customer.

I tried to use the undocumented API (using the exact curl statement shown in the example) but got a "411 - Length required" response. Any workarounds for this? It would be great to be able to automate branch creation in our Bamboo plans.


[edit] Answering my own question:

Sounds like it is specific to nginx (which is what Atlassian uses for gw to OnDemand), see

Workaround is to add -H "Content-Length: 0" to your curl command. I did this and it worked great!

I know I'm late to the party in asking this, but is there a way to use this REST API to enable the branch plan and set its trigger type to manual?

I can use the shared REST API syntax to create a branch plan, but I'd like to also make sure I can enable the plan and change its trigger type to manual with this same call, if possible. Some background on this: I have dozens and dozens of develop branches that I have to manually create plan branches for, which are set up with a manual trigger type to work with Bob Swift automation. I'd like to automate creating all those release branch plans.

did you manage to find a solution for this?

Was away so have not responded.

Yes, I have the vcsBranch option in the REST call.

My problem turned out to be a BASH scripting error - Since I was using Basic authentication, my url looked like

curl --verbose -X PUT --user xxx:pwd http://host:8085/rest/api/latest/plan/E2P-SB/branch/release-1.1?os_authType=basic&vcsBranch=/refs/heads/release/1.1

And the &vcsBranch was being treated as a background job. It needed to be escaped with a "\"

So now I am one step closer, now I get Bamboo complaining that the branch can not be found:

Eriks Test Project - Sandbox - Branch - release-1.1 › E2P-SB1-1 : Errors getting changes for E2P-SB1-1
(com.atlassian.bamboo.repository.RepositoryException : java.lang.RuntimeException: com.atlassian.bamboo.repository.InvalidRepositoryException: Cannot determine head revision of 'ssh://' on branch '/refs/heads/release/1.1'. Branch has probably been removed.)
(17 Jun 2014, 4:42:40 PM)

In the branch's Source Repository tab, the branch name was listed as /refs/heads/release/1.1.

I then checked out Branch plans that were automatically created and saw that their branches names were simply "release/1.1"

So, in summary, for GIT, the correct value for the vcsBranch parameter should not include /ref/heads, but the simple branch name.

I would have saved a lot of time, if the REST documentation was fleshed out.

When I try this with a GIT repo, it does create a new branch plan but it does not overide the repository setting so it does not use the branch for the build.

There is "some" documentation for the 5.5 API -- but it does not say much.

Any one really doing this who can share their techniques?

Hi Erik,

Just to be sure we're standing on the same ground: have you used the vcsBranch parameter in your REST calls? I mean the


part in your PUT request?

For SVN, I just use ?vcsBranch=myBranch It might be similar for GIT. If I put quotes or /branches/ then my URL is messed up for my branch. The plan is already setup to look for branches in .../branches as opposed to .../trunk so it only needs the part after .../branches/

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

Community showcase
Published in Jira Work Management

Join us for a live demo of Jira Work Management

Interested in learning more about Jira Work Management? Have questions you want to get answered? Join us for our upcoming live demo where we’ll take you through the essentials of Jira Work Manageme...

106 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you