Exposes TeamCity API via REST.
If your server is accessible via
http://teamcity:8111/ URL, use:
http://teamcity:8111/httpAuth/app/rest/application.wadl - to the get list of supported requests and names of parameters. Provide valid TeamCity username and password with the request as BASIC HTTP authentication.
http://teamcity:8111/httpAuth/app/rest/version - to get plugin version
http://teamcity:8111/httpAuth/app/rest/projects - to get projects list, then follow href's
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 build configuration since the change identified by id.
As a rule, single value responses are "text/plain" and complex value responses support both "application/xml" and "application/json". Supply appropriate "Accept" header in the request to get necessary response type.
If you get error in response to your request and want to investigate the reason, enable debug logging in the server logs for "jetbrains.buildServer.server.rest" category and then see
Feel free to ask questions and provide feedback in our plugins forum.
In a number of places, a string might be specified that defines what builds to filter/affect (referred to as "<buildLocator>"). This is called "build locator" in the scope of REST API.
Examples of supported locators:
id:<internal build id>- use it when you need to specify a specific build
number:<build number>- to find build by build number, provided build configuration is already specified
<dimension1>:<value1>,<dimension2>:<value2>- to find builds by multiple criteria
The list of supported build dimensions:
buildType:(<buildTypeLocator>) - only the builds of the specified build configuration
tags:<tags> - ","(comma) -delimited list of build tags (only builds containing all the specified tags are returned)
status:<SUCCESS/FAILURE/ERROR> - list the builds with the specified status only
user:(<userLocator>) - limit the builds to only those triggered by user specified
personal:<true/false/any> - limit the builds by personal flag.
canceled:<true/false/any> - limit the builds by canceled flag.
running:<true/false/any> - limit the builds by running flag.
pinned:<true/false/any> - limit the builds by pinned flag.
agentName:<name> - agent name to return only builds ran on the agent with name specified
sinceBuild:(<buildLocator>) - limit the list of builds only to those after the one specified
sinceDate:<date> - limit the list of builds only to those started after the date specified. The date should in the same format as dates returned by REST API.
count:<number> - serve only the specified number of builds
start:<number> - list the builds fromt he list starting from the position specified (zero-based)
If the value is to contain "," symbol, it should be enclosed into parentheses: "(<value>)".
Get tags: GET
Replace tags: PUT
http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/tags/ (should put the same XML of JSON as returned by GET)
Add tags: POST
http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/tags/ (should post the same XML of JSON as returned by GET or just a plain-text tag name)
Get current pin status: GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/pin/ (returns "true" or "false" text)
Pin: PUT http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/pin/ (the text in the request data is added as a comment for the action)
Unpin: DELETE http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/pin/ (the text in the request data is added as a comment for the action)
Get build statistics value: GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/statistics/
Projects and Build Configuration Lists
List of projects: GET
Project details: GET
<projectLocator> can be
List of Build Configurations: GET
List of Build Configurations of a project: GET
Build Configuration details: GET
<buildTypeLocator> can be
If you add "rest.use.authToken=true" internal property, any user can perform superuser operation if authToken is passed in URL parameter. The authToken will be logged into
logs/teamcity-rest.log log. You will still need to supply valid user credentials to use this approach.
Start backup: POST
http://teamcity:8111/httpAuth/app/rest/server/backup?includeConfigs=true&includeDatabase=true&includeBuildLogs=true&fileName=<fileName> where <fileName> in the prefix of the file to save backup to
Get current backup status (idle/running): GET
If you need to extend the plugin with your functionality, you can base your plugin on the current REST API plugin code, but ensure that your plugin does not interfere with the bundled REST plugin. To achieve this, change
teamcity-plugin.xml file to have different plugin name and different value for "api.path" parameter. Once this is done, your patched plugin and original REST api plugin can work in the single TeamCity installation.
TeamCity Versions Compatibility
TeamCity 5.0 and above.