Search code examples
teamcityteamcity-8.0

Teamcity REST API: How to get agent of last successful build


Is there a way in Teamcity REST API to get the agent name of the last successful build. I am using Teamcity 8.0.6. I tried this

http://<TeamcityServer>/httpAuth/app/rest/buildTypes/id:BuildId/builds?status=SUCCESS

But the result returned doesn't contain Agent name.


Solution

  • The following will give you the last successful build details for a given build type (where BUILDTYPE is the btxxx id):

    http://<TeamcityServer>/httpAuth/app/rest/builds/buildType:(id:BUILDTYPE),status:SUCCESS

    The response contains the agent details in the /build/agent element.