Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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
AUG Leaders

Atlassian Community Events