Skip to content

batch_create_related_item

batch_create_related_item(
    domain_id: DomainId,
    content: RelatedItemInputContent,
    cases: BatchCreateRelatedItemIdentifierList,
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    performed_by: Optional[UserUnion] = None,
    client_token: Optional[str] = None,
) -> BatchCreateRelatedItemResponse

Creates a comment and associates it with multiple cases in a single request. All cases must belong to the same domain. This operation supports only the Comment related item type.

Each case is processed independently. If some cases fail, the remaining cases still receive the related item. To determine whether individual items failed, inspect the failedItems array in the response.

The entire request fails, and no related items are created, in the following cases:

  • The specified domain doesn't exist.

  • A reference ID doesn't match any case in the domain.

  • The request contains duplicate case IDs.

  • The content isn't comment content.

This operation uses the same IAM action as CreateRelatedItem (cases:CreateRelatedItem). You can use the cases:IsBatchAction condition key in IAM policies to allow or deny batch operations independently from single-case operations.

If you provide a value for performedBy.userArn, you must also have DescribeUser permission on the ARN of the user that you provide.

Endpoints: See Connect Customer endpoints and quotas.

Parameters:

  • domain_id (DomainId) –

    The unique identifier of the Cases domain.

  • content (RelatedItemInputContent) –

    The content of the related item to be created. The same content is applied to every case in the request. Only comment content is supported for batch creation.

  • cases (BatchCreateRelatedItemIdentifierList) –

    The list of cases to associate the related item with. All cases must belong to the same domain.

  • performed_by (Optional[UserUnion], default: None ) –

    The entity that created the related item.

  • client_token (Optional[str], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs.

    If you retry a request with the same client token, the service returns the original response instead of processing the request again. If you reuse a client token with different request parameters, the request fails with a ConflictException.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

  • InternalServerException –

    We couldn't process your request because of an issue with the server. Try again later.

  • ResourceNotFoundException –

    We couldn't find the requested resource. Check that your resources exists and were created in the same Amazon Web Services Region as your request, and try your request again.

  • ServiceQuotaExceededException –

    The service quota has been exceeded. For a list of service quotas, see Connect Customer Service Quotas in the Connect Customer Administrator Guide.

  • ThrottlingException –

    The rate has been exceeded for this API. Please try again after a few minutes.

  • ValidationException –

    The request isn't valid. Check the syntax and try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_connectcases/_services/connect_cases.py
def batch_create_related_item(
    self,
    domain_id: "capo_connectcases.types.domain_id.DomainId",
    content: "capo_connectcases.types.related_item_input_content.RelatedItemInputContent",
    cases: "capo_connectcases.types.batch_create_related_item_identifier_list.BatchCreateRelatedItemIdentifierList",
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    performed_by: Optional["capo_connectcases.types.user_union.UserUnion"] = None,
    client_token: Optional[str] = None,
) -> "capo_connectcases.types.batch_create_related_item_response.BatchCreateRelatedItemResponse":
    """<p>Creates a comment and associates it with multiple cases in a single request. All cases must belong to the same domain. This operation supports only the Comment related item type.</p> <p>Each case is processed independently. If some cases fail, the remaining cases still receive the related item. To determine whether individual items failed, inspect the <code>failedItems</code> array in the response.</p> <p>The entire request fails, and no related items are created, in the following cases:</p> <ul> <li> <p>The specified domain doesn't exist.</p> </li> <li> <p>A reference ID doesn't match any case in the domain.</p> </li> <li> <p>The request contains duplicate case IDs.</p> </li> <li> <p>The content isn't comment content.</p> </li> </ul> <note> <p>This operation uses the same IAM action as <a href="https://docs.aws.amazon.com/cases/latest/APIReference/API_CreateRelatedItem.html">CreateRelatedItem</a> (<code>cases:CreateRelatedItem</code>). You can use the <code>cases:IsBatchAction</code> condition key in IAM policies to allow or deny batch operations independently from single-case operations.</p> </note> <note> <p>If you provide a value for <code>performedBy.userArn</code>, you must also have <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribeUser.html">DescribeUser</a> permission on the ARN of the user that you provide.</p> </note> <p> <b>Endpoints</b>: See <a href="https://docs.aws.amazon.com/general/latest/gr/connect_region.html">Connect Customer endpoints and quotas</a>.</p>

    Args:
        domain_id: <p>The unique identifier of the Cases domain. </p>
        content: <p>The content of the related item to be created. The same content is applied to every case in the request. Only comment content is supported for batch creation.</p>
        cases: <p>The list of cases to associate the related item with. All cases must belong to the same domain.</p>
        performed_by: <p>The entity that created the related item.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p> <p>If you retry a request with the same client token, the service returns the original response instead of processing the request again. If you reuse a client token with different request parameters, the request fails with a <code>ConflictException</code>.</p>

    Raises:
        capo_connectcases.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_connectcases.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.</p>
        capo_connectcases.errors.internal_server_exception.InternalServerException: <p>We couldn't process your request because of an issue with the server. Try again later.</p>
        capo_connectcases.errors.resource_not_found_exception.ResourceNotFoundException: <p>We couldn't find the requested resource. Check that your resources exists and were created in the same Amazon Web Services Region as your request, and try your request again.</p>
        capo_connectcases.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota has been exceeded. For a list of service quotas, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html">Connect Customer Service Quotas</a> in the <i>Connect Customer Administrator Guide</i>.</p>
        capo_connectcases.errors.throttling_exception.ThrottlingException: <p>The rate has been exceeded for this API. Please try again after a few minutes.</p>
        capo_connectcases.errors.validation_exception.ValidationException: <p>The request isn't valid. Check the syntax and try again.</p>
        capo_connectcases.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_connectcases.types.batch_create_related_item_request.BatchCreateRelatedItemRequest]",
    ) -> OperationResponse[
        "capo_connectcases.types.batch_create_related_item_response.BatchCreateRelatedItemResponse"
    ]:
        import capo_connectcases._operations.amazon_connect_cases.batch_create_related_item

        output, http_response = (
            capo_connectcases._operations.amazon_connect_cases.batch_create_related_item.batch_create_related_item(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_connectcases.types.batch_create_related_item_request.BatchCreateRelatedItemRequest",
    ) -> dict[str, Any]:
        import capo_connectcases.types.batch_create_related_item_request

        return capo_connectcases.types.batch_create_related_item_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("BatchCreateRelatedItem", redact_input=_redact_input),
    )
    input_: capo_connectcases.types.batch_create_related_item_request.BatchCreateRelatedItemRequest = {
        "domain_id": domain_id,
        "content": content,
        "cases": cases,
    }
    if performed_by is not None:
        input_["performed_by"] = performed_by
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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