Accessing Server from Scripts

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

Accessing Server from Scripts

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 clear text during basic HTTP authentication.

To use a basic HTML 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 thr 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:

Since TeamCity 3.0, 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. For example, you can infer that agent's Id equals "2" if it's details page has the following URL:

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

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.