Rally Rest API.NET工具包使用标记创建缺陷/用户故事

Rally Rest API.NET工具包使用标记创建缺陷/用户故事,rally,Rally,我在创建包含标签的新缺陷或用户故事时遇到了一些问题。我尝试了几种不同的方法,通常缺陷是在Rally中创建的,但没有附加标签。从Rally API和工具包的源代码来看,标签似乎应该在ArrayList中。这是我的最新尝试。如果有人能给我指出正确的方向,我将不胜感激 DynamicJsonObject itemToCreate = new DynamicJsonObject(); itemToCreate["project"] = project["_ref"]; ArrayList tagLis

我在创建包含标签的新缺陷或用户故事时遇到了一些问题。我尝试了几种不同的方法,通常缺陷是在Rally中创建的,但没有附加标签。从Rally API和工具包的源代码来看,标签似乎应该在ArrayList中。这是我的最新尝试。如果有人能给我指出正确的方向,我将不胜感激

DynamicJsonObject itemToCreate = new DynamicJsonObject();
itemToCreate["project"] = project["_ref"];

ArrayList tagList = new ArrayList();

DynamicJsonObject myTag = new DynamicJsonObject();
myTag["_ref"] = "/tag/1435887928";

tagList.Add(myTag);
itemToCreate["Tags"] = tagList;
CreateResult itemToCreateResult = restApi.Create(workspace["_ref"], "defect", itemToCreate);
你就快到了:

 ArrayList tagList = new ArrayList();
 DynamicJsonObject myTag = new DynamicJsonObject();
 myTag["_ref"] = "/tag/2222";
 tagList.Add(myTag);
 myStory["Tags"] = tagList;
 updateResult = restApi.Update(createResult.Reference, myStory);
此代码创建一个用户故事,根据ref查找标记,并将标记添加到故事中:

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using Rally.RestApi;
using Rally.RestApi.Response;

namespace Rest_v2._0_test
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initialize the REST API
            RallyRestApi restApi;
            restApi = new RallyRestApi("user@co.com", "secret", "https://rally1.rallydev.com", "v2.0");

            //Set our Workspace and Project scopings
            String workspaceRef = "/workspace/11111"; //replace this OID with an OID of your workspace

            //Create an item
            DynamicJsonObject myStory = new DynamicJsonObject();
            myStory["Name"] = "abcdefg11";
            CreateResult createResult = restApi.Create(workspaceRef, "HierarchicalRequirement", myStory);
            DynamicJsonObject s = restApi.GetByReference(createResult.Reference, "FormattedID");
            Console.WriteLine(s["FormattedID"]);

            myStory["Description"] = "This is my story.";
            OperationResult updateResult = restApi.Update(createResult.Reference, myStory);

            ArrayList tagList = new ArrayList();
            DynamicJsonObject myTag = new DynamicJsonObject();
            myTag["_ref"] = "/tag/2222";
            tagList.Add(myTag);

            //Update the item 
            myStory["Tags"] = tagList;
            updateResult = restApi.Update(createResult.Reference, myStory);
        }
    }
}