...
http://teamcity:8111/httpAuth/app/rest/projects
gets you the list of projectshttp://teamcity:8111/httpAuth/app/rest/projects/<projectsLocator>
- http://teamcity:8111/httpAuth/app/rest/projects/id:RESTAPIPlugin
(the example id is used) gets you the full data for the REST API Plugin project.
http://teamcity:8111/httpAuth/app/rest/buildTypes/id:bt284/builds?locator=<buildLocator> - http://teamcity:8111/httpAuth/app/rest/buildTypes/id:bt284/builds?locator=status:SUCCESS,tag:EAP
- (example ids are used) to get builds
http://teamcity:8111/httpAuth/app/rest/builds/?locator=<buildLocator>
- to get builds by build locator.
http://teamcity:8111/httpAuth/app/rest/changes?locator=<changeLocator> - http://teamcity:8111/httpAuth/app/rest/changes?locator=buildType:(id:bt133),sinceChange:(id:24234)
- to get all the changes in the build configuration since the change identified by the id.
Supported HTTP Methods
- GET: retrieves the requested data
- POST: creates the entity in the request adding it to the existing collection. When posting XML, be sure to specify the "
Content-Type: application/xml
" HTTP header. - PUT: based on the existence of the entity, creates or updates the entity in the request
- DELETE: removes the requested data
...
Build on a specified change, forced rebuild of all dependencies and clean sources before the build, moved to the build queue top on triggering. (Please note Note that the change is set via the change's internal modification id, not revision. The id can be seen in the change node listed by the REST API or in the URL of the change detail; see more below):
Code Block | ||||
---|---|---|---|---|
| ||||
<build> <triggeringOptions cleanSources="true" rebuildAllDependencies="true" queueAtTop="true"/> <buildType id="buildConfID"/> <lastChanges> <change id="modificationId"/> </lastChanges> </build> |
...
Downloading build logs via a REST request is not supported, but there is a way to download the log files described here.
Changes
Filter all changes by a locator: GET http://teamcity:8111/app/rest/changes?locator=<changeLocator>
Supported locators: id, project, buildType, build, vcsRoot, vcsRootInstance, username, user, version, internalVersion, comment, file, sinceChange, single value, start, count, lookupLimit
Please note that the change id is the change's internal modification id, not the revision. The id can be seen in the
change
node listed by the REST API or in the URL of the change details (as modId).
Get all changes for a project: GET http://teamcity:8111/app/rest/changes?locator=project:projectId
Get all the changes in a build configuration since a particular change identified by its id: http://teamcity:8111/httpAuth/app/rest/changes?locator=buildType:(id:buildConfigurationId),sinceChange:(id:changeId)
Get details of an individual change: GET http://teamcity:8111/app/rest/changes/id:changeId
The files
node lists changed files. SinceTeamCity 10.0, the information about the changed file action is reported via the changeType
attribute for the files listed as one of the following: added, edited, removed, copied
or unchanged.
Tests
List tests:
GET http://teamcity:8111/app/rest/testOccurrences?locator=<locator dimension>:<value>
Supported locators:
...
Wiki Markup |
---|
{hidden-data} Example C# code shared by our users to do REST API calls with NTLM authentication and cookies reuse: {noformat} using System; using System.IO; using System.Net; namespace TestingSingleSignOnAuthREST { class Program { static void Main(string[] args) { Console.WriteLine(GetRestResponse("http://teamcity.jetbrains.com", "/app/rest/server")); Console.ReadLine(); } public static string GetRestResponse(string server, string requestStr) { var cookies = new CookieContainer(); var request = (HttpWebRequest)WebRequest.Create(server + requestStr); request.Timeout = (int)TimeSpan.FromDays(1).TotalMilliseconds; request.ContentType = "application/xml"; request.UseDefaultCredentials = true; request.PreAuthenticate = true; request.CookieContainer = cookies; var resp = request.GetResponse() as HttpWebResponse; var reader = new StreamReader(resp.GetResponseStream(), ); return reader.ReadToEnd(); } } } {noformat} {hidden-data} |
curl
Expand | ||
---|---|---|
| ||
Get the list of changes for a project: |