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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket API v2 - How to enabled pipelines via api?

Hi all,

 

I'm trying to automate my bitbucket repo creation via a bash script and am stuck on the following endpoint

/2.0/repositories/{workspace}/{repo_slug}/pipelines_config

 

I'm trying the following:

curl -X PUT -v -u "$BITBUCKET_AUTH_EMAIL":"$BITBUCKET_AUTH_PASS" -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/$BITBUCKET_USER/$REPO_SLUG/pipelines_config -d \
'{
"enabled": true
}'

 

which I thought would be the same as going 'Repository Settings > Pipeline > Settings > Enable Pipeline'



but this returns :

{"type": "error", "error": {"message": "Resource not found"}}

 

I've also tried a few variations:

curl -X PUT -v -u "$BITBUCKET_AUTH_EMAIL":"$BITBUCKET_AUTH_PASS" -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/$BITBUCKET_USER/$REPO_SLUG/pipelines_config -d \
'{
"enabled": true
}'
curl -X PUT -v -u "$BITBUCKET_AUTH_EMAIL":"$BITBUCKET_AUTH_PASS" -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/$BITBUCKET_USER/$REPO_SLUG/pipelines_config -d \
'{
"enabled": true,
"type": "repository_pipelines_configuration"
}'

 

but these also return the above result.

 

Other than that i've been able to setup pipeline vars & pipeline key pair without any issues so any help pointing me in the right direction would be appreciated.

2 answers

1 accepted

1 vote
Answer accepted

After contacting support the issue was resolved by using the users Bitbucket username instead of 

BITBUCKET_AUTH_EMAIL

in the authentication.

Can confirm to reproduce if my app-password has all the needed rights.

If not, I get an error message back telling me which rights are missing. However if I try to change that (e.g. wrong repository slug), the error message stays the same, only for credentials.

The missing resource error is only shown if credentials are fine. I have no idea why it does not work. Also tried with GET first.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Bitbucket Smart Commits vs. Genius Commits - What's the difference?

If you already heard about Smart Commits in Bitbucket, know that you just stumbled upon something even better (and smarter!): Genius Commits by Better DevOps Automation for Jira Data Center (+ Server...

130 views 0 2
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