Skip to content

create_case

create_case(
    domain_id: DomainId,
    template_id: TemplateId,
    fields: FieldValueList,
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    client_token: Optional[str] = None,
    performed_by: Optional[UserUnion] = None,
    tags: Optional[MutableTags] = None,
) -> CreateCaseResponse

If you provide a value for PerformedBy.UserArn you must also have connect:DescribeUser permission on the User ARN resource that you provide

Creates a case in the specified Cases domain. Case system and custom fields are taken as an array id/value pairs with a declared data types.

When creating a case from a template that has tag propagation configurations, the specified tags are automatically applied to the case.

The following fields are required when creating a case:

  • customer_id - You must provide the full customer profile ARN in this format: arn:aws:profile:your_AWS_Region:your_AWS_account ID:domains/your_profiles_domain_name/profiles/profile_ID

  • title

Parameters:

  • domain_id (DomainId) –

    The unique identifier of the Cases domain.

  • template_id (TemplateId) –

    A unique identifier of a template.

  • fields (FieldValueList) –

    An array of objects with field ID (matching ListFields/DescribeField) and value union data.

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

  • tags (Optional[MutableTags], default: None ) –

    A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.

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 create_case(
    self,
    domain_id: "capo_connectcases.types.domain_id.DomainId",
    template_id: "capo_connectcases.types.template_id.TemplateId",
    fields: "capo_connectcases.types.field_value_list.FieldValueList",
    *,
    config_overrides: Optional[ConnectCasesClientConfig] = None,
    client_token: Optional[str] = None,
    performed_by: Optional["capo_connectcases.types.user_union.UserUnion"] = None,
    tags: Optional["capo_connectcases.types.mutable_tags.MutableTags"] = None,
) -> "capo_connectcases.types.create_case_response.CreateCaseResponse":
    """<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">connect:DescribeUser</a> permission on the User ARN resource that you provide</p> </note> <p>Creates a case in the specified Cases domain. Case system and custom fields are taken as an array id/value pairs with a declared data types.</p> <p>When creating a case from a template that has tag propagation configurations, the specified tags are automatically applied to the case.</p> <p>The following fields are required when creating a case:</p> <ul> <li> <p> <code>customer_id</code> - You must provide the full customer profile ARN in this format: <code>arn:aws:profile:your_AWS_Region:your_AWS_account ID:domains/your_profiles_domain_name/profiles/profile_ID</code> </p> </li> <li> <p> <code>title</code> </p> </li> </ul>

    Args:
        domain_id: <p>The unique identifier of the Cases domain. </p>
        template_id: <p>A unique identifier of a template.</p>
        fields: <p>An array of objects with field ID (matching ListFields/DescribeField) and value union data.</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>
        tags: <p>A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.</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.create_case_request.CreateCaseRequest]",
    ) -> OperationResponse[
        "capo_connectcases.types.create_case_response.CreateCaseResponse"
    ]:
        import capo_connectcases._operations.amazon_connect_cases.create_case

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

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

        return capo_connectcases.types.create_case_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCase", redact_input=_redact_input)
    )
    input_: capo_connectcases.types.create_case_request.CreateCaseRequest = {
        "domain_id": domain_id,
        "template_id": template_id,
        "fields": fields,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if performed_by is not None:
        input_["performed_by"] = performed_by
    if tags is not None:
        input_["tags"] = tags

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