Creating build configuration via REST in Teamcity

Is it possible to create a new build configuration for an existing project via the REST api (POST method) in Teamcity?
If so, how to create? (some recommendations)

thank

+5
source share
4 answers

Well, you can refer to this for beginners:

-4
source

This is probably possible on 8.x, no need to worry about earlier versions.

Here is a really simple python snippet that will copy an existing assembly assembly into a given project, using this as a guide to http://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-BuildConfigurationAndTemplateSettings.

import requests

xml =  """<newBuildTypeDescription name='NewBuildConfigName'
          sourceBuildTypeLocator='ExistingBuildConfigNameThatYouWantToCopy'
          copyAllAssociatedSettings='true' shareVCSRoots='false'/>
       """
headers = {'Content-Type': 'application/xml'} # set what your server accepts

print requests.post('http://YOURTEAMCITYWEBADDRESS:YOURTEAMCITYPORT/httpAuth/app/rest/projects/id:PROJECTIDWHERENEWBUILDCONFIGSHOULDBECREATED/buildTypes', data=xml, headers=headers, auth=('TeamCityUserName','TeamCityPassword')).text
+4

8.x REST. - :

POST plain text (name) to http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/buildTypes

8.x REST. 8.x REST.

+3

, REST API. this

. , API. . , .

, , API REST Teamcity. ( , , ).

+2

All Articles