How to obtain a list of workspaces using Rally REST .NET

泪湿孤枕 提交于 2019-12-02 05:23:19

问题


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.

Here's what I have so far:

        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"];
        }

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


回答1:


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.

Example: /subscription/12345/workspaces

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"];
}


来源:https://stackoverflow.com/questions/17755778/how-to-obtain-a-list-of-workspaces-using-rally-rest-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!