Is it possible to create a new build configuration for an existing project via REST api(POST method) in Teamcity?
If so, how to create? (some guidelines )
Thanks
Go to Administration | Projects and open the required project. Alternatively, open the project using the Projects pop-up menu and click Edit Project Settings. The Project Settings page will open. On the Project Settings page, click Create build configuration under the Build Configurations section.
You can start working with the REST API by opening the http://<TeamCity Server host>:<port>/app/rest/server URL in your browser: this page gives several pointers to explore the API. To learn more, proceed to the dedicated TeamCity REST API Help. Was this page helpful?
To run a custom build with specific changes, open the build results page, go to the Changes tab, expand the required change, click the Run build with this change, and proceed with the options in the Run Custom Build dialog. Use HTTP request or REST API request to TeamCity to trigger a build.
It's for sure possible on 8.x, haven't the need to care about early versions.
Here's a really simple python snippet that will copy an existing build config into a given project using this as a guide 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
Its now possible in 8.x REST. You can do something like:
POST plain text (name) to http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/buildTypes
Above is copied from 8.x REST. Check 8.x REST for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With