Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,457,130
Community Members
 
Community Events
176
Community Groups

Cannot add deployment config environment variable

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: "

%7B12fa2ce1-5c4c-4f92-b250-9c557e6096ef%7D"

it's always returning a 404 error.

The same request, GET, is working as expected returning the list of variables.

Any clue?

 

Thank you

 

1 answer

1 accepted

0 votes
Answer accepted
Ben Atlassian Team Jul 17, 2022

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)

Thank you very much for the help. It now works :)

Like Ben likes this
Ben Atlassian Team Jul 19, 2022

Hey Carlos,

No worries! Glad to know that this has helped you out :)

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events