Create an SCMRepository and Changeset in Web Services API

Document ID:  TEC1912468
Last Modified Date:  08/08/2017
{{active ? 'Hide' : 'Show'}} Technical Document Details

Products

  • CA Agile Central
  • CA Agile Central On-Premises

Components

  • AGILE CENTRAL SAAS:ACSAAS
  • Agile Central WIC for HP ALM/QC:ACQCIN
  • Agile Central WIC for Atlassian JIRA 6:ACJIRA
  • BUGZILLA:ACBZIN
  • GITHUB:ACGITH
  • Agile Central VCS Connector for GIT:ACGITI
Summary:

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

Instructions:

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
URL:
https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize

 

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
URL:
https://rally1.rallydev.com/slm/webservice/v2.0/scmrepository/create

 

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

 

https://rally1.rallydev.com/slm/webservice/v2.0/scmrepository/create?key=73bd3465-...

 

Payload (request body):

 

{"SCMRepository":{
"Name":"repo1",
"Description":"created with wsapi",
"SCMType":"sometype",
"Uri":"http://localhost:8080",
"Projects":{"Project":"/project/12527515559"}}
}
}

 

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

 

"Projects":{"Project":"/project/12527515559"}}

 

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: "https://rally1.rallydev.com/slm/webservice/v2.0/scmrepository/16953479942",
_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
URL:
https://rally1.rallydev.com/slm/webservice/v2.0/changeset/create

 

Payload (request body):

 

{"Changeset":{
"Revision":"1",
"SCMRepository":"/scmrepository/16953479942",
"CommitTimestamp":"2014-02-11",
"Artifacts":{"Artifact":"/defect/16953278630"}}
}
}

 

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\"}}}" https://rally1.rallydev.com/slm/webservice/v2.0/changeset/create

 

Please help us improve!

Will this information enable you to resolve your issue?

Please tell us what we can do better.

{{feedbackText.length ? feedbackText.length : '0'}}/255

{{status}}

Not what you were looking for?

Search Again >

Product Information

Support by Product >

Communities

Join a Community >