TeamCity 2021.1 Help

Create and Delete Build Configurations

This article shows how to create, pause, and delete build configurations via TeamCity REST API.

Create Build Configuration

To create a new build configuration, compose and post a BuildType entity to:

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


<buildType description="string" id="string" name="string"> <project id="MyProjectID"/> <templates> <buildType id="MyTemplateID"/> </templates> <parameters> <property name="myBuildParameter" value="myValue"/> </parameters> <steps> <step name="myCommandLineStep" type="simpleRunner"> <properties count="4"> <property name="script.content" value="echo 'Hello World!'"/> </properties> </step> </steps> </buildType>
{ "id": "id", "name": "name", "project": { "id": "MyProjectID", }, "templates": { "buildType": [ { "id": "MyTemplateID", } ] }, "parameters": { "property": [ { "name": "myBuildParameter", "value": "myValue" } ] }, "steps": { "step": [ { "name": "myCommandLineStep", "type": "simpleRunner", "properties": { "property": [ { "name": "script.content", "value": "echo 'Hello World!'" } ] } } ] } }

Copy Build Configuration

To copy a build configuration, compose and post a NewBuildTypeDescription entity to:

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

where projectLocator is a ProjectLocator -typed string. Specify name, id, sourceBuildTypeLocator to locate the source configuration, and set copyAllAssociatedSettings option to true.


<newBuildTypeDescription copyAllAssociatedSettings="true" id="string" name="string" sourceBuildTypeLocator="string" />
{ "sourceBuildTypeLocator": "locator", "name": "name", "id": "id", "copyAllAssociatedSettings": true }

Delete Build Configuration

To delete a build configuration, send:

DELETE /app/rest/buildTypes/{buildConfigurationLocator}

where buildConfigurationLocator is a BuildTypeLocator -typed string used to locate the build configuration.

Pause Build Configurations

To get the current status of a build configuration, use:

GET http://<TeamCity Server host>:<port>/app/rest/buildTypes/<buildTypeLocator>/paused

The server will respond with the text/plain boolean value indicating whether the configuration is paused (true) or not (false). To change the status, put the required value in text/plain format to:

PUT http://<TeamCity Server host>:<port>/app/rest/buildTypes/<buildTypeLocator>/paused
Last modified: 14 October 2021