Example creating a buildconfig using a template with API
Hi all,
I'm not able to find a "How To" for creating a new build config from a template with API. I've created a template with the UI. Now Ihave to create a lot buildconfigs and this I wanted to do with the API. I'm using TC version 10.0.6.
So I would like to see an example how it goes. I suppose I've to hand over an xml / JSON where all the (addtional) settings are ?! Normally it should be able to do this with a CURL?
Can someone show me an example?
Thanks in advance,
Francesco
Please sign in to leave a comment.
Hi all,
I guess I'm getting better in understanding.
Doing the following I get an Error Message (http 404):
No build type is found by locator 'ID_FROM_MY_TEMPLATE'. Template is found instead.
With this CURL:
$ curl -v --user User:Password--request PUT https://teamcity.com:8113/app/rest/buildTypes/id:ID_FROM_MY_TEMPLATE/template --data file:///C:/teamcity/MyTest.xml --header "Content-Type: text/plain"
When I let the last "/template" away, I get this ErrorMessage (Http 405):
Not supported request. Check that URL, HTTP method and transferred data are correct. Metadata: Allow:[HEAD,DELETE,GET,OPTIONS]
I have me oriented on this thread:
https://teamcity-support.jetbrains.com/hc/en-us/community/posts/206048649-Create-From-Template-with-REST-API?input_string=Example%20creating%20a%20buildconfig%20using%20a%20template%20with%20API
the content of MyTest.xml is :
<newBuildTypeDescription name='Conf Name' sourceBuildTypeLocator='id:ID_FROM_MY_TEMPLATE'/>
Anyone an Idea?
Thanks in advance!