You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I am not able to create variables for the environments we have in different repositories.
The request we are doing is like the following:
curl --location --request POST 'https://api.bitbucket.org/2.0/repositories/:workspace/:repo_slug/deployments_config/environments/:environment_uuid/variables' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic thisisatest3czo5RGZWR1d5cjZDbYTU0Nw==' \
--data-raw '{
"key": "name",
"value": "test"
}'
environment_uuid is encoded with the '{' and '}', like this: "
it's always returning a 404 error.
The same request, GET, is working as expected returning the list of variables.
Any clue?
Thank you
G'day Carlos!
Welcome to the Bitbucket Cloud Community! :)
Your API request is almost correct, however, you need to also have the "secured" property present as false or true ie:
"key": "name",
"value": "test",
"secured": false
When running the command from my end successfully, my request looked like this (I have used --user instead of header as you can just copy and paste your App Password directly without encoding it):
curl --request POST \
--url https://api.bitbucket.org/2.0/repositories/{workspaceID}/{reposlug}/deployments_config/environments/%7B{Environment_UUID}%7D/variables \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--user Username:AppPassword \
--data '{
"key": "hello",
"value": "test",
"secured": true
}'
Try this and let me know how it goes.
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Carlos,
No worries! Glad to know that this has helped you out :)
Cheers!
- Ben (Bitbucket Cloud Support)
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.