Access denied errors when accessing TeamCity server via REST API.

I'm trying to use the REST API to access our TeamCity server, but I keep getting access denied related errors.

Here is the url I'm using:


Naturally I've removed the actual details from the url, but the above format is the same.

When I send an AJAX call to the url, I get this in reply (via the jQuery AJAX error() function)

"Access to restricted URI denied"  code: "1012"

This is telling me that my user does not have access to the server via the API, though I am able to log onto the server via the TC web UI without issues.

I double-checked this by using TeamCitySharp to acess the TC server and I got the same result - an access denied error.

Can someone help by telling me other configuration is required in order to allow my user to access the TC server via the REST API please?

Comment actions Permalink

I've managed to get the TeamCitySharp code working:

var tc = new TeamCityClient("teamcity.server:port");

tc.Connect("username", "password");

var projects = tc.AllProjects();

The mistake I made was that I needed to add "teamcity." to the start of the url in the call to new TeamCityClient().

OK that's cool. So it looks like the jQuery AJAX method is failing for a different reason, but I can't see what.
Comment actions Permalink


You can also check the URL with a curl tool, if necessary.

I'd doublecheck that the client you are using (i.e. JQuery method) support specification of user credentials directly in the URL.


Please sign in to leave a comment.