TeamCity 2021.1 Help

Create and Delete Projects

This article shows how to create, archive, and remove projects via TeamCity REST API.

Create Project

To create a project, compose and post a NewProjectDescription entity to:

POST http://<TeamCity Server host>:<port>/app/rest/projects

Specify name, id, and parentProject via its locator string (to define a project under the Root project, use id:_Root).

Example payload:

<newProjectDescription copyAllAssociatedSettings="true" id="string" name="string"> <parentProject locator="string" /> </newProjectDescription>
{ "parentProject": { "locator": "locator" }, "name": "name", "id": "id", "copyAllAssociatedSettings": true }

Copy Project

To make a copy of an existing project, add the sourceProject locator to define the source project.

Example payload:

<newProjectDescription copyAllAssociatedSettings="true" id="string" name="string"> <sourceProject locator="string" /> <parentProject locator="string" /> </newProjectDescription>
{ "parentProject": { "locator": "locator" }, "name": "name", "id": "id", "copyAllAssociatedSettings": true, "sourceProject": { "locator": "locator" } }

Archive Project

To get a project's archived status, use:

GET http://<TeamCity Server host>:<port>/app/rest/projects/<projectLocator>/parameters/archived

To update its status, use:

PUT http://<TeamCity Server host>:<port>/app/rest/projects/<projectLocator>/parameters/archived

The payload should be either true or false.

Delete Project

To delete a project, use:

DELETE http://<TeamCity server host>:<port>/app/rest/projects/<projectLocator>

The projectLocator parameter is a locator string typed as ProjectLocator. For example, to delete a project with the ID MyCustomProject, use:

DELETE http://<TeamCity server host>:<port>/app/rest/projects/id:MyCustomProject
Last modified: 14 October 2021