//Below code would return the list of Workspaces
private List<String> getWorkSpaceReferences() throws IOException {
List<String> workSpaceRefArray = new ArrayList<String>();
// Get Subscription Response
JsonObject subscriptionObject = getSubScriptionResponse();
// From the workspaces get all workspaces
JsonElement workSpaces = subscriptionObject.get("Workspaces");
// Check if the subscription contains multiple projects which are
// returned as an array
if (workSpaces.isJsonArray()) {
// TODO
} else {
// Get the single workspace
JsonObject myWorkspaceObject = workSpaces.getAsJsonObject();
JsonObject workspaceObject = myWorkspaceObject.getAsJsonObject();
// Get the workspace reference
String workspaceRef = workspaceObject.get("_ref").getAsString();
workSpaceRefArray.add(workspaceRef);
}
return workSpaceRefArray;
}
No comments:
Post a Comment