You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi all,
I've tried for probably hours to get the below working but I just can't seem to be able to create an environment variable. The API I'm calling is ...
$ curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <token>" -d '{"key": "mytestkey", "value": "value1", "secured": false }' https://api.bitbucket.org/2.0/repositories/<username>/<repo-slug>/deployments_config/environments/{environment UUID in curly brackets}/variables
The error I get is :
{"error": {"message": "Not found", "detail": "The value provided is not a valid uuid."}}
The environment UUID I use in the URL is what is returned from a GET on
https://api.bitbucket.org/2.0/repositories/<username>/<repo-slug>/environments/
Can anyone see what I'm doing wrong pls (I think I'm following the API docs at : https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/deployments_config/environments/%7Benvironment_uuid%7D/variables ). I'm not sure the API docs are strictly correct on that URL above because I don't know how you can include a UUID in the payload when you're creating a variable.
Many thanks for any help / tips...
Hi @curtisa ,
You will need to encode the characters for the curly brackets in order for this to work.
{ should be replaced with %7B and } with %7D
An example call:
curl -X POST -H "Content-Type: application/json" -u username:app-password
-d '{"key": "mytestkey", "value": "value1", "secured": false }' https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo/deployments_config/environments/%7B26e47eac-2770-4b69-8f23-92634d03a443%7D/variables
where 26e47eac-2770-4b69-8f23-92634d03a443 is the UUID of my Pipelines environment.
Could you please give this a try?
Please feel free to let us know if it works or if you need further assistance.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alex,
That's good to hear, thank you for the update and you are very welcome!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
By calling
https://api.bitbucket.org/2.0/repositories/<username>/<repo-slug>/environments/
and then picking the uuid value of the environment I want to set the variable for, i.e...
"uuid": "{abcdefg-12345-abcd-1234-abc1234567890}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster ! While we’re all excited about the new improvements to Bitbucket ...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.