How to access TeamCity API from the outside?

I see that TeamCity has a very good API and it's has been a couple years since I've done Java development, but how do I 'connect' to TeamCity if I wanted to create command line tool?  What is the 'entry point', if you will, to log into TeamCity.  I've been looking throught the API documentation and just can't seem to find it.

Thanks for your time.

Dave

4 comments
Comment actions Permalink

You can expose any functionality you wish by HTTP. For this you should assign custom controller to a URL path, read more about custom controllers here: http://www.jetbrains.net/confluence/display/TCD4/Web+UI+Extensions#WebUIExtensions-DevelopingaCustomController

By default access to your controller will require authentication, but you can disable it with help of jetbrains.buildServer.controllers.AuthorizationInterceptor#addPathNotRequiringAuth

You can also use basic authentication which can be useful when you access server from scripts or command line tools. Basic authentication will be asked by server if on the client side you add /httpAuth/ prefix to the URL: http://localhost:8080/httpAuth/yourControllerPath.html (http://www.jetbrains.net/confluence/display/TCD4/Accessing+Server+by+HTTP)

Hope this helps.

0
Comment actions Permalink

I have read all the information posted on those links - thanks, for the quick response.  But I'm wanting to create a separate tool, like the system tray monitor, a stand alone tool that can access TeamCity.  The system tray tool is a stand alone Win32 EXE that looks like it's using C++, based on the DLL residing next to the EXE.

Our current build system has a lot of TFS build definitions.  What I'm wanting to do is be able to migrate the TFS build definitions to TeamCity.  I'd like to access the API to create builds, add VCS items and the like.  I love TeamCity, but the TFS VCS isn't very well done - sorry if I offend anyone, but TFS isn't a very mature product to interface with either.  This tool will be Java, but I need the initial object to access interfaces like SBuildServer, SBuild, etc.

Does that make sense?

Dave

0
Comment actions Permalink

In TeamCity we are using Spring container. So if you need a reference to a Spring bean (SBuildServer) you can simply add SBuildServer as an argument to your class constructor and then you need to define your class as Spring bean too, i.e. you need to create spring configuration file and define your class there.

Most of the services in TeamCity are obtained this way - Spring container injects them automatically when your Spring bean is created. To be more familiar with Spring framework I would suggest to read this: http://static.springframework.org/spring/docs/2.5.x/reference/beans.html

0
Comment actions Permalink

Thanks for your feedback.

Dave

0

Please sign in to leave a comment.