Get builds by type

Answered

Hello folks,

My team is integrating teamcity services with a internal product. By this, we must retrieve all builds from a specific project. But one of our projects inside teamcity is getting painful to do this. Let's me explain.

I've the following project (MY_PROJECT) with a lot of different buildTypes. But when I try to get builds from build types, I can't see any of them, but they are here.

Calling http://teamcity:8111/app/rest/projects/Billing_ClientBuilds, I've:

<buildTypes count="10">
<buildType id="Billing_ClientBuilds_Accent" name="Accent" projectName="AES Projects :: AES CIS :: Billing :: Client Builds" projectId="Billing_ClientBuilds"href="/app/rest/buildTypes/id:Billing_ClientBuilds_Accent" webUrl="http://teamcity/viewType.html?buildTypeId=Billing_ClientBuilds_Accent"/>
 
But when I call http://teamcity:8111/app/rest/builds?locator=buildType:Billing_ClientBuilds_Accent, I got: <builds count="0" href="/app/rest/builds?locator=buildType:Billing_ClientBuilds_Accent"/>, so, that means that I've 0 builds.
 
But, when I call http://teamcity:8111/app/rest/builds/188872, I got a 200 result:
build id="188872" buildTypeId="Billing_ClientBuilds_Accent" number="2016.03.359" status="FAILURE" state="finished" branchName=
"UA" href="/app/rest/builds/id:188872"webUrl="http://teamcity/viewLog.html?buildId=188872&buildTypeId=Billing_ClientBuilds_Accent">
 
So, I can see that build in UI, also I can see that build in the builds service details, but I can't get them in /builds with the buildType locator or project locator.
 
What's happening? Any suggestions?
 
1 comment

Hello Sergio,

If a build configuration uses feature branches, by default only builds from the default branch are returned. To retrieve all builds, add the following locator: branch:default:any. For example:

 http://teamcity:8111/app/rest/builds?locator=buildType:Billing_ClientBuilds_Accent,branch:default:any

For more details see the section.

0

Please sign in to leave a comment.