Skip to content

batch_update_case

batch_update_case(
    domain_id: DomainId,
    cases: BatchUpdateCaseIdentifierList,
    fields: FieldValueInputList,
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    performed_by: Optional[UserUnion] = None,
    title: Optional[CaseTitle] = None,
    status: Optional[CaseStatus] = None,
    customer_id: Optional[CustomerProfileArn] = None,
    client_token: Optional[str] = None,
) -> BatchUpdateCaseResponse

Updates fields on multiple cases in a single request. All cases must belong to the same domain. Set the title, status, and customer ID through the top-level title, status, and customerId parameters, and set other fields through the fields array.

Each case is processed independently. If some cases fail, the remaining cases are still updated. To determine whether individual cases failed, inspect the failedCases array in the response.

The entire request fails, and no cases are updated, 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 request doesn't specify any update. Provide at least one entry in fields, or a title, status, or customerId.

  • A field identifier in fields doesn't resolve to a field in the domain, for example, an unknown field name.

  • A field name contains a pipe (|) or comma (,) character.

  • fields includes title, status, or customerId.

This operation uses the same IAM action as UpdateCase (cases:UpdateCase). 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.

  • cases (BatchUpdateCaseIdentifierList) –

    The list of cases to update. All cases must belong to the same domain.

  • fields (FieldValueInputList) –

    An array of objects, each with a fieldIdentifier and a value. You can identify each field by its ID or by its name; identifying a field by name is supported only in BatchUpdateCase. The same field values are applied to every case in the request. This field must be present, but can be an empty list when you provide the top-level title, status, or customerId parameters. Do not include title, status, or customerId in this list; set those values only through their top-level parameters. Duplicating them in fields results in a validation error.

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

    The entity that performed the action.

  • title (Optional[CaseTitle], default: None ) –

    The title to apply to all cases in the request.

  • status (Optional[CaseStatus], default: None ) –

    The status to apply to all cases in the request.

  • customer_id (Optional[CustomerProfileArn], default: None ) –

    The ARN of the customer profile to associate with all cases in the request.

  • 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.

  • 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_update_case(
    self,
    domain_id: "capo_connectcases.types.domain_id.DomainId",
    cases: "capo_connectcases.types.batch_update_case_identifier_list.BatchUpdateCaseIdentifierList",
    fields: "capo_connectcases.types.field_value_input_list.FieldValueInputList",
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    performed_by: Optional["capo_connectcases.types.user_union.UserUnion"] = None,
    title: Optional["capo_connectcases.types.case_title.CaseTitle"] = None,
    status: Optional["capo_connectcases.types.case_status.CaseStatus"] = None,
    customer_id: Optional[
        "capo_connectcases.types.customer_profile_arn.CustomerProfileArn"
    ] = None,
    client_token: Optional[str] = None,
) -> "capo_connectcases.types.batch_update_case_response.BatchUpdateCaseResponse":
    """<p>Updates fields on multiple cases in a single request. All cases must belong to the same domain. Set the title, status, and customer ID through the top-level <code>title</code>, <code>status</code>, and <code>customerId</code> parameters, and set other fields through the <code>fields</code> array.</p> <p>Each case is processed independently. If some cases fail, the remaining cases are still updated. To determine whether individual cases failed, inspect the <code>failedCases</code> array in the response.</p> <p>The entire request fails, and no cases are updated, 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 request doesn't specify any update. Provide at least one entry in <code>fields</code>, or a <code>title</code>, <code>status</code>, or <code>customerId</code>.</p> </li> <li> <p>A field identifier in <code>fields</code> doesn't resolve to a field in the domain, for example, an unknown field name.</p> </li> <li> <p>A field name contains a pipe (<code>|</code>) or comma (<code>,</code>) character.</p> </li> <li> <p> <code>fields</code> includes <code>title</code>, <code>status</code>, or <code>customerId</code>.</p> </li> </ul> <note> <p>This operation uses the same IAM action as <a href="https://docs.aws.amazon.com/cases/latest/APIReference/API_UpdateCase.html">UpdateCase</a> (<code>cases:UpdateCase</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>
        cases: <p>The list of cases to update. All cases must belong to the same domain.</p>
        fields: <p>An array of objects, each with a <code>fieldIdentifier</code> and a <code>value</code>. You can identify each field by its ID or by its name; identifying a field by name is supported only in <code>BatchUpdateCase</code>. The same field values are applied to every case in the request. This field must be present, but can be an empty list when you provide the top-level <code>title</code>, <code>status</code>, or <code>customerId</code> parameters. Do not include <code>title</code>, <code>status</code>, or <code>customerId</code> in this list; set those values only through their top-level parameters. Duplicating them in <code>fields</code> results in a validation error.</p>
        performed_by: <p>The entity that performed the action.</p>
        title: <p>The title to apply to all cases in the request.</p>
        status: <p>The status to apply to all cases in the request.</p>
        customer_id: <p>The ARN of the customer profile to associate with all cases in the request.</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.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_update_case_request.BatchUpdateCaseRequest]",
    ) -> OperationResponse[
        "capo_connectcases.types.batch_update_case_response.BatchUpdateCaseResponse"
    ]:
        import capo_connectcases._operations.amazon_connect_cases.batch_update_case

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

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

        return capo_connectcases.types.batch_update_case_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("BatchUpdateCase", redact_input=_redact_input),
    )
    input_: capo_connectcases.types.batch_update_case_request.BatchUpdateCaseRequest = {
        "domain_id": domain_id,
        "cases": cases,
        "fields": fields,
    }
    if performed_by is not None:
        input_["performed_by"] = performed_by
    if title is not None:
        input_["title"] = title
    if status is not None:
        input_["status"] = status
    if customer_id is not None:
        input_["customer_id"] = customer_id
    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