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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,460,770
Community Members
 
Community Events
176
Community Groups

Trigger pipeline with API using token based authentication

Edited

Hi, Is it possible to use OAuth2.0 to trigger a pipeline like this:

 

curl --location --request POST 'https://bitbucket.org/{workspace}/{repo_slug}/pipelines/' \

--header 'Authorization: Bearer XXXXXXX' \

--header 'Content-Type: application/json' \

--data-raw '{

"target": {

"type": "pipeline_ref_target",

"ref_type": "branch",

"ref_name": "master",

"selector": {

"type": "custom",

"pattern": "my-custom-pipeline"

}

}

}'

1 answer

0 votes

Hi @Ikram Karouche and welcome to the community!

It is possible to use OAuth, but you also need to use the API URL in your call. So, instead of

'https://bitbucket.org/{workspace}/{repo_slug}/pipelines/'

you need to use

'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/'

Please feel free to let me know if this works for you or if you experience any issues. If you get any errors, please post the call you are using (make sure to mask any private/sensitive values) and the output of the call, so we can better help you.

Kind regards,
Theodora

Thank you for your response, it works !

but I m not sure if I can receive automatic email notification when the triggered pipeline fails. I can't find this in the documentation.

Hi,

That's good to hear and you are very welcome!

Notifications are sent if you subscribe to them.

  1. Open the repo on Bitbucket Cloud website
  2. Select the Source page
  3. On the top right-hand corner, next to the Clone link, select the 3 dots > Manage notifications
    Screenshot 2022-12-19 at 16.20.55.png
  4. Ensure that the option for Pipelines notifications is checked

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events