REST reqeust to run build with specific changes

Hello. I'm working on script that will vote for pull request on our Git server depending on the TC build status with changes from that pull request. 

In general it will look like this: user created pull request, Git server sends POST request, that contains, BuildTypeID, pull reqest ID, branch name, commit ID and some other data. The script then should send POST request to TC to start the build with commit from pull request. 

Here is xml example that I send with curl -u user:pass -X POST '' --header "Content-Type: application/xml" --data-binary @my.xml

<build branchName="_BRANCH_NAME_">
  <triggeringOptions cleanSources="false" rebuildAllDependencies="false" queueAtTop="true"/>
  <buildType id="_MY_BUILDTYPE_id" />
    <change id="252a370f64f4b64af02f51cee3282f50704a935b"/>
  <comment><text>Triged by script!</text></comment>
    <property name="env.pull-request-id" value="6682"/>
    <property name="env.git-repo-id" value="cb1e9af8-c651-4fcb-b25c-7cd1ed2c9e50"/>

This POST request run the build, but it does not include changes from my commit, only changes from last commit in default branch.


I undestand that I should send some modificationId, that is internal TC value. I can get modificationId by request like but this works only for commits, that was included in some builds. If I try this on new commit (that was not build on TC yet) it gives me error.

Is there any way to send REST request to TC to start build from specific branch and commit?


1 comment


as of now, TeamCity doesn't allow to select a given revision unless it's already saved on TeamCity, but it does not require a build. Details on our issue in the tracker here:

For this to work, TeamCity needs to have knowledge that the commit exists. That is, it might take a while between the commit reaching the VCS Root and TeamCity learning of its existance, this time will depend on the "Changes checking interval" you have defined for the VCS Root. Once this change is available in TeamCity, even if it's not had any build, you can use the URL you mentioned to pick up the changes ID and then use that to trigger a build.

I hope this helps. If you cannot manage to make it work, feel free to mention what is happening instead.


Please sign in to leave a comment.