I'm receiving 401 when I try run a build plan via API

Rafael Costa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 21, 2022

401 = Unauthorized.

Where/How I set the autorization to user's call?

I'm trying call http://myhost.com:8085/rest/api/latest/queue/{projectKey}-{buildKey} [POST]

1 answer

1 accepted

0 votes
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 21, 2022

Hello @Rafael Costa

Thank you for using Atlassian Community!

Can you share the full response from the API request?

We also advise you to check the following documentation, which contains some examples that can be useful for you:

Sincerely,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Rafael Costa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 21, 2022

@Eduardo Alvarenga the response is:

HTTP Status 401 – Unauthorized

The request has not been applied because it lacks valid authentication credentials for the target resource.

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2022

Hello @Rafael Costa

It appears the user provided on the REST API request has no permission to run that build in Bamboo. Can you queue the same build on the UI using that same user?

Please share the API request command you are using to initiate the build.

Bamboo may also give you some clue about the reason it is being rejected. Please check <bamboo-home>/logs/atlassian-bamboo.log or <bamboo-home>/logs/atlassian-bamboo-access.log.

Regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Rafael Costa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2022

I'm trying create a webhook from Bitbucket to Bamboo. Actually I do it with same user from Jira to Bamboo without problems. But from Bitbucket to Bamboo I'm receiving this error.

err1.png

My main question is: How do I set an webhook from Bitbucket's repository to call a Bamboo plan when a pull request when a Pull Request is approved?

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2022

Hello @Rafael Costa

The Bamboo REST API will only accept Basic authorization or a Personal Access Token. It will not work with OAuth.

We advise you to use the recommended notification method via native integration. When using Application Link integration, Bitbucket will automatically notify Bamboo when any repository changes. You need to have an Application link between Bamboo and Bitbucket set, and the repository type in Bamboo needs to be either Bitbucket Server or Bitbucket Cloud (available on Bamboo 9).

On Bamboo, your Plan must have an enabled "Bitbucket Repository Trigger". Then once the repository changes, Bamboo will be notified and will initiate a change detection task on the repository and in case of changes, trigger a build.

Here's some documentation on how to integrate Bamboo and Bitbucket:

If you wish to use a traditional "Git" repository (not Bitbucket type) in Bamboo you can use either:

Best regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Rafael Costa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2022

Thanks @Eduardo Alvarenga , I did it and worked!!!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events