Skip to content

disassociate_faces

disassociate_faces(
    collection_id: CollectionId,
    user_id: UserId,
    face_ids: UserFaceIdList,
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
) -> DisassociateFacesResponse

Removes the association between a Face supplied in an array of FaceIds and the User. If the User is not present already, then a ResourceNotFound exception is thrown. If successful, an array of faces that are disassociated from the User is returned. If a given face is already disassociated from the given UserID, it will be ignored and not be returned in the response. If a given face is already associated with a different User or not found in the collection it will be returned as part of UnsuccessfulDisassociations. You can remove 1 - 100 face IDs from a user at one time.

Parameters:

  • collection_id (CollectionId) –

    The ID of an existing collection containing the UserID.

  • user_id (UserId) –

    ID for the existing UserID.

  • client_request_token (Optional[ClientRequestToken], default: None ) –

    Idempotent token used to identify the request to DisassociateFaces. If you use the same token with multiple DisassociateFaces requests, the same response is returned. Use ClientRequestToken to prevent the same request from being processed more than once.

  • face_ids (UserFaceIdList) –

    An array of face IDs to disassociate from the UserID.

Raises:

  • AccessDeniedException –

    You are not authorized to perform the action.

  • ConflictException –

    A User with the same Id already exists within the collection, or the update or deletion of the User caused an inconsistent state. **

  • IdempotentParameterMismatchException –

    A ClientRequestToken input parameter was reused with an operation, but at least one of the other input parameters is different from the previous call to the operation.

  • InternalServerError –

    Amazon Rekognition experienced a service issue. Try your call again.

  • InvalidParameterException –

    Input parameter violated a constraint. Validate your parameter before calling the API operation again.

  • ProvisionedThroughputExceededException –

    The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.

  • ResourceNotFoundException –

    The resource specified in the request cannot be found.

  • ThrottlingException –

    Amazon Rekognition is temporarily unable to process the request. Try your call again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

DisassociateFaces Removes the association between a Face supplied in an array of FaceIds and the User.

>>> client.disassociate_faces(collection_id='MyCollection', user_id='DemoUser', face_ids=['f5817d37-94f6-4335-bfee-6cf79a3d806e', 'c92265d4-5f9c-43af-a58e-12be0ce02bc3'], client_request_token='550e8400-e29b-41d4-a716-446655440003')
Source code in docs_src/capo_rekognition/_services/rekognition.py
def disassociate_faces(
    self,
    collection_id: "capo_rekognition.types.collection_id.CollectionId",
    user_id: "capo_rekognition.types.user_id.UserId",
    face_ids: "capo_rekognition.types.user_face_id_list.UserFaceIdList",
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
    client_request_token: Optional[
        "capo_rekognition.types.client_request_token.ClientRequestToken"
    ] = None,
) -> "capo_rekognition.types.disassociate_faces_response.DisassociateFacesResponse":
    """<p>Removes the association between a <code>Face</code> supplied in an array of <code>FaceIds</code> and the User. If the User is not present already, then a <code>ResourceNotFound</code> exception is thrown. If successful, an array of faces that are disassociated from the User is returned. If a given face is already disassociated from the given UserID, it will be ignored and not be returned in the response. If a given face is already associated with a different User or not found in the collection it will be returned as part of <code>UnsuccessfulDisassociations</code>. You can remove 1 - 100 face IDs from a user at one time.</p>

    Args:
        collection_id: <p>The ID of an existing collection containing the UserID.</p>
        user_id: <p>ID for the existing UserID.</p>
        client_request_token: <p>Idempotent token used to identify the request to <code>DisassociateFaces</code>. If you use the same token with multiple <code>DisassociateFaces</code> requests, the same response is returned. Use ClientRequestToken to prevent the same request from being processed more than once.</p>
        face_ids: <p>An array of face IDs to disassociate from the UserID. </p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.conflict_exception.ConflictException: <p> A User with the same Id already exists within the collection, or the update or deletion of the User caused an inconsistent state. ** </p>
        capo_rekognition.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>A <code>ClientRequestToken</code> input parameter was reused with an operation, but at least one of the other input parameters is different from the previous call to the operation.</p>
        capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
        capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
        capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
        capo_rekognition.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request cannot be found.</p>
        capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
        capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        DisassociateFaces
        Removes the association between a Face supplied in an array of FaceIds and the User.

        >>> client.disassociate_faces(collection_id='MyCollection', user_id='DemoUser', face_ids=['f5817d37-94f6-4335-bfee-6cf79a3d806e', 'c92265d4-5f9c-43af-a58e-12be0ce02bc3'], client_request_token='550e8400-e29b-41d4-a716-446655440003')
    """

    def _handler(
        req: "OperationRequest[capo_rekognition.types.disassociate_faces_request.DisassociateFacesRequest]",
    ) -> OperationResponse[
        "capo_rekognition.types.disassociate_faces_response.DisassociateFacesResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.disassociate_faces

        output, http_response = (
            capo_rekognition._operations.rekognition_service.disassociate_faces.disassociate_faces(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DisassociateFaces")
    )
    input_: capo_rekognition.types.disassociate_faces_request.DisassociateFacesRequest = {
        "collection_id": collection_id,
        "user_id": user_id,
        "face_ids": face_ids,
    }
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output