Modify system property using REST

Hi,

 

I'm having difficulty modifying a system property. I'm following this instructions below in the Teamcity document.

 

Build configuration parameters: GET/DELETE/PUT http://teamcity:8111/app/rest/buildTypes/<buildTypeLocator>/parameters/<parameter_name>
   (produces XML, JSON and plain text depending on the "Accept" header, accepts plain text and XML and JSON). The requests .../parameters/<parameter_name>/name and .../parameters/<parameter_name>/value are also supported.

I tried this command below.

curl -u user:password--request PUT http://localhost:81/app/rest/builds/id:<config_id>/parameters/system.foo/bar  --request PUT  --Header Content-Type:text/plain

Since the instruction isn't very clear, I tried several variations of above. None worked.

 

Also this post has the comand that follows the link

 

https://teamcity-support.jetbrains.com/hc/en-us/community/posts/206153409-Changing-parameter-via-api

curl -u user:pass --request PUT http://domain/httpAuth/app/rest/buildTypes/<buildConfiguration_id>/parameters/system.environment --data @param --header "Content-Type: application/xml"

I tried passing following xml as @param. But it is not working also.

 

<properties><property name="system.foo" value="bar"/></properties>
0
1 comment

Hi,

 

You should post the error messages you get. It seems like you edited the post and initially reported a wrong URL. If the issue is with a wrong url, then it's likely you are passing the wrong URL. "system.foo/bar" is probably problematic due to the "/" character, but "system.environment" should work, provided the property exists.

 

Also, when you request or try to put into a specific parameter, the parameter is not a list, so you should drop the "properties" tag and pass only "property" with name and value.

0

Please sign in to leave a comment.