我是使用Rally API for .NET的新手,我非常感谢任何帮助。我已经获得了故事对象,但我不确定如何使用新缺陷更新它。我可以根据各种示例创建新缺陷,但它们与任何特定故事无关。我当前的错误带回:[“忽略了JSON元素的分层要求。处理此请求时出现缺陷。”]。
提前感谢任何见解。
答案 0 :(得分:1)
HierarchicalRequirement上的缺陷集合是只读的,因此您无法通过更改Defect集合将缺陷与故事相关联。但是,当使用API创建/更新缺陷时,您可以执行的是将缺陷的Requirement属性设置为现有Story的Ref。这是一个简单的例子:
//Set our Workspace and Project scopings
String workspaceRef = "/workspace/12345678910";
String projectRef = "/project/12345678911";
String userRef = "/user/12345678912";
String storyRef = "/hierarchicalrequirement/12345678913";
for (int i = 0; i < 3; i++)
{
DynamicJsonObject myDefect = new DynamicJsonObject();
myDefect["Name"] = "My Defect from REST: " + i;
myDefect["Priority"] = "Normal";
myDefect["Workspace"] = workspaceRef;
myDefect["Project"] = projectRef;
myDefect["SubmittedBy"] = myUserReference;
myDefect["Requirement"] = storyRef ;
CreateResult createDefect = restApi.Create("Defect", myDefect);
Console.WriteLine("Created: " + myDefect["Name"] + "\n");
DynamicJsonObject fetchedDefect = restApi.GetByReference(createDefect.Reference, "FormattedID");
Console.WriteLine("Created Defect with FormattedID: " + fetchedDefect["FormattedID"]);
}
长整数是感兴趣的ref中使用的Rally中对象的ObjectID(OID)。