Create
cancel
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

Updating a pipeline variable using REST API 2.0

Hi,

I'm trying to update a pipeline variable using Cloud REST API request:

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

So my query is

curl -X PUT -u log:pass https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid} -H 'Content-Type: application/json' -d '{ "key": "%NAME%", "value": "%NEW VALUE%"}'

And the response is

"error": {"message": "Bad request", "detail": "Unexpected response body", "data": {"key": "unexpected.response.body", "arguments": {}}}}

Even when I'm trying to use GET in order to retrieve a repository level variable, I still get the same error

2 answers

I was facing the same error and noticed that sending the uuid including the curly brackets in the URL make it work.

Curly brackets must be encoded '{' = %7B  '}' = %7D

Fails: /aaaa-bbbb-cccc-dddd

Fails: /{aaaa-bbbb-cccc-dddd}

Works: /%7Baaaa-bbbb-cccc%7D  

 

curl -X PUT -u log:pass https://api.bitbucket.org/2.0/repositories/my_workspace/repo_slug/pipelines_config/variables/%7Bvariable_uuid%7D  -H 'Content-Type: application/json' -d '{ "value": "%NEW VALUE%"}'

@Fredys Romero  You, Sir, my hero for today!

This last bit (url-encoding the curly braces) was the missing part for me to make it work. 

Shame on you Atlassian for such a poor documentation which results on such a poor developer experience.

Thanks. I was pulling my hair out for this.

I truly believe this is the worst API I've used, all categories. 

Hi @Lenin Raj Rajasekaran
Thanks for your reply
Unfortunately it doesn't work and I get the same error

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,734 views 10 16
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