I am trying to trigger TeamCity build from command line. Firstly, I tried:
curl http://<user name>:<user password>@<server address>/httpAuth/action.html?add2Queue=<build configuration Id>
But in latest versions of TeamCity this approach is removed and response is following:
405 Only POST method is allowed for this request.
So, based on information from https://www.jetbrains.com/help/teamcity/rest-api.html#RESTAPI-BuildRequests it should work via REST API in this way:
url -v -u user:password http://teamcity.server.url:8111/app/rest/buildQueue --request POST --header "Content-Type:application/xml" --data-binary @build.xml
build.xml example:
build.xml
<build>
<buildType id="buildConfID"/>
</build>
For me is not clear where should I place my configured build.xml?
--data-binaryflag takes a filename as relative or absolute path (see here ), therefore as it stands it will be looking for your build.xml file in the root directory. You can also specify an absolute path by doing--data-binary @path/to/fileas per this answer - Dillanm