carlspring
carlspring

Reputation: 32567

How can you programatically create projects and build types in TeamCity?

I have been studying the TeamCity OpenAPI and I'm trying to figure out if it's possible to create new projects and build types programatically. As far as I understand, it's not exactly possible via the REST API.

Could somebody explain how this works and if it at all can be done? Any examples or pointers to existing plugins which already do this, would be highly appreciated

Upvotes: 1

Views: 854

Answers (1)

Pavel Sher
Pavel Sher

Reputation: 2211

Actually you can create projects and build configurations with help of TeamCity REST API, see: http://confluence.jetbrains.com/display/TW/REST+API+Plugin#RESTAPIPlugin-ProjectSettings

But if you prefer using Open API, then you need to obtain jetbrains.buildServer.serverSide.ProjectManager spring bean and use it like this:

ProjectManager pm;
SProject p = pm.createProject("my project name"):
SBuildType bt = p.createBuildType("my build type name");

and so on.

Upvotes: 2

Related Questions