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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. I was pulling my hair out for this.
I truly believe this is the worst API I've used, all categories.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Strong
Based on the docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines_config/variables/%7Bvariable_uuid%7D,
you may need to include `uuid` and `secured` in the request body.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Lenin Raj
Thanks for your reply
Unfortunately it doesn't work and I get the same error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.