Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rally Rest Api C#工具包_C#_Api_Rally - Fatal编程技术网

Rally Rest Api C#工具包

Rally Rest Api C#工具包,c#,api,rally,C#,Api,Rally,我正在尝试使用RallyRest API的C#工具包。我想显示每个版本的用户故事数,以及团队的任务数。分层需求请求不会返回所有数据。 此外,如何根据特定版本和用户故事的所有者过滤数据?下面是我的代码。你能建议我去哪里看看吗?我看了API RallyRestApi restApi = new RallyRestApi(username, password, "https://rally1.rallydev.com", "1.40"); bool projectScopin

我正在尝试使用RallyRest API的C#工具包。我想显示每个版本的用户故事数,以及团队的任务数。分层需求请求不会返回所有数据。 此外,如何根据特定版本和用户故事的所有者过滤数据?下面是我的代码。你能建议我去哪里看看吗?我看了API

RallyRestApi restApi = new RallyRestApi(username, password, "https://rally1.rallydev.com", "1.40");

            bool projectScopingUp = false;
            bool projectScopingDown = true;
            try
            {
                Request storyRequest = new Request("HierarchicalRequirement");
                storyRequest.Workspace = workspaceRef;
                storyRequest.Project = projectRef;

                storyRequest.ProjectScopeUp = projectScopingUp;
                storyRequest.ProjectScopeDown = projectScopingDown;
                storyRequest.Fetch = new List<string>()
                {
                    "Name",
                    "FormattedID",
                    "Project",
                    "Release",
                    "ScheduleState",
                    "State",
                    "Owner",
                    "Tasks"
    };
QueryResult queryStoryResults = restApi.Query(storyRequest);
                int totalUS = 0;
                foreach (var s in queryStoryResults.Results)
                {
                    if (s["Release"] != null)
                    {
                        Release = s["Release"]["Name"];
                        string word = "July 2014";
                        if (Release.Equals(word))
                        {
                           string tempOwner = s["Owner"]["_refObjectName"];
                        if (tempOwner.Contains("development")
                        {


                    Owner = s["Owner"]["_refObjectName"];
                    paragraph.AddFormattedText("ID : " + Id + " Name : " + Name + "  Owner : " + Owner + "Release :" + Release + "Number of Tasks : " + count, TextFormat.NotBold);

                    }

                    }
                }
            }
RallyRestApi restApi=新的RallyRestApi(用户名、密码,”https://rally1.rallydev.com", "1.40");
bool projectScopingUp=false;
bool projectScopingDown=true;
尝试
{
请求storyRequest=新请求(“层次化需求”);
storyRequest.Workspace=workspaceRef;
storyRequest.Project=projectRef;
storyRequest.ProjectScopeUp=ProjectScopeUp;
storyRequest.ProjectScopeDown=项目范围缩小;
storyRequest.Fetch=新列表()
{
“姓名”,
“格式化ID”,
“项目”,
“释放”,
“计划状态”,
“国家”,
“所有者”,
“任务”
};
QueryResult queryStoryResults=restApi.Query(storyRequest);
总积分=0;
foreach(querystoreresults.Results中的变量s)
{
如果(s[“释放”]!=null)
{
Release=s[“Release”][“Name”];
string word=“2014年7月”;
if(Release.Equals(word))
{
字符串tempOwner=s[“所有者”][“重新对象名称”];
if(tempOwner.Contains(“开发”)
{
Owner=s[“Owner”][“重新对象名称”];
段落.AddFormattedText(“ID:+ID+”名称:“+Name+”所有者:“+Owner+”发布:“+Release+”任务数:“+count,TextFormat.NotBold”);
}
}
}
}

以下是一个按特定版本和故事所有者筛选故事的示例。它还获取每个故事的任务集合,并使用单独的请求将其分解

static void Main(string[] args)
        {
            int storyCount = 0;
            int taskCount = 0;
            RallyRestApi restApi;
            restApi = new RallyRestApi("apiuser@co.com", "secret", "https://rally1.rallydev.com", "v2.0");

            String workspaceRef = "/workspace/1234";     //replace this OID with an OID of your workspace

            Request sRequest = new Request("HierarchicalRequirement");
            sRequest.Workspace = workspaceRef;
            sRequest.Fetch = new List<string>() { "FormattedID", "Name", "Tasks", "Release", "Project", "Owner" };
            sRequest.Query = new Query("Release.Name", Query.Operator.Equals, "r1").And(new Query("Owner", Query.Operator.Equals, "user@co.com"));
            QueryResult queryResults = restApi.Query(sRequest);

            foreach (var s in queryResults.Results)
            {
                Console.WriteLine("FormattedID: " + s["FormattedID"] + " Name: " + s["Name"] + " Release: " + s["Release"]._refObjectName + " Project: " + s["Project"]._refObjectName + " Owner: " + s["Owner"]._refObjectName);
                storyCount++;
                Request tasksRequest = new Request(s["Tasks"]);
                QueryResult queryTaskResult = restApi.Query(tasksRequest);
                foreach (var t in queryTaskResult.Results)
                {
                    Console.WriteLine("Task: " + t["FormattedID"] + " State: " + t["State"]);
                    taskCount++;
                }
            }
            Console.WriteLine(storyCount + " stories, "+  taskCount + " tasks ");
        }
static void Main(字符串[]args)
{
int-storyCount=0;
int taskCount=0;
拉莱雷斯塔皮·雷斯塔皮;
restApi=新的RallyRestApi(“apiuser@co.com“秘密”https://rally1.rallydev.com“,“v2.0”);
String workspaceRef=“/workspace/1234”//将此OID替换为工作区的OID
请求sRequest=新请求(“层次要求”);
sRequest.Workspace=workspaceRef;
sRequest.Fetch=new List(){“FormattedID”、“Name”、“Tasks”、“Release”、“Project”、“Owner”};
sRequest.Query=新查询(“Release.Name”,Query.Operator.Equals,“r1”)。和(新查询(“Owner”,Query.Operator.Equals,”user@co.com"));
QueryResult queryResults=restApi.Query(sRequest);
foreach(queryResults.Results中的var s)
{
Console.WriteLine(“FormattedID:+s[“FormattedID”]+”名称:“+s[“Name”]+”发布:“+s[“Release”]。\u重新对象名称+”项目:“+s[“Project”]。\u重新对象名称+”所有者:“+s[“所有者”。\u重新对象名称”);
storyCount++;
请求任务请求=新请求[“任务]);
QueryResult queryTaskResult=restApi.Query(tasksRequest);
foreach(queryTaskResult.Results中的变量t)
{
Console.WriteLine(“任务:+t[“FormattedID”]+“状态:+t[“状态”]);
taskCount++;
}
}
Console.WriteLine(storyCount+故事,+taskCount+任务);
}
我注意到您正在使用的WS-API的1.40不再受支持。如果您有较旧的代码,则必须对其进行重新分解才能使用v2.0。在v2.0中,不可能在同一请求中对集合进行水合处理。有关此主题的StackOverflow rally标记上有许多示例,例如,下载工具包的最新dll