Accessing Server by HTTP

Skip to end of metadata
Go to start of metadata
You are viewing documentation of TeamCity 5.x, which is not the most recent released version of TeamCity. Please refer to the listing to choose another version.
Search

Searching TeamCity 5.x Documentation

Table of Contents

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.

You may want to configure the server to use HTTPS as username and password are passed in insecure form during 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:

The HTTP authentication can be useful when downloading 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:

In TeamCity Enterprise version, please make sure the user used to perform the authentication (or Guest user) has appropriate role to perform the necessary operation.

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:

Example:

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:

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

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

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:

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:

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

  • &moveToTop=true




See Also:

Labels:

admin admin Delete
server server Delete
script script Delete
trigger trigger Delete
build build Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Jun 04, 2009

    Any support yet for actually creating projects & builds via HTTP? I've just raised a feature request for this as it would be very handy to be able to script the configuration of projects/builds.

    1. Jun 04, 2009

      Right now this could be done via plugin only. I.e. you can write a plugin which will provide necessary HTTP interface and create projects using TeamCity open API.

  2. May 17, 2010

    Also some notes on "undocumented" (read: can change in any release without extra notice) abilities:
    Apply VCS label for a build.

    Then see Changes tab on build results for the result.

    Set TeamCity tag for a build (see also REST API):

    Pin a build in TeamCity:

    Stop/Cancel a build:

    Pause a Build Configuration:

    (pass pause=false to activate Build Configuration)

  3. Oct 23, 2010

    Related agent disable/enable thread