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

Trigger Pipeline with API Edited

Rich Williams Apr 23, 2019

I've tried a number of different ways to trigger a pipeline through the API following what is specified here:

https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pipelines/?&_ga=2.154998200.105047403.1555964635-881554301.1552490921#post

 

I've tried the following url's in an attempt to access the pipelines:

https://api.bitbucket.org/2.0/repositories/teamname/repo_slug/pipelines

 - with oAuth, APP password, bitbucket login credentials

https://api.bitbucket.org/2.0/repositories/myusername/repo_slug/pipelines

 - with oAuth, APP password, bitbucket login credentials

{
"type": "error",
"error": {
"message": "Resource not found",
"detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/"
}
}

I can get a response when GET ing the main repo endpoint. In this response there is no reference to pipelines endpoint. oAuth and APP passwords all set with full access. oAuth token request responds with:

"scopes": "account:write repository:admin project wiki pipeline:variable team:write repository:delete pullrequest:write issue:write webhook snippet:write",

Any help is appreciated.  

1 answer

1 accepted

1 vote
Answer accepted
Rich Williams Apr 23, 2019 • edited Apr 25, 2019

I'm not totally sure what the issue was but I believe it may have been a case issue in the URL. The repo name in question had some caps in it. When I tried to access using the same case in the URL it definitely does not work. Must use lower case. Probably obvious but this may help someone else out. Interesting to note using mixed case for a repo name on the repositories endpoint works but not for pipelines.

to trigger my pipeline:

curl -X POST -is -u myusername:APPpassword \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/myteamname/alllowercasereponame/pipelines/ \
-d '
{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "environments/staging"
}
}'

App passwords can be generated here:

https://bitbucket.org/account/user/yourusername/app-passwords

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,832 views 1 19
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