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

Can't send variables to Pipeline using the API

David Fernandes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 15, 2024

Greetings,

 

I can't send variables to my Pipeline using the API. The Pipeline is successfully triggered but the variables do not show up...here's my cURL:

curl -X POST --url 'https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/pipelines' --header 'Authorization: Bearer <token>' --header 'Content-Type: application/json' -d '{"target":{"type":"pipeline_ref_target","ref_type":"branch","ref_name":"main","variables":[{"key":"MY_VAR","value":"test","secured":false}]}}'

 

Appreciate any help.

1 answer

1 accepted

1 vote
Answer accepted
David Fernandes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 15, 2024

Found the problem, the body of my POST was wrong, here's the correct version:

 

curl -X POST --url 'https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/pipelines' --header 'Authorization: Bearer <token>' --header 'Content-Type: application/json' -d '{"target":{"type":"pipeline_ref_target","ref_type":"branch","ref_name":"main"},"variables":[{"key":"MY_VAR","value":"test"}]}'

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events