How do I get Deployment variables via REST API? Edited

Hello,

I want to extract deployment environment variables via the Rest API.

The URL looks like: https://localhost;8085/bamboo/chain/admin/config/configureChainVariables.action?buildKey={build-key}

I don't see any way for getting these values in BAMBOO REST API documentation.

 

Please help!.

 

Thanks,

Sajal

 

2 answers

This widget could not be displayed.

yeah would be nice to have a way to get this... im trying to set deployment variables via the REST API and not finding any method to do it.

This widget could not be displayed.

Hi @Sajal Narayan Shrestha,

You could run the following action:

# replace USERNAME to authenticate against Bamboo's instance
user must have EDIT permission over given plan
# replace FOO with variable key
# replace BAR with variable value
# replace http://localhost:8085 with Bamboo's Base URL
# replace PROJ-PLAN with planKey in which you want to add plan variables

curl -k -u USERNAME \
     -H 'X-Atlassian-Token: no-check' \
     -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
     -d 'variableKey=FOO&variableValue=BAR&bamboo.successReturnMode=json&confirm=true' \
     -X POST 'http://localhost:8085/build/admin/ajax/createPlanVariable.action?planKey=PROJ-PLAN'

For deployment variables, same thing:

# replace USERNAME to authenticate against Bamboo's instance
  user must have EDIT permission over given plan
# replace FOO with variable key
# replace BAR with variable value
# replace http://localhost:8085 with Bamboo's Base URL
# replace PROJ-PLAN with planKey in which you want to add plan variables
# replace ENVIRONMENT_ID with environment id in which you want to add plan variables

curl -k -u USERNAME \
     -H 'X-Atlassian-Token: no-check' \
     -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
     -d 'variableKey=FOO&variableValue=BAR&bamboo.successReturnMode=json&confirm=true' \
     -X POST 'http://localhost:8085/deploy/config/createEnvironmentVariable.action?environmentId=ENVIRONMENT_ID'

Hope the above helps somehow.

Kind regards,

Rafael

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

76 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you