List the users in the Glean directory, ordered by display_name and then by user_id. The list includes the same people as the Glean People directory. Filter by name, email, manager_id, or department_id to find specific users. Use the returned user_id values with other Platform APIs, for example as usage limit targets.
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.PlatformUsersListResponse;
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();
PlatformUsersListResponse res = sdk.users().list()
.pageSize(50L)
.call();
if (res.platformListUsersResponse().isPresent()) {
System.out.println(res.platformListUsersResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
pageSize |
Optional<Long> |
➖ |
Maximum number of users 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<PlatformUserFilter> |
➖ |
JSON-encoded filters that choose which users are returned. The supported fields are name, email, manager_id, and department_id, each with the operator EQUALS. Multiple values OR within a filter. Multiple filters AND together. Each field may appear in only one filter. A value that matches no user, such as an unknown email or department_id, returns no users rather than an error.
|
include |
List<PlatformUserInclude> |
➖ |
Optional fields to add to each user. Each value only adds fields; it does not change which users are returned.
|
PlatformUsersListResponse
| 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 |
*/* |
Get one user in the Glean directory by user_id. The user can be any person that the list returns. A user_id that is not in the directory returns 404 resource_not_found. This includes a deleted user and a person that the People directory does not show. An alias ID of a merged person returns the person's canonical user_id.
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.PlatformUsersGetResponse;
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();
PlatformUsersGetResponse res = sdk.users().get()
.userId("{user_id}")
.call();
if (res.platformGetUserResponse().isPresent()) {
System.out.println(res.platformGetUserResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
Example |
userId |
String |
✔️ |
Canonical Glean user ID, as the list returns it. |
{user_id} |
include |
List<PlatformUserInclude> |
➖ |
Optional fields to add to the user. Each value only adds fields.
|
|
PlatformUsersGetResponse
| 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 |
*/* |