如何使用 Rally REST .NET 获取工作区列表 [英] How to obtain a list of workspaces using Rally REST .NET

查看:16
本文介绍了如何使用 Rally REST .NET 获取工作区列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取给定 Rally 订阅的可用工作区列表,但查询中似乎没有返回实际工作区.

I'm trying to obtain a list of available workspaces for a given Rally subscription, but it doesn't seem like the actual workspaces are being returned in the query.

这是我目前所拥有的:

        RallyRestApi restApi = new RallyRestApi("username", "password");
        List<string> list = new List<string>();

        Request request = new Request("Subscriptions");
        request.Fetch = new List<string>(){
            "Name",
            "SubscriptionID",
            "Workspaces"
        };

        QueryResult queryResult = restApi.Query(request);

        foreach (var result in queryResult.Results)
        {
            var workspaces = result["Workspaces"];
        }

我似乎无法从 QueryResult 中挑出工作区引用或名称.我是否缺少额外的步骤/查询?

I can't seem to tease the workspace references or names out of that QueryResult. Am I missing an extra step/query?

推荐答案

v2.0 出于性能原因删除了在同一响应中返回子集合的功能.现在获取一个集合将返回一个带有计数和从中获取集合数据的 url 的对象.

v2.0 removed the ability to return child collections in the same response for performance reasons. Now fetching a collection will return an object with the count and the url from which to get the collection data.

示例:/subscription/12345/workspaces

Example: /subscription/12345/workspaces

最近发布的 2.0 版本的 .NET Rest Toolkit 支持 WSAPI v2.0 和集合查询.

The recently released 2.0 version of the .NET Rest Toolkit supports WSAPI v2.0 and collection querying.

RallyRestApi restApi = new RallyRestApi("username", "password");

//get the current subscription
DynamicJsonObject sub = restApi.getSubscription("Workspaces");

//query the Workspaces collection
QueryResult queryResult = restApi.Query(sub["Workspaces"]); 

foreach (var result in queryResult.Results)
{
    var workspaceRef = result["_ref"];
    var workspaceName = result["Name"];
}

这篇关于如何使用 Rally REST .NET 获取工作区列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆