如何在Rally .NET webservice API中的Epic下获取所有缺陷

时间:2014-03-28 06:02:49

标签: .net rally

我正在使用RallyRestToolkitFor.NET编写应用程序。我能够获取特定工作区的所有用户故事的列出字段。现在我想在特定的“史诗”下获取故事。我无法在文档链接中找到这样做的方法。

我想知道我是否有可能尝试做什么。如果答案是肯定的,请告诉我方向。链接或示例代码或指针,我感谢任何帮助。

谢谢,萨加尔。

1 个答案:

答案 0 :(得分:1)

这是一个获取特定史诗故事的代码:

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

            String projectRef = "/project/12352814790";     //replace this OID with an OID of your project

            Request sRequest = new Request("HierarchicalRequirement");
            sRequest.Project = projectRef;
            sRequest.Fetch = new List<string>() { "FormattedID", "Name", "Children" };
            sRequest.Query = new Query("FormattedID", Query.Operator.Equals, "US384");
            QueryResult queryResults = restApi.Query(sRequest);

            foreach (var s in queryResults.Results)
            {
                Console.WriteLine("FormattedID: " + s["FormattedID"] + " Name: " + s["Name"]);
                Console.WriteLine("Collection ref: " + s["Children"]._ref);
                Request childrenRequest = new Request(s["Children"]);
                QueryResult queryChildrenResult = restApi.Query(childrenRequest);
                foreach (var c in queryChildrenResult.Results)
                {
                    Console.WriteLine("FormattedID: " + c["FormattedID"] + " Name: " + c["Name"]);
                }

            }
        }
    }
}