如何获取用户在Java rest中拥有权限的工作空间
我需要使用RallyJavaRESTAPI获取用户可以访问的工作区列表如何获取用户在Java rest中拥有权限的工作空间,java,rest,rally,Java,Rest,Rally,我需要使用RallyJavaRESTAPI获取用户可以访问的工作区列表 提前感谢获取当前订阅并在获取中包含工作区。您可能还希望包括名称和状态 GetRequest getRequest = new GetRequest("/subscription"); getRequest.setFetch("Workspaces", "Name", "State"); GetResponse getResponse = restApi.get(getRequest); JsonObject subscri
提前感谢获取当前订阅并在获取中包含工作区。您可能还希望包括名称和状态
GetRequest getRequest = new GetRequest("/subscription");
getRequest.setFetch("Workspaces", "Name", "State");
GetResponse getResponse = restApi.get(getRequest);
JsonObject subscription = getResponse.getSubscription();
JsonArray workspaces = subscription.getAsJsonArray("Workspaces");
for (JsonElement w : workspaces) {
JsonObject workspace = w.getAsJsonObject();
System.out.println(String.format("\t%s: %s",
workspace.get("Name").getAsString(),
workspace.get("State").getAsString());
}
请注意,这仅适用于WSAPI 1.x版本,因为在WSAPI 2.x中不会返回子集合(如工作区)。相同的基本概念在2.x中也适用,但需要额外的请求才能从订阅中读取工作空间集合