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

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.

0 votes

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

Is there a way to GET deployment environment variables using the REST API? I think that was the original question and it's still not answered.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 4 hours ago in Jira Service Desk

Frequently Asked Questions for Jira Service Desk (AKA JSD FAQ)

Just the FAQs! Welcome to the Community, and this Focused-FAQ! Here, we've pulled together some of the most frequently asked questions associated with Jira Service Desk (JSD). We hope ...

22 views 0 4
Read article

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