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

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

Adding variables to REST API using curl

I have created a small script to trigger a pipeline using the test API 

I am trying to run this script with the ref_name and pattern as arguments to the script master deploy 


curl -X POST -is -u $BB_USER:$BB_PASS \
-H 'Content-Type: application/json' \ \
-d '
"target": {
"type": "pipeline_ref_target",
"ref_type": "branch",
"ref_name": "$1",
"selector": {
"type": "custom",
"pattern": "$2"

Tried few ways to take the arguments into the script but I get an error as below 

{"error": {"message": "Not found", "detail": "Could not find last reference for branch $1", "data": {"key": "result-service.pipeline.reference-not-found", "arguments": {"uuid": "$1"}}}}

I want to add this as a part of pipeline 

thanks a lot for your help in advance 

1 answer

0 votes

Hello @Roopesh ,

In your case, you can use pipe trigger-pipeline.

Just add the following snippet to the script section of your bitbucket-pipelines.yml file:

  - pipe: atlassian/trigger-pipeline:3.1.0
      REPOSITORY: 'your-awesome-repo'
      BRANCH_NAME: 'master'
      CUSTOM_PIPELINE_NAME: 'deployment-pipeline'

More available pipes you can discover here.


cool , thank you Alex 

I'm trying to get this to work. I have a question regarding the `BITBUCKET_APP_PASSWORD`. Am I supposed to actually have the line


Or am should I replace  `$BITBUCKET_APP_PASSWORD` with the app password I created?

With the app password explicitly in the yml file it works, the way you posted it it doesn't.

BITBUCKET_APP_PASSWORD:- null value not allowed

I'm not sure it's a good idea to have the app password in the file explicitly.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

405 views 13 14
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