Rest API Authentication Integrated

Hello, hopefully someone can help me:

We would like to remote run a TeamCity build from another website.

What I did was set up a build configuration with some predefined (but empty) build parameters so I can make a http webrequest to TeamCity's REST Api, something like the following:

Empty build parameters in this example (there are more, but i included only 2 for the sake of simplicity)


And the corresponding REST Url passing the parameters to TeamCity

This works, so far so good, now to the problem:

It seems I can only use basic authentication with username and password embedded in cleartext in the url. Sure, I can Setup https but still there is no way to get the users credentials in the application that makes the above http/s request.

This would be important because we want to know who started the build, if we just use a hardcoded service account for the request, the whole auditing feature TeamCity provides are useless (because every build would be run via service account).

Do I really need to authenticate to TeamCity with basic authentication or is it possible to use something like integrated authentication (like IIS).

TeamCity is Running on Windows Server 2k8, standard Tomcat Installation.

Thanks, best regards


Comment actions Permalink

Hi Davis

At the moment basic authentication is the only option.
Please vote for this feature request in TW-6885.


Comment actions Permalink

Hi there.

Since NTLM support has been added to the web UI, does this mean I can use it when making REST API calls?


Comment actions Permalink


Yes, you should be able to use REST with NTLM authentication.
It might depend on whether your client supports the option, though.

e.g. I managed to use curl to use NTLM with a command line like:
curl -v --ntlm --user USERNAME http://teamcity:8111/app/rest/server

Comment actions Permalink

I tried to use NTLM for the rest API and it didn't work. But I did manage it to work using NTLM + basic Auth.

You first use NTLM in the /ntlmLogin.html page and then use the cookie that TeamCity provides to you in the API.

See with a small example on how to do this.


Please sign in to leave a comment.