How to update VCS Root property with PUT REST API call?

Per the Teamcity REST API documentation I should be able to update VCS root properties with a PUT command:

PUT http://teamcity:8111/app/rest/vcs-roots/<vcsRootLocator>/properties/<property_name>

I am attempting to update the "branch" property. I am able to read the property via a REST API URL:

GET https://HOST/app/rest/vcs-roots/id:VCS_ROOT_ID/properties/branch

However I cannot figure out how to update it via a PUT call. I tried hitting the above URL with the following JSON body, but it fails with a 400 error:

{ "branch":"user/kkraft/TEST2" }

I also tried using a PUT on the properties URL, which succeeds but ends up overwriting the "branch" and "url" properties with blank values:

PUT https://HOST/app/rest/vcs-roots/id:VCS_ROOT_ID/properties

What is the proper syntax for updating a VCS root property via the REST API?

Thanks.

0
2 comments

Hi,

 

please make sure to use the "text/plain" content type, and just send the text with the content instead of the json object (this is the case for all properties)

1
Avatar
Permanently deleted user

Bingo, that worked! Many thanks for your help.

0

Please sign in to leave a comment.