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: Always fails with insufficient permissions



I am attempting to use the Bamboo REST API from within Bamboo to check on the state of a previous job. However, I'm unable to get this to work.

According to the documentation for the version we are using (6.9.1), I can use the /result API -

/result/{projectKey}-{buildKey}/{buildNumber : ([0-9]+)|(latest)}

Using the script below, I'm sending a GET request to a URL similar to (where the build number changes each time) -


However, this is failing with a 401 error. The user that is authorising the REST call has admin privileges for the plan in question, so I'm not sure why this would be. I've check also to ensure that the user is active (with 0 of 3 failed captcha attempts).

You do not have sufficient read permissions

I've reviewed the documentation for using the Bamboo REST APIs, and I can see any mention of further Bamboo configuration being required to enable users to use the REST API. I have also attempted the REST call in a browser, and while I was asked to log in, the browser then receives no response at all (the network tab on F12 is empty).

My script

$bambooUrl = "https://my.bamboo.url"

### Get the state of the job that just ran the tests by using the Bamboo REST API.
$jobStateUserPassPair = "$env:bamboo_apiUsername:$env:bamboo_apiPassword"
$jobStateEncodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($jobStateUserPassPair))
$jobStateBasicAuthHeader = @{ "Authorization" = ("Basic {0}" -f $jobStateEncodedCreds) }
$jobStateUri = "{0}/rest/api/latest/result/{1}/{2}?os_authType=basic" -f $bambooUrl, $env:bamboo_buildKey, $env:bamboo_buildNumber
$jobState = Invoke-RestMethod -Method Get -Uri $jobStateUri


0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

973 views 3 8
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