2010-09-14 55 views

回答

3

有從TeamCity

看看REST API的所有版本,則可以加載列表:

http://YOURSERVER/httpAuth/app/rest/builds

結果IST是這樣的:

<builds nextHref="/httpAuth/app/rest/builds?count=100&amp;start=100" count="100"> 
    <build id="4324" number="273" status="SUCCESS" buildTypeId="bt9" href="/httpAuth/app/rest/builds/id:4324" webUrl="http://YOURSERVER/viewLog.html?buildId=4324&amp;buildTypeId=bt9"/> 
    <build id="4323" number="283" status="ERROR" buildTypeId="bt10" href="/httpAuth/app/rest/builds/id:4323" webUrl="http://YOURSERVER/viewLog.html?buildId=4323&amp;buildTypeId=bt10"/> 
    <build id="4322" number="56" status="SUCCESS" buildTypeId="bt44" href="/httpAuth/app/rest/builds/id:4322" webUrl="http://YOURSERVER/viewLog.html?buildId=4322&amp;buildTypeId=bt44"/> 
</builds> 

通過看看href,你可以得到這個構建的詳細信息。而且還有一個屬性pinned

計數和構建列表的起始位置可以通過添加GET參數這樣的控制:?count=5&start=200

如果你想爲你必須去特定的項目或項目Configuratins這樣:

有了這個API,你可以檢索所有的項目。 (使用http://YOURSERVER/httpAuth/app/rest/projects

有了這個信息,你可以得到配置。 (例如:http://YOURSERVER/httpAuth/app/rest/projects/id:project3

在這裏您可以獲得有關特定配置的詳細信息: (例如:http://YOURSERVER/httpAuth/app/rest/buildTypes/id:bt17

最後又用這個列表中可以得到這個構建的細節: (例如:http://YOURSERVER/httpAuth/app/rest/builds/id:4144

最後一次通話的結果是這樣的:

<build id="4271" number="151" status="SUCCESS" href="/httpAuth/app/rest/builds/id:4271" webUrl="http://YOURSERVER/viewLog.html?buildId=4271&amp;buildTypeId=bt2" personal="false" history="false" pinned="false"> 
<statusText>Tests passed: 177</statusText> 
<buildType id="bt2" name="trunk Legacy" href="/httpAuth/app/rest/buildTypes/id:bt2" projectName="Common" projectId="project2" webUrl="http://YOURSERVER/viewType.html?buildTypeId=bt2"/> 
<startDate>20100923T082041+0200</startDate> 
<finishDate>20100923T082320+0200</finishDate> 
<agent name="buildagent" id="3" href="/httpAuth/app/rest/agents/id:3"/> 
<tags/> 
<properties> 
    <property name="env.SvnSubDirectory" value="trunk"/> 
</properties> 
<revisions> 
    <revision display-version="9335"> 
     <vcs-root href="/httpAuth/app/rest/vcs-roots/id:1,ver:1" name="Common"/> 
    </revision> 
</revisions> 
<changes href="/httpAuth/app/rest/changes?build=id:4271" count="1"/> 
<relatedIssues/>