create new build from template through REST

I try to create a new config from template but couldn't find docs about it, so I tried copy config according to the docs but that failed.

curl-7.28.0.ermine/curl -v --request POST "http://username:password@servername:8111/httpAuth/app/rest/projects/project2/buildTypes/?authToken=key" --data @~/c.xml --header "Content-Type: application/xml"

project2 is the project id for the only project i have.

in c.xml I have

<newBuildTypeDescription name='release 6.18.3' sourceBuildTypeLocator='id:bt2' copyAllAssociatedSettings='true' shareVCSRoots='false' />

Error msg is:

Error: javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException: Premature end of file.], caused by: javax.xml.bind.UnmarshalException, caused by: org.xml.sax.SAXParseException: Premature end of file.

Ideally I want to achieve:

1. create new build config from template

2. supply build param in the new config

use something like the following xml

<newBuildTypeDescription name='release 6.18.3' sourceBuildTypeLocator='id:bt2' copyAllAssociatedSettings='true' shareVCSRoots='false'>
  <property name="BUILD_OPTION" value="-nodist" />
  <property name="ENVIRONMENT" value="qa" />
  <property name="COMPONENT" value="-c dtete" />
  <property name="CPP" value="" />
  <property name="DIST_HOMEDIR" value="" />
  <property name="env.EXTERNAL" value="" />
  <property name="PATH" value="releases" />
  <property name="TAG" value="6.18.3" />

Is it possible in TC 7.1 through REST?

Please sign in to leave a comment.