TeamCity 3.0 Help

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.

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

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:

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

Last modified: 20 April 2023