Create and Delete Projects
This article shows how to create, archive, and remove projects via TeamCity REST API.
To create a project, compose and post a NewProjectDescription entity to:
POST/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:
XML
JSON
<newProjectDescription copyAllAssociatedSettings="true" id="string" name="string">
<parentProject locator="string" />
</newProjectDescription>
{
"parentProject": {
"locator": "locator"
},
"name": "name",
"id": "id",
"copyAllAssociatedSettings": true
}
To make a copy of an existing project, add the sourceProject
locator to define the source project.
Example payload:
XML
JSON
<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"
}
}
To get a project's archived status, use:
GET/app/rest/projects/<projectLocator>/archived
To update its status, use:
PUT/app/rest/projects/<projectLocator>/archived
The payload should be either true
or false
.
To delete a project, use:
DELETE/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/app/rest/projects/id:MyCustomProject
Thanks for your feedback!
Was this page helpful?