Changing parameter via api

I'm mostly using this discussion for directions.

https://devnet.jetbrains.com/message/5522130#5522130

But I cannot get it to work for me.

I pull down this xml using

curl -v -k  -H "Content-Type: application/xml" -u admin:admin https://domain/app/rest/buildTypes/id:ClearingRedisCach_ClearRedisCach/parameters/system.environment > prop.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><property name="system.environment" value="" own="true"><type rawValue="select data_2='xxx' data_1='yyy' display='prompt' data_3='zzz'"/></property>

OK, Everything tells me to put that back to make modifications.

curl -v -k -X PUT -d @prop.xml -H "Content-Type: application/xml" -u admin:admin https://domain/app/rest/buildTypes/id:ClearingRedisCach_ClearRedisCach/parameters/

But I keep getting these results.

Error has occurred during request processing (Bad Request).
Error: java.lang.IllegalArgumentException: argument type mismatch
* Closing connection #0
Most probably the URL requires submitting different data type. Please check the request URL and data are correct

3 comments

Hi Kevin,

If you get a specific parameter, you should put back the xml for the same parameter. For example:

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


Or you can get the list of all parameters:

GET http://domain/httpAuth/app/rest/buildTypes/<buildConfiguration_id>/parameters

modify resulted xml and put it back using the same url.

0

OK,

So I've tried your put request.

curl -k -u admin:admin --request PUT https://domain.com/httpAuth/app/rest/buildTypes/id:ClearingRedisCach_ClearRedisCach/parameters/system.environment --data @prop.xml --header "Content-Type: application/xml"

contents of prop.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><property name="system.environment" value="" own="true"><type rawValue="select data_2='xxx' data_1='yyy' display='prompt' data_3='zzz'"/></property>

Still getting

Error has occurred during request processing (Unsupported Media Type).

0

I tried the request and prop.xml you posted and it works for me.
What TeamCity version do you use?
Could you please enable debug-rest logging preset on Administration > Diagnostics page in TeamCity, send the same request and attach teamcity-rest.log and also your prop.xml file?

0

Please sign in to leave a comment.