Updating Variables using the Bitbucket API

Posted on

So I was bashing my head against this for a while. I could use all the other API calls, GET to list variables and POST to create them. But although I had all the other parts working, I could not get PUT to work at all!

I couldn’t find ANYTHING in google as a hint. SO I thought I must be doing something stupid, right?

I mean how hard is PUT https://api.bitbucket.org/2.0/repositories/{user}/{slug}/pipelines_config/variables/{uuid}, right?

So I eventually decided to raise a ticket with Atlassian. As I was doing that, I noticed there was a previous question, I clicked it and slapped my forehead.

So, you replace {user} with the username, and the {slug} with the repo name, but you replace {uuid} with the url-encoded version of the uuid LITERALLY enclosed in { and }! Talk about inconsistent!

So I thought I had better post this to help the next poor sod find it quicker on Google.

so {uuid} is surrounded by “{” = %7B and “}” = %7D. ie:

…/pipelines_config/variables/%7B2d6b7c71-d27f-470e-baae-46f8586da70a%7D

Leave a Reply

Your email address will not be published. Required fields are marked *