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

Why am I getting 401 – Unauthorized response while calling bamboo REST API with valid credentials?

Madhankumar M
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 10, 2024

I need to setup some environment variables and queue the last successful version for deployment using a python script.

I'm doing something like this to get the last deployed versionId:

url = f"{base_url}/rest/api/latest/deploy/environment/{environment_id}/results"
headers = {"Accept": "application/json"}
response = requests.request("GET", url, auth=(username, password), headers=headers)

response = json.loads(response.text)

return response["results"][0]["deploymentVersion"]["id"]
This was working fine until 2 days ago. Suddenly from yesterday, I'm getting a 401 Unauthorized error.
I'm getting this page when I try the same via Insomnia
Screenshot 2024-07-10 at 3.34.40 PM.png
The interesting thing is, I'm able to do all the actions from the UI and using curl with the same credentials. Any idea what I'm missing?

1 answer

0 votes
Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2024

Hello Madhankumar M,

Welcome to Atlassian community

I think probably the authentication is not coming correctly via Insomnia. Just to double check can you try to access this API via Postman and check if you are getting the same error?

Regards,

Shashank Kumar

Madhankumar M
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 14, 2024

Hi @Shashank Kumar

Thanks for the reply. I tried using postman too. Same response.

Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 15, 2024

Hello Madhu,

What errors do you see in <bamboo-home>logs>atlassian-bamboo.log file when you use the REST API from postman, does it print anything different from 401 error?

Regards,

Shashank Kumar

Madhankumar M
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 15, 2024

Hey, I think I got what the issue is.

Sometimes when I login, bamboo asks for a captcha verification. Whenever that happens, I'm getting the 401 error while using the REST API. Once I login to the UI after completing the captcha verification, the API requests are going through.

Is there a way to bypass captcha while accessing the REST API?

Like Steffen Opel _Utoolity_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events