Cancel running build, 404 error from url

I'm trying to use the REST api to cancel a currently running build from a python script, but the buildQueue url always returns a 404 error and I'm not sure what I'm doing wrong to get this.  I can query the build just fine from builds using the id but buildQueue won't work.

urllib2.urlopen(url)

req = urllib2.Request(url=url, data="<buildCancelRequest comment='Comment' readdIntoQueue='true' />", headers={"Content-Type":"application/xml"})

I tried querying the buildQueue for project types and that worked, but it doesn't return the running build, only the queued ones.

url = "http://<teamcity_server>/httpAuth/app/rest/buildQueue?locator=buildType:<build_type>
urllib2.urlopen(url)


I'm new to REST and very confused as to what I could be doing wrong, so any suggestions are welcome, thanks :)

1 comment
Comment actions Permalink
You can get the list of running builds using the following request:
http://localhost:8111/httpAuth/app/rest/builds/?locator=running:true

To stop the running build use:
--request POST "http://localhost:8111/app/rest/builds/id:<buildId>" --data "<buildCancelRequest comment='my comment' readdIntoQueue='false' />" --header "Content-Type: application/xml"
(copied from email)
0

Please sign in to leave a comment.