How do I edit an artifact-dependencies object with REST API?

I want to update the pathRules of an existing artifact dependency via the REST API. The following does not work, returning a 405 error.

curl -v --basic --user USER:PASSWORD --request POST "http://teamcity:8111/httpAuth/app/rest/buildTypes/id:bt246/artifact-dependencies/4" --data @d:\post.xml --header "Content-Type: application/xml"

with d:\post.xml containing:

<artifact-dependency id="0" type="artifact_dependency"><properties><property name="cleanDestinationDirectory" value="true" /><property name="pathRules" value="PSTools.%system.zipExt%" /><property name="revisionName" value="sameChainOrLastFinished" /><property name="revisionValue" value="latest.sameChainOrLastFinished" /><property name="source_buildTypeId" value="bt396" /></properties></artifact-dependency>

returns

...
* upload completely sent off: 4 out of 4 bytes
< HTTP/1.1 405 Method Not Allowed
< Server: Apache-Coyote/1.1
< Set-Cookie: JSESSIONID=362ADB3055CB7B80DAF0755C994AC490; Path=/; HttpOnly
< Set-Cookie: RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
< Pragma: no-cache
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Cache-Control: no-cache
< Cache-Control: no-store
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Date: Wed, 07 Nov 2012 15:45:46 GMT
<
Error has occurred during request processing (405).
Error: javax.ws.rs.WebApplicationException
Not supported request. Please check URL, HTTP method and transfered data are correct. metadata: [Allow:[GET,DELETE,OPTIO
NS,HEAD],]* Connection #0 to host teamcity left intact
* Closing connection #0

I see in BuildTypeRequest.java that the POST method for this appears to be add only (at least it's called addArtifactDep). Perhaps I need to delete the old artifact and replace it with a new one? Is there a way to do that in a transaction?

Please sign in to leave a comment.