Create an SCMRepository and Changeset in Web Services API

Document ID : KB000010740
Last Modified Date : 14/02/2018
Show Technical Document Details

How to create an SCMRepository and Changeset in Web Services API (WS API).


Normally a changeset is created in Rally via integration with version control systems. It cannot be created in the UI. It can however be created directly in Web Services API, without using version control integration.


In WS API, the Changeset object has a couple of required fields, one of them an SCMRepository.


SCMRepository is also an object in WS API. It does not have to represent an actual version control repository, e.g, SVN repository.


In this example a browser REST client is used to create an SCMRepository and a Changeset on a defect.


1. Create API Key and use API Key for zsessionid header. 


See "Confirm that API Key is working"article for details.


Get security token (for OnPremises and Sandbox only)


Method: Get


The response will include the token that will be used in the next step:
{"OperationResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": [], "Warnings": [], "SecurityToken": "73bd3465-...."}}


2. Create an SCMRepository object:


Method: Post


(If OnPremises or Sandbox, append the key to the request as in:


Payload (request body):


"Description":"created with wsapi",


Notice that SCMRepository object has attribute Projects which is a collection of projects, hence this syntax:




After SCMRepository is created find out its reference. A query on SCMReposotory objects in WS API will return existing repositories. Here is an example of a return:


_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
_ref: "",
_refObjectUUID: "dff6670a-aedc-4c2b-bd13-16191623c860",
_refObjectName: "repo1",
_type: "SCMRepository"


We need to use this part: /scmrepository/16953479942


3. Create a Changset:


Changest object in WS API has required fiels: CommitTimeStamp, Revision, SCMRepository. Artifacts attribute, which is a collection of artifacts with which changeset is associated is not a required field.


Method: Post


Payload (request body):




A changeset is created:


Screen Shot 2017-08-07 at 11.27.06 AM.png
Here is an example of creating a changeset with a curl command (API key is used for authentication):
curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -d"{\"Changeset\":{\"Revision\":\"1\",\"SCMRepository\":\"/scmrepository/16953479942\",\"CommitTimestamp\":\"2014-12-17\",\"Message\":\"test\",\"Artifacts\":{\"Artifact\":\"/defect/12353153797\"}}}"