Skip to content

Instantly share code, notes, and snippets.

Last active April 16, 2019 16:01
What would you like to do?
Returns the list of active Projects available in SDL WorldServer using the REST API
public class Project {
private int id;
private int projectGroupId;
private String name;
private String description;
public int getId() {
return id;
public void setId(int id) { = id;
public int getProjectGroupId() {
return projectGroupId;
public void setProjectGroupId(int projectGroupId) {
this.projectGroupId = projectGroupId;
public String getName() {
return name;
public void setName(String name) { = name;
public String getDescription() {
return description;
public void setDescription(String description) {
this.description = description;
public static List<Project> getActiveProjects(String wsBaseUrl, String token) throws IOException, URISyntaxException {
List<Project> activeProjects = new ArrayList<>();
URI getUri = new URIBuilder(wsBaseUrl + "/ws-api/v1/projects")
.addParameter("token", token)
.addParameter("onlyActive", "true")
JsonObject jsonObject = getItems(getUri);
JsonArray items = jsonObject.getAsJsonArray("items");
Iterator<JsonElement> itemIterator = items.iterator();
while (itemIterator.hasNext()) {
JsonObject item =;
Project project = new Project();
return activeProjects;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment