Hello DevOps Evangelists!
First of all, thanks to this answer, I was able to successfully cancel single TeamCity build using following curl:
curl http://teamcity:8111/app/rest/buildQueue/buildType:<buildId> \
-X POST -u *** \
-H 'Content-Type: application/json' -d '{
"buildCancelRequest": {
"comment": "This build was cancelled.",
"readdIntoQueue": "false"
}
}'
However, my idea was to cancel multiple builds within the particular project via TeamCity REST API. I have tried the following:
curl http://teamcity:8111/app/rest/buildQueue/project:<projectId>,count:<n> \
-X POST -u *** \
-H 'Content-Type: application/json' -d '{
"buildCancelRequest": {
"comment": "Only one build was cancelled.",
"readdIntoQueue": "false"
}
}'
Unfortunately, I have failed miserably, because only single build from this project was cancelled. I know I can send this request as many times as there are builds in the project, but this ugly workaround! I want to do it right! Could some tell me please how to cancel all the builds within the project by using TeamCity REST API?