TeamCity 4.0 Help

Accessing Server by HTTP

The TeamCity server supports basic HTTP authentication allowing to access certain web server pages and perform actions from various scripts.

Use valid TeamCity server username and password to authenticate using basic HTTP authentication.

To use a basic HTTP authentication instead of redirecting to the login page, prepend a path in usual TeamCity URL with "/httpAuth". For example:

http://buildserver:8111/httpAuth/action.html?add2Queue=bt7

The HTTP authentication can be useful when Patterns For Accessing Build Artifacts and triggering a build.

If you have Guest user enabled, it can be used to perform the action too. Use "/guestAuth" before the URL path to perform the action on Guest user behalf. For example:

http://buildserver:8111/guestAuth/action.html?add2Queue=bt7

Triggering a Build From Script

To trigger a build, send the HTTP GET request for the URL: http://<server address>/httpAuth/action.html?add2Queue=<build type Id> performing basic HTTP authentication.

Some tools (for example, Wget) support the following syntax for the basic HTTP authentication:

http://<user name>:<user password>@<server address>/httpAuth/action.html?add2Queue=<build type Id>

Example:

http://testuser:testpassword@teamcity.jetbrains.com/httpAuth/action.html?add2Queue=bt10

You can trigger a build on a specific agent passing additional agentId parameter with the agent's Id. You can get the agent Id from the URL of the Agent's details page (Agents page > <agent name>). For example, you can infer that agent's Id equals "2", if its details page has the following URL:

http://teamcity.jetbrains.com/agentDetails.html?id=2

To trigger a build on two agents at the same time, use the following URL:

http://testuser:testpassword@teamcity.jetbrains.com/httpAuth/action.html?add2Queue=bt10&agentId=1&agentId=2

To trigger a build on all enabled and compatible agents, use "allEnabledCompatible" as agent ID:

http://testuser:testpassword@teamcity.jetbrains.com/httpAuth/action.html?add2Queue=bt10&agentId=allEnabledCompatible

Triggering a Custom Build

TeamCity allows you to trigger a build with customized parameters. You can select particular build agent to run the build, define additional properties and environment variables, and select the particular sources revision (by specifying the last change to include in the build) to run the build with. These customizations will affect only the single triggered build and will not affect other builds of the build configuration.

To trigger a build on a specific change inclusively, use the following URL:

http://testuser:testpassword@teamcity.jetbrains.com/httpAuth/action.html?add2Queue=bt10&modificationId=11112

modificationId — internal TeamCity server id which can be obtained from the web diff url.

To trigger build with custom parameters (system properties and environment variables), use the following syntax:

http://testuser:testpassword@teamcity.jetbrains.com/httpAuth/action.html?add2Queue=bt10&system.name=<property name1>&system.value=<value1>&system.name=<property name2>&system.value=<value2>&env.name=<environment variable name1>&env.value=<environment variable value1>&env.name=<environment variable name2>&env.value=<environment variable value2>

To specify a system property use a pair of parameters:

  • system.name — a name of the system property you want to trigger the build with

  • system.value — specify a value of the property

To specify an environment variable, use the following pair of parameters:

  • env.name — a name of environment variable the build will be triggered with

  • env.value — a value of the variable

To move build to the top of the queue, add the following to the query string

Last modified: 20 April 2023