You can use the ListUsers operation to list UserIds and the UserStatus. To see the FaceIDs that are associated with a UserID, use the ListFaces operation.
To list users (SDK)
-
If you haven't already:
-
Create or update a user with
AmazonRekognitionFullAccess
permissions. For more information, see Step 1: Set up an AWS account and create a User. -
Install and configure the AWS CLI and the AWS SDKs. For more information, see Step 2: Set up the AWS CLI and AWS SDKs.
-
-
Use the following examples to call the
ListUsers
operation.This Java example lists the users in a collection using the
ListUsers
operation.import java.util.List; import com.amazonaws.services.rekognition.AmazonRekognition; import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder; import com.amazonaws.services.rekognition.model.ListUsersRequest; import com.amazonaws.services.rekognition.model.ListUsersResult; import com.amazonaws.services.rekognition.model.User; public class ListUsers { public static void main(String[] args) throws Exception { AmazonRekognition amazonRekognition = AmazonRekognitionClientBuilder.defaultClient(); System.out.println("Listing users"); int limit = 10; ListUsersResult listUsersResult = null; String paginationToken = null; do { if (listUsersResult != null) { paginationToken = listUsersResult.getNextToken(); } ListUsersRequest request = new ListUsersRequest() .withCollectionId(collectionId) .withMaxResults(limit) .withNextToken(paginationToken); listUsersResult = amazonRekognition.listUsers(request); List<User> users = listUsersResult.getUsers(); for (User currentUser: users) { System.out.println(currentUser.getUserId() + " : " + currentUser.getUserStatus()); } } while (listUsersResult.getNextToken() != null); } }
ListUsers operation response
The response for a request to ListUsers includes a list of the Users
in the collection along with the UsedId
and UserStatus
of
the User.
{
"NextToken": "B1asJT3bAb/ttuGgPFV8BZoBZyGQzlUHXbuTNLh48a6enU7kXKw43hpOwizW7LOk/Gk7Em09lznoq6+FcDCcSq2olrn7A98BLkt5keu+ZRVRUTyrXtT6J7Hmp+ieQ2an6Zu0qzPfcdPeaJ9eAxG2d0WNrzJgi5hvmjoiSTTfKX3MQz1sduWQkvAAs4hZfhZoKFahFlqWofshCXa/FHAAY3PL1PjxXbkNeSSMq8V7i1MlKCdrPVykCv9MokpPt7jtNvKPEZGUhxgBTFMxNWLEcFnzAiCWDg91dFy/LalshPjXA9UVc5Gx9vIJNQ/eO3cQRghAkCT3FOAiXsLAnA015ODTomZpWWVpqB21wKpI3LYmfAVFrDPGzpbTVlRmLsJm41bkmnBBBw9+DHz1Jn7zW+qc5Fs3yaHu0f51Xg==",
"Users": [
{
"UserId": "demoUser4",
"UserStatus": "CREATED"
},
{
"UserId": "demoUser2",
"UserStatus": "CREATED"
}
]
}