Triggering build using REST API and retrieve it's id


I'm working on application which requires from me to trigger build outside of TeamCity and retrieve build id of this build to be able to track it's process. Is there any possibility to do this by REST API?

I'm currently using API methods from this article . Unfortunately I'm not able to get build id using this methods...

Comment actions Permalink

Hi Wojciech,

Unfortunately, build queuing is not yet part of "proper" REST API ( ) and the intended way to trigger a build in described by the link in the doc you mentioned.

As to retrieving build id in response - that is not that simple as there is no build id at the time of build queuing yet (it appears on the build start on agent).
I can only suggest to trigger a build with custom parameter of unique value and then check when build with the parameter is finished. Specifying custom parameter can have some side-effects, though (e.g. see ).

Comment actions Permalink

Hello, I'm trying to implement what you've suggested but I have some problems with triggering builds with custom parameters, and then find them via REST API.

To trigger new build I'm using this:{buildType}&customParameter={customValue}

after triggering this build how should I ask via REST API to find this specific build status?,buildType:{buildType},customParameter:{customValue}

raises error...

Comment actions Permalink


REST API does not have a documented way to find build by it's properties (not sure where you derived "customParameter:{customValue}" from), so you will need to get the builds finished and check for their properties one by one.
You can also try "undocumented way" : add to the lcoator:

But no guarantee as to how it will work...


Please sign in to leave a comment.