- list - List departments
List the departments in the Glean directory, ordered by display_name and then by department_id. A department is active when at least one active user belongs to it. A department is inactive when only inactive users, such as former employees, belong to it, or when only a usage limit names it. Inactive departments are left out unless an is_active filter includes the value "false". Department names are exact, so names that differ only by case are different departments.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
import com.glean.api_client.glean_api_client.models.operations.PlatformDepartmentsListResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws PlatformProblemDetailException, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PlatformDepartmentsListResponse res = sdk.departments().list()
.pageSize(50L)
.call();
if (res.platformListDepartmentsResponse().isPresent()) {
System.out.println(res.platformListDepartmentsResponse().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
pageSize |
Optional<Long> | ➖ | Maximum number of departments to return. Defaults to 50. Maximum is 100. |
cursor |
Optional<String> | ➖ | Opaque pagination cursor from a previous response. Send the same filters that the previous request used. |
filters |
List<PlatformDepartmentFilter> | ➖ | JSON-encoded filters that choose which departments are returned. The only supported field is is_active, with the values "true" and "false" and the operator EQUALS. Multiple values OR within a filter. Multiple filters AND together. Without an is_active filter, only active departments are returned. To return active and inactive departments, send [{"field":"is_active","values":["true","false"]}]. |
PlatformDepartmentsListResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/PlatformProblemDetailException | 400, 401, 403, 404, 408, 429 | application/problem+json |
| models/errors/PlatformProblemDetailException | 500, 503 | application/problem+json |
| models/errors/APIException | 4XX, 5XX | */* |