robnardo
robnardo

Reputation: 931

How to create a User Story in a certain Workspace and Project using Rally Api and .NET

Ok, i understand how to insert a Task and associate it with a User Story, but now how do I insert a User Story and associate it with a Workspace and Project. Here is what i have so far..

DynamicJsonObject toCreate = new DynamicJsonObject(); 
toCreate["Name"] = "My Test User Story";
toCreate["Description"] = "This is the description of the test User Story";

// these do not exist
//toCreate["Iteration.Name"] = "Iteration Name";
//toCreate["Workspace.ObjectID"] = "123456";
//toCreate["Project.ObjectID"] = "456789";

CreateResult createResult = _restApi.Create("hierarchicalrequirement", toCreate);
bool success = createResult.Success;

Upvotes: 3

Views: 2552

Answers (3)

Paito
Paito

Reputation: 1553

This finally gave me the hint that User story means "hierarchicalrequirement" in the RallyDev XML WebService.

Thanks!

Upvotes: 2

Kyle Morse
Kyle Morse

Reputation: 8410

Also pay attention to the contents of the Errors and Warnings collections on the CreateResult object. They often can provide clues to why something is not working.

Upvotes: 1

robnardo
robnardo

Reputation: 931

I tried this and it worked!

RallyRestApi _restApi = new RallyRestApi("username", "password", "https://rally1.rallydev.com", "1.27");
DynamicJsonObject toCreate = new DynamicJsonObject();
toCreate["Name"] = myUserStory.Name;
toCreate["Description"] = myUserStory.Description;

// these are the important ones..
toCreate["Workspace"] = "/workspace/456879854";
toCreate["Project"] = "/project/4573328835";
toCreate["Iteration"] = "/iteration/4459106059";

CreateResult createResult = _restApi.Create("hierarchicalrequirement", toCreate);            
bool success = createResult.Success;

So, you have to use references. Hope this helps others!

Upvotes: 6

Related Questions