Child pages
  • REST API

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

This page describes using TeamCity REST API in TeamCity versions 5.x-7.x. For information on REST API in TeamCity versions 8.0 and laterthe latest TeamCity version, refer to the latest TeamCity 910.x or and 2017.1, for other versions see the corresponding documentation version.

...

http://teamcity:8111/httpAuth/app/rest/version - to get the plugin version
http://teamcity:8111/httpAuth/app/rest/projects - to get the list of projects, then follow hrefs
http://teamcity:8111/httpAuth/app/rest/buildTypes/id:bt284/builds?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?buildType=id:bt133&sinceChange=id:24234 - (example ids are used) to get all the changes in the build configuration since the change identified by the id.
http://teamcity:8111/httpAuth/app/rest/users - to get the TeamCity users list

...

If you get an error in response to your request and want to investigate the reason, please look into rest-related server logs.

General Notes

When posting XML, be sure to specify the "Content-Type: application/xml" HTTP header.
Requests that respond with collections (.../projects, .../buildTypes, .../builds, .../changes) serve partial items with only the most important item fields. Use URL constructed with the value of the "href" item attribute to get the full item data.

...

Since TeamCity 8.0: Create (or copy) a project: POST XML <newProjectDescription name='New Project Name' id='newProjectId' copyAllAssociatedSettings='true'><parentProject locator='id:project1'/><sourceProject locator='id:project2'/></newProjectDescription> to http://teamcity:8111/httpAuth/app/rest/projects. See also an example.
TeamCity 7.0-7.1.x: Copy a project: POST XML <newProjectDescription name='Project Name' sourceProjectLocator='id:project2' copyAllAssociatedSettings='true' shareVCSRoots='false'/> to http://teamcity:8111/httpAuth/app/rest/projects

...

Code Block
html
html
For build configuration with internal id "btXXX":
Status of the last build: <img src="http://teamcity:8111/app/rest/builds/buildType:(id:btXXX)/statusIcon"/>
Status of the last build tagged with tag "myTag": <img src="http://teamcity:8111/app/rest/builds/buildType:(id:btXXX),tag:myTag/statusIcon"/>

All other <buildLocator> options are supported.
If the returned image contains "no permission" text, please ensure that one of the following is true:

...

If that does not work, please enable debug logging and investigate the log lines, which are usually descriptive.

...