Modifying agent requirements value using REST in Teamcity

Answered

Hello,

Is it possible to modify the value of an agent requirement using REST? I'm trying to modify it using the curl command below but I always get a Bad Command failure. I'm using TeamCity 10 

curl -X PUT -d "<properties><property name=\"property-value\" value=\"sample\"/></properties>" https://sample.com/tc/httpAuth/app/rest/buildTypes/<buildType_ID>/agent-requirements/<requirement_id> --header "Content-Type: application/xml" -H "Accept: application/json"

0
1 comment
Avatar
Permanently deleted user

 

Hello!

Please note the rule "The XML/JSON posted is the same as retrieved by GET request" for specifying data parameter.

E.g. to change the agent requirement use the following request:

curl -X PUT https://sample.com/tc/httpAuth/app/rest/buildTypes/<buildType_ID>/agent-requirements/<requirement_id> --header "Content-Type: application/xml" -d '<agent-requirement id="<requirement_id>" type="<requirement_type>"><properties count="<count_N>"><property name="property-name" value="sample_name"/><property name="property-value" value="sample_value"/></properties></agent-requirement>' -H "Accept: application/json"

Please note that this update request will renew the <requirement_id>.

0

Please sign in to leave a comment.