Asmoran
Asmoran

Reputation: 45

TeamCity API - How do I change the 'spec' of a parameter

I have a parameter on my build which is set up as a "Prompt"/"Select" type, so that the user is prompted with a dropdown list of possible values when they force a build.

I need to be able to programatically modify the options in the dropdown. The API lets me change the value easily enough, but I cannot figure out how to change the options in the "spec".

Has anyone figured this out? Perhaps it's not supported in the API?

Upvotes: 2

Views: 581

Answers (1)

Asmoran
Asmoran

Reputation: 45

I found it:

1) Use the API to GET the XML for your parameter http://[TeamCityServer]/httpAuth/app/rest/buildTypes/[Selector]/parameters/[Parameter]

2) Modify the XML to add/remove the options (or otherwise change the spec)

3) POST the modified XML to the parameters endpoint with Content-Type: application/xml http://[TeamCityServer]/httpAuth/app/rest/buildTypes/[Selector]/parameters

Upvotes: 2

Related Questions