httpAuthOn this page:
Table of Contents | ||
---|---|---|
|
...
This documentation is not meant to be comprehensive, but just provide some initial knowledge useful for using the API.
You can start by opening http://teamcity:8111/httpAuth/app/rest
URL in your browser: this page will give you several pointers to explorer the API.
Use http://teamcity:8111/httpAuth/app/rest/application.wadl
to get the full list of supported requests and names of parameters. This is the primary source of discovery for the supported requests and their parameters.
You can start with http://teamcity:8111/httpAuth/app/rest/server
request and then drill down following "href" attributes of the entities listed.
Please make sure you read through this "General information" section before using the API.
...
- Using basic HTTP authentication. Provide a valid TeamCity username and password with the request and include . You can force basic auth by including
"httpAuth
" before the "/app/rest
" part: e.g.http://teamcity:8111/httpAuth/app/rest/builds
- Using access to the server as a guest user (if enabled) include "
guestAuth
" before the "/app/rest
" part: e.g.:http://teamcity:8111/guestAuth/app/rest/builds
- if you are checking REST GET requests from within a browser and you are logged in to TeamCity in the browser, you can just use "
/app/rest
" URL: e.g.http://teamcity:8111/app/rest/builds
...
Note: If the value contains the "," symbol, it should be enclosed into parentheses: "(<value>)". The value of a dimension can also be encoded as Base64url and sent as "<dimension>:($base64:<base64-encoded-value >)" instead of " <dimension>: <value>".
Examples
http://teamcity:8111/httpAuth/app/rest/projects
gets you the list of projects
http://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.
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
...
To enable support for preflight OPTIONS request, add "rest.cors.optionsRequest.allowUnauthorized=true" internal property, restart the server and use "/app/rest/latest" URL for the requests (not "/app/rest", without "httpAuth" prefix).
If that does not help, enable debug logging and look for related messages. If there are none, capture the browser traffic and messages to investigate the case.
...
Since TeamCity 10:
Licensing information: GET http://teamcity:8111/httpAuth/app/rest/server/licensingData
List of license keys: GET http://teamcity:8111/httpAuth/app/rest/server/licensingData/licenseKeys
License key details: GET http://teamcity:8111/httpAuth
/app/rest/server/licensingData/licenseKeys/<license_key>
Add license key(s): POST text/plain newline-delimited keys to http://teamcity:8111/httpAuth/app/rest/server/licensingData/licenseKeys
Delete a license key: DELETE http://teamcity:8111/httpAuth/app/rest/server/licensingData/licenseKeys/<license_key>
...
Projects and Build Configuration/Templates Lists
List of projects: GET http://teamcity:8111/httpAuth/app/rest/projects
Project details: GET http://teamcity:8111/httpAuth/app/rest/projects/ <projectLocator>
<projectLocator>
can be id:<internal_project_id>
or name:<project%20name>
List of Build Configurations: GET http://teamcity:8111/httpAuth/app/rest/buildTypes
List of Build Configurations of a project: GET http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/buildTypes
Get projects with sub-projects/ Build Configurations data and their order as configured by the specified user on the Overview page: GET http://teamcity:8111/httpAuth/app/rest/projects?locator=selectedByUser:current&fields=count,project(id,parentProjectId,projects(count,project(id),$locator(selectedByUser:current)),buildTypes(count,buildType(id),$locator(selectedByUser:current)))
List of templates for a particular project: http://teamcity:8111/httpAuth/app/projects/<projectLocator>/templates
.
List of all the templates on the server: http://teamcity:8111/httpAuth/app/rest/buildTypes?locator=templateFlag:true
Project Settings
Get project details: GET http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>
Delete a project: DELETE http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>
Create a new empty project: POST plain text (name) to http://teamcity:8111/httpAuth/app/rest/projects/
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
. Also see an example. Note that editing via the TeamCity Web UI will ve disabled for projects created via the REST API.
Edit project parameters: GET/DELETE/PUT http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/parameters/<parameter_name>
(produces XML, JSON and plain text depending on the "Accept" header, accepts plain text and XML and JSON) Also supported are requests .../parameters/<parameter_name>/name
and .../parameters/<parameter_name>/value
.
Project name/description/archived status: GET/PUT http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/<field_name>
(accepts/produces text/plain) where <field_name> is one of "name", "description", "archived".
Project's parent project: GET/PUT XML http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/parentProject
...
List of project features: http://teamcity:8111/httpAuth/app/rest /projects/<projectLocator>/projectFeatures
List features with filtering: http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/projectFeatures?locator=<projectFeaturesLocator> e.g. to find all issue tracker features of GitHub type, use locator "type:IssueTracker,property(name:type,value:GithubIssues)"
Edit features: GET/DELETE/PUT http://teamcity:8111/httpAuth/app/rest /projects/<projectLocator>/projectFeatures/<featureId>
VCS Roots
List all VCS roots: GET http://teamcity:8111/httpAuth/app/rest/vcs-roots add locator=
<vcsRootLocator>
parameter to list only the VCS roots matched
Get details of a VCS root/delete a VCS root: GET/DELETE http://teamcity:8111/httpAuth/app/rest/vcs-roots/<vcsRootLocator> , where "
<vcsRootLocator>
" can be "id:<internal VCS root id>
" or other VCS root locator
Create a new VCS root: POST VCS root XML (the one like retrieved for a GET request for VCS root details) to http://teamcity:8111/httpAuth/app/rest/vcs-roots
Also supported:
GET/PUT http://teamcity:8111/httpAuth/app/rest/vcs-roots/ <vcsRootLocator>/properties/<property_name>
GET/PUT http://teamcity:8111/httpAuth/app/rest/vcs-roots/<vcsRootLocator>/<field_name>,
where <field_name>
is one of the following: name, shared, project (post project locator to "project" to associate a VCS root with a specific project).
Anchor | ||||
---|---|---|---|---|
|
http://teamcity:8111/httpAuth/app/rest/vcs-root-instances?locator=<vcsRootInstancesLocator>
A "VCS root" is the setting configured in the TeamCity UI, "VCS root instance" is the internal TeamCity entity which is derived from the "VCS root" to perform actual VCS operation.
If the VCS root has no %-references to parameters, a single VCS root corresponds to a single "VCS root instance".
If a VCS root has %-reference to a parameter and the reference resolves to a different value when the VCS root is attached to different configurations or when custom builds are run, a single "VCS root" can generate several "VCS root instances".
...
There are two endpoints dedicated at using in commit hooks from the version control repositories:
POST
http://teamcity:8111/app/rest/vcs-root-instances/checkingForChangesQueue?locator=<vcsRootInstancesLocator> - schedules checking for changes for the matched VCS root instances and returns the list of VCS root instances matched (just like GET http://teamcity:8111/httpAuth/app/rest/vcs-root-instances?locator=<vcsRootInstancesLocator> )
POST http://teamcity:8111/app/rest/vcs-root-instances/commitHookNotification?locator=<vcsRootInstancesLocator> - schedules checking for changes for the matched VCS root instances and returns plain-text human-readable message on the action performed, HTTP response 202 in case of successful operation
Both perform the same action (put the VCS root instances matched by the <locator>) to the queue for "checking for changes" process and differ only in responses they produce.
Note that since the matched VCS root instances are the same as for .../app/rest/vcs-root-instances?locator=<locator> request and that means that by default only the first 100 are matched and the rest are ignored. If this limit is hit consider tweaking the <locator> to match less instances (recommended) or increase the limit e.g. by adding ",count:1000" to the locator.
...
Build Configuration/Template details: GET http://teamcity:8111/
httpAuth/app/rest/buildTypes/<buildConfigurationLocator>
(details on the Build Configuration locator).
...
To get aggregated status for several build configurations, s ee Build Status Icon section.
Anchor | ||||
---|---|---|---|---|
|
Get/set paused build configuration state: GET/PUT
http://teamcity:8111/httpAuth/app/rest/buildTypes/ <buildTypeLocator> /paused
(put "true" or "false" text as text/plain)Build configuration settings: GET/DELETE/PUT http://teamcity:8111/httpAuth/app/rest/buildTypes/ <buildTypeLocator>/settings/<setting_name>
Build configuration parameters: GET/DELETE/PUT
http://teamcity:8111/httpAuth/app/rest/buildTypes/ <buildTypeLocator>/parameters/<parameter_name>
(produces XML, JSON and plain text depending on the "Accept" header, accepts plain text and XML and JSON). The requests .../parameters/<parameter_name>/name
and .../parameters/<parameter_name>/value
are also supported.
Build configuration steps: GET/DELETE http://teamcity:8111/httpAuth/app/rest/buildTypes/ <buildTypeLocator>/steps/<step_id>
Create build configuration step: POST http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/steps.
The XML/JSON posted is the same as retrieved by GET request to .../steps/<step_id>
except for the secure settings like password: these are not included into responses and should be supplied before POSTing back
Features, triggers, agent requirements, artifact and snapshot dependencies follow the same pattern as steps with URLs like:
http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/features/<id>
http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/triggers/<id>
http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/agent-requirements/<id>
http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/artifact-dependencies/<id>
http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/snapshot-dependencies/<id>
Since TeamCity 10, it is possible to disable/enable artifact dependencies and agent requirements:
Disable/enable an artifact dependency PUT http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/artifact-dependencies/<id>/disabled
(put " true " or "false" text as text/plain)
Disable/enable an agent requirement PUT http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/agent-requirements/<id>/disabled
(put " true " or "false" text as text/plain)
Build configuration VCS roots: GET/DELETE http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/vcs-root-entries/<id>
Attach VCS root to a build configuration: POST http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/vcs-root-entries
. The XML/JSON posted is the same as retrieved by GET request to
http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/vcs-root-entries/<id>
except for the secure settings like password: these are not included into responses and should be supplied before POSTing back.
Create a new build configuration with all settings: POST http://teamcity:8111/httpAuth/app/rest/buildTypes
. The XML/JSON posted is the same as retrieved by GET request. (Note that /app/rest/project/XXX/buildTypes
still uses the previous version notation and accepts another entity.) Note that editing via the TeamCity Web UI will ve disabled for build configurations created via the REST API.
Create a new empty build configuration: POST plain text (name) to http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/buildTypes
Copy a build configuration: POST XML <newBuildTypeDescription name='Conf Name' sourceBuildTypeLocator='id:bt42' copyAllAssociatedSettings='true' shareVCSRoots='false'/>
to http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/buildTypes
Read, detach and attach a build configuration from/to a template: GET/DELETE/PUT http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/template
(PUT accepts template locator with "text/plain" Content-Type)
...
Build Requests
List builds: GET http://teamcity:8111/httpAuth/app/rest/builds/?locator=<buildLocator>
Anchor | ||||
---|---|---|---|---|
|
http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>
(also supports DELETE to delete a build)Get the list of build configurations in a project with the status of the last finished build in each build configuration:
GET http://teamcity:8111/httpAuth/app/rest/buildTypes?locator=affectedProject:(id:ProjectId)&fields=buildType(id,name,builds($locator(running:false,canceled:false,count:1),build(number,status,statusText)))
Build Locator
Using a locator in build-related requests, you can filter the builds to be returned in the build-related requests. It is referred to as "build locator" in the scope of REST API.
...
Anchor | ||||
---|---|---|---|---|
|
revision:<REVISION> - find builds by revision, e.g. all builds of the given build configuration with the revision: /httpAuth/app/rest/builds?locator=revision:(REVISION),buildType:(id:BUILD_TYPE_ID). See more information below.
agentName:<name> - agent name to return only builds ran on the agent with name specified
...
Anchor | ||||
---|---|---|---|---|
|
Queued Builds
GET http://teamcity:8111/httpAuth/app/rest/buildQueue
Supported locators:
- project:<locator>
- buildType:<locator>
Get details of a queued build:
GET http://teamcity:8111/httpAuth/app/rest/buildQueue/id:XXX
For queued builds with snapshot dependencies, the revisions are available in the revisions
element of the queued build node if a revision is fixed (for regular builds without snapshot dependencies it is not).
Get compatible agents for queued builds (useful for builds having "No agents" to run on)
GET http://teamcity:8111/httpAuth/app/rest/buildQueue/id:XXX/compatibleAgents
Examples:
List queued builds per project:
GET http://teamcity:8111/httpAuth/app/rest/buildQueue?locator=project:<locator>
List queued builds per build configuration:
GET http://teamcity:8111/httpAuth/app/rest/buildQueue?locator=buildType:<locator>
Anchor | ||||
---|---|---|---|---|
|
...
To start a build, send POST request to http://teamcity:8111/httpAuth/app/rest/buildQueue
with the "build" node (see below) in content - the same node as details of a queued build or finished build. The queued build details will be returned.
...
Expand | ||
---|---|---|
| ||
|
Build Tags
Get tags: GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/tags/
Replace tags: PUT http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/tags/
(put the same XML or JSON as returned by GET)
Add tags: POST http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/tags/
(post the same XML or JSON as returned by GET or just a plain-text tag name)
(<buildLocator>
here should match a single build only)
...
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)
(<buildLocator>
here should match a single build only)
...
See the canceledInfo
element of the build item (available via GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator >
)
...
<path>
below can be empty for the root of build's artifacts or be a path within the build's artifacts. The path can span into the archive content, e.g. dir/path/archive.zip!/path_within_archive
GET http://teamcity:8111/httpAuth/app/rest/builds/
(returns the content of a build artifact) <build_locator>
/artifacts/content/ <path>
Media-Type: application/octet-stream or a more specific media type (determined from artifact file extension)
Possible error: 400 if the specified path references a directory
GET http://teamcity:8111/httpAuth/app/rest/builds/
(returns information about a build artifact) <build_locator>
/artifacts/metadata/
<path>
Media-Type: application/xml or application/json
GET http://teamcity:8111/httpAuth/app/rest/builds/
(returns the list of artifact children for directories and archives) <build_locator>
/artifacts/children/
<path>
Media-Type: application/xml or application/json
Possible error: 400 if the artifact is neither a directory nor an archive
GET http://teamcity:8111/httpAuth/app/rest/builds/<build_locator>/artifacts/archived/<path>?locator=pattern:<wildcard>
(returns the archive containing the list of artifacts under the path specified. The optional locator parameter can have file <wildcard> to limit the files only to those matching the wildcard)
Media-Type: application/zip
Possible error: 400 if the artifact is neither a directory nor an archive
Wiki Markup |
---|
{hidden-data} Since *TeamCity 9.1*: "locator" parameter is supported for the artifacts listing requests, e.g. "{{recursive:true,browseArchives:true}}". "recursive:true" dimension allows to list files recursively, "browseArchives:true" treat supported archives as "directories", listing their content {hidden-data} |
Examples:
GET http://teamcity:8111/httpAuth/app/rest/builds/id:100/artifacts/children/my-great-tool-0.1.jar\!/META-INF
GET http://teamcity:8111/httpAuth/app/rest/builds/id:100/artifacts/metadata/my-great-tool-0.1.jar\!/META-INF/MANIFEST.MF
GET http://teamcity:8111/httpAuth/app/rest/builds/id:100/artifacts/metadata/my-great-tool-0.1.jar!/lib/commons-logging-1.1.1.jar!/META-INF/MANIFEST.MF
GET http://teamcity:8111/httpAuth/app/rest/builds/id:100/artifacts/content/my-great-tool-0.1.jar!/lib/commons-logging-1.1.1.jar!/META-INF/MANIFEST.MF
Authentication
If you download the artifacts from within a TeamCity build, consider using teamcity.auth.userId
/teamcity.auth.password
system properties as credentials for the download artifacts request: this way TeamCity will have a way to record that one build used artifacts of another and will display it on the build's Dependencies tab.
...
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 pending changes for a build configuration http://teamcity:8111/httpAuth/app/rest/changes?locator=buildType:(id:BUILD_CONF_ID),pending:true
<lastChanges>
The <lastChanges>
tag contains information about the last commit included into the build and is only good for re-triggering the build: it contains the TeamCity internal id (the id attribute) associated with the commit, which is necessary for TeamCity to trigger a custom build on the same commit (see the example above ).
...
Since TeamCity 9.1 there is an experimental ability to retrieve entire build chain (all snapshot-dependency-linked builds) for a particular build:
http://teamcity:8111/httpAuth/app/rest/builds?locator=snapshotDependency:(to:(id:XXXX),includeInitial:true),defaultFilter:false
This gets all the snapshot dependency builds recursively for the build with id XXXX.
...
Get the parameters of a build: http://teamcity:8111/httpAuth/app/rest/builds/id:<build id>/resulting-properties
...
Get single build's field: GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/<field_name>
(accepts/produces text/plain) where <field_name>
is one of "number", "status", "id", "branchName" and other build's bean attributes
...
Get statistics for a single build: GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/statistics/
only standard/bundled statistic values are listed. See also Custom Charts
Get single build statistics value: GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/statistics/<value_name>
Get statistics for a list of builds: GET http://teamcity:8111/httpAuth/app/rest/builds?locator=BUILDS_LOCATOR&fields=build(id,number,status,buildType(id,name,projectName),statistics(property(name,value)))
Build log
Downloading build logs via a REST request is not supported, but there is a way to download the log files described here.
Build problems
GET http://teamcity:8111/httpAuth/app/rest/problemOccurrences?locator=build:(BUILD_LOCATOR)
Tests
List tests:
GET http:// teamcity :8111/app/rest/testOccurrences?locator=<locator dimension>:<value>
Supported locators:
...
Agents
List all agents: GET http://teamcity:8111/httpAuth/app/rest/agents
List all connected authorized agents: GET http://teamcity:8111/httpAuth/app/rest/agents?locator=connected:true,authorized:true
List all authorized agents: GET http://teamcity:8111/httpAuth/app/rest/agents?locator=authorized:true
List all enabled authorized agents: GET http://teamcity:8111/httpAuth/app/rest/agents?locator=enabled:true,authorized:true
Enable/disable an agent: PUT
http://teamcity:8111/httpAuth/app/rest/agents/ <agentLocator> /enabled
(put " true " or "false" text as text/plain). See an example.
Authorize/unauthorize an agent: PUT http://teamcity:8111/httpAuth/app/rest/agents/ <agentLocator> /authorized
(put " true " or "false" text as text/plain)
...
Code Block | ||
---|---|---|
| ||
<agent id="1" name="agentName" typeId="1" connected="true" enabled="true" authorized="true" uptodate="true" ip="..........." href="/httpAuth/app/rest/agents/id:1"> <enabledInfo status="true"> <comment> <user username="userName" id="1" href="/httpAuth/app/rest/users/id:1"/> <timestamp>20160406T175040+0300</timestamp> <text>newcomment</text> </comment> </enabledInfo> <authorizedInfo status="true"> <comment> <user username="userName" id="1" href="/httpAuth/app/rest/users/id:1"/> <timestamp>20160406T183033+0300</timestamp> </comment> </authorizedInfo> .... </agent> |
GET and PUT requests are supported to the following URLs:
http://teamcity:8111/httpAuth/app/rest/agents/ <agentLocator> /enabledInfo
http://teamcity:8111/httpAuth/app/rest/agents/ <agentLocator> /authorized
Media-Type: application/xml
...
Get/PUT agent's single field: GET/PUT http://teamcity:8111/httpAuth/app/rest/agents/<agentLocator>/<field name>
Delete a build agent: DELETE http://teamcity:8111/httpAuth/app/rest/agents/<agentLocator>
Agent Pools
Get/modify/remove agent pools:
GET/PUT/DELETE http://teamcity:8111/httpAuth/app/rest/projects/XXX/agentPools/ID
Add an agent pool:
POST the agentPool name='PoolName
element to http://teamcity:8111/httpAuth/app/rest/projects/XXX/agentPools
Move an agent to the pool from the previous pool:
POST <agent id='YYY'/>
to the pool's agents http://teamcity.url/app/rest/agentPools/id:XXX/agents
...
Delete a project from a pool:
DELETE http://teamcity.url/app/rest/agentPools/id:XXX/projects/id:YYY
Users
List of users: GET http://teamcity:8111/httpAuth/app/rest/users
Get specific user details: GET http://teamcity:8111/httpAuth/app/rest/users/<userLocator>
Create a user: POST http://teamcity:8111/httpAuth/app/rest/users
Update/remove specific user: PUT/DELETE http://teamcity:8111/httpAuth/app/rest/users/
For POST and PUT requests for a user, post data in the form retrieved by the corresponding GET request. Only the following attributes/elements are supported: name, username, email, password, roles, groups, properties.
Work with user roles: http://teamcity:8111/httpAuth/app/rest/users/<userLocator>/roles
<userLocator> can be of a form:
...
User's single field: GET/PUT http://teamcity:8111/httpAuth/app/rest/users/<userLocator>/<field name>
User's single property: GET/DELETE/PUT http://teamcity:8111/httpAuth/app/rest/users/<userLocator>/properties/<property name>
User Groups
List of groups: GET http://teamcity:8111/httpAuth/app/rest/userGroups
List of users within a group: http://teamcity:8111/httpAuth/app/rest/userGroups/key:Group_Key
Create a group: POST http://teamcity:8111/httpAuth/app/rest/userGroups
Delete a group: DELETE http://teamcity:8111/httpAuth/app/rest/userGroups/key:Group_Key
Other
Data Backup
Start backup: POST http://teamcity:8111/httpAuth/app/rest/server/backup?includeConfigs=true&includeDatabase=true&includeBuildLogs=true&fileName=
where <fileName> is the prefix of the file to save backup to. The file will be created in the default backup directory (see more).
Get current backup status (idle/running): GET http://teamcity:8111/httpAuth/app/rest/server/backup
Anchor | ||||
---|---|---|---|---|
|
...
List typed parameters:
- for a project:
http://teamcity:8111/httpAuth/app/rest/projects/<locator>/parameters
- for a build configuration:
http://teamcity:8111/httpAuth/app/rest/buildTypes/<locator>/parameters
The information returned is:parameters count
,property name
,value
, andtype
. TherawValue
of thetype
element is the parameter specification as defined in the UI.
Get details of a specific parameter:
GET to http://teamcity:8111/httpAuth/app/rest/buildTypes/<locator>/parameters/<name>
. Accepts/returns plain-text, XML, JSON. Supply the relevant Content-Type
header to the request.
Create a new parameter:
POST the same XML or JSON or just plain-text as returned by GET to http://teamcity:8111/httpAuth/app/rest/buildTypes/<locator>/parameters/. Note that secure parameters, i.e. type=password
, are listed, but the values not included into response, so the result should be amended before POSTing back.
...
- name: PUT the same XML or JSON as returned by GET to
http://teamcity:8111/httpAuth/app/rest/buildTypes/<locator>/parameters/NAME
- type: GET/PUT accepting XML and JSON as returned by GET to the URL
http://teamcity:8111/httpAuth/app/rest/buildTypes/<locator>/parameters/NAME/type
- type's rawValue: GET/PUT accepting plain text
http://teamcity:8111/httpAuth/app/rest/buildTypes/<locator>/parameters/NAME/type/rawValue
Build Status Icon
Icon that represents a build status:
A .png icon: GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/statusIcon
An .svg icon: GET http://teamcity:8111/httpAuth/app/rest/builds/<buildLocator>/statusIcon.svg
Icon that represents build status for several builds (since TeamCity 10.0):
GET http://teamcity:8111/httpAuth/app/rest/builds/aggregated/<build locator>
request and "strob
" build locator dimension:
Code Block | ||
---|---|---|
| ||
For project with id "PROJECT_ID": GET http://teamcity:8111/httpAuth/app/rest/builds/aggregated/strob:(buildType:(project:(id:PROJECT_ID)))/statusIcon.svg For all active branches in a build configuration with id "BUILD_CONF_ID": GET http://teamcity:8111/httpAuth/app/rest/builds/aggregated/strob:(branch:(buildType:(id:BUILD_CONF_ID),policy:active_history_and_active_vcs_branches),locator:(buildType:(id:BUILD_CONF_ID)))/statusIcon.svg |
...
CCTray-compatible XML is available via http://teamcity:8111/httpAuth/app/rest/cctray/projects.xml
.
Without authentication (only build configurations available for guest user): http://teamcity:8111/guestAuth/app/rest/cctray/projects.xml
.
...
curl -v --basic --user USERNAME:PASSWORD --request POST "http://teamcity:8111/httpAuth/app/rest/users/" --data @data.xml --header "Content-Type: application/xml"
...
curl -v --request PUT http://:SUPERUSER_TOKEN@teamcity:8111/httpAuth/app/rest/users/username:USERNAME/roles/SYSTEM_ADMIN/g/
...
Expand | ||
---|---|---|
| ||
Get the list of changes for a project: |
Note that editing via the TeamCity Web UI will ve disabled for projects created via the REST API
Base64url
https://confluence.jetbrains.com/display/TCD10/Configuring+VCS+Post-Commit+Hooks+for+TeamCity