Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Bitbucket API 2.0 - create deploy variables not working Edited

oauth_resp=$(curl -X POST -u "mykey:mysecret" -d grant_type=client_credentials)

curl "{4d857618-d89d-4c4d-92a5-af70e46e4e9f}/variables" \ --request GET \ --header "Content-Type:application/json" \ --header "Authorization: Bearer $oauth_token"

UUID for the environment was got through a different GET so it's correct afaik.

response is

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

What I actually want to do is post deployment environment variables but that doesn't work either.

Status: 404 Headers: {'Server': 'nginx', 'Cache-Control': 'max-age=900', 'Content-Type': 'application/json; charset=utf-8', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload', 'Date': 'Sun, 08 Mar 2020 19:30:35 GMT', 'X-Served-By': 'app-1129', 'X-Static-Version': 'a856747ae2e5', 'ETag': '"d8570ff7a4314593e35e9bc69e81400a"', 'X-Render-Time': '0.0081090927124', 'Connection': 'Keep-Alive', 'X-Version': 'a856747ae2e5', 'X-Request-Count': '2694', 'X-Frame-Options': 'SAMEORIGIN', 'X-Cache-Info': 'caching', 'Content-Length': '52'} Error Response: b'{"type": "error", "error": {"message": "workspace"}}


API 2.0 seems to work fine for the more common get/post but fails on the less common requests. I say "less common" because the documentation is rubbish on deploy and repository variables and so I assume that no one wants to automate those things


4 answers

1 vote
Deleted user Mar 16, 2020

Ok. I answer myself.


My mistakes were two

  1. Put the url between quotes.
  2. Espace the curly brackets.


So, let's say your UUID is "{127cf9ca-920b-4a1f-a44d-36be6c330316}". So the request should be:

curl -u user:password "{workspace}/{repo_slug}/pipelines_config/variables/\{127cf9ca-920b-4a1f-a44d-36be6c330316\}"


Thanks for your hints.

0 votes
mkleint Atlassian Team Mar 10, 2020

there must be something related to your curl that's causing the problem. I've tried the API with my postman setup and got back a 200 for my repository. It all looks ok to me on the surface though. Maybe some kind of escaping issue in bash?Screen Shot 2020-03-11 at 3.13.28 pm.png

@mkleintthanks for looking at this - apparently it's the curly brackets that are causing the issue. That and the poor API documentation ;)

0 votes
Deleted user Mar 16, 2020

Hello @Rupert Broad and @mkleint 


I am in a very similar situation with pipeline_config/variables


I am able to get all variables with:

curl -u user:password{workspace}/{repo_slug}/pipelines_config/variables/


But if I get the UUID from the response of the first command and try to get the data of a specific variable, it does not work:

curl -u user:password{workspace}/{repo_slug}/pipelines_config/variables/{UUID}


Very probably it is a problem with curly brackets, as @Rupert Broad  mentioned. But I don't understand what is the problem exactly.


Could you describe better your solution?


Thank you in advance.

Deleted user Mar 16, 2020

Ps: I get the same error message.

The other alternative that worked for me was to use the html codes for { and } which are %7B and %7D




(this is python so the curly brackets you see are part of the variable subsitution

Deleted user Mar 17, 2020

Thanks for the info.

Suggest an answer

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

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

528 views 6 4
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