Skip to content

create_content

create_content(
    knowledge_base_id: UuidOrArn,
    name: Name,
    upload_id: UploadId,
    *,
    config_overrides: Optional[QConnectClientConfig] = None,
    title: Optional[ContentTitle] = None,
    override_link_out_uri: Optional[Uri] = None,
    metadata: Optional[ContentMetadata] = None,
    client_token: Optional[NonEmptyString] = None,
    tags: Optional[Tags] = None,
) -> CreateContentResponse

Creates Amazon Q in Connect content. Before to calling this API, use StartContentUpload to upload an asset.

Parameters:

  • knowledge_base_id (UuidOrArn) –

    The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.

  • name (Name) –

    The name of the content. Each piece of content in a knowledge base must have a unique name. You can retrieve a piece of content using only its knowledge base and its name with the SearchContent API.

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

    The title of the content. If not set, the title is equal to the name.

  • override_link_out_uri (Optional[Uri], default: None ) –

    The URI you want to use for the article. If the knowledge base has a templateUri, setting this argument overrides it for this piece of content.

  • metadata (Optional[ContentMetadata], default: None ) –

    A key/value map to store attributes without affecting tagging or recommendations. For example, when synchronizing data between an external system and Amazon Q in Connect, you can store an external version identifier as metadata to utilize for determining drift.

  • upload_id (UploadId) –

    A pointer to the uploaded asset. This value is returned by StartContentUpload.

  • client_token (Optional[NonEmptyString], 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[Tags], default: None ) –

    The tags used to organize, track, or control access for this resource.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The request could not be processed because of conflict in the current state of the resource. For example, if you're using a Create API (such as CreateAssistant) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • ServiceQuotaExceededException –

    You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.

  • UnauthorizedException –

    You do not have permission to perform this action.

  • ValidationException –

    The input fails to satisfy the constraints specified by a service.

  • UnknownServiceError –

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

Source code in docs_src/capo_qconnect/_services/q_connect.py
def create_content(
    self,
    knowledge_base_id: "capo_qconnect.types.uuid_or_arn.UuidOrArn",
    name: "capo_qconnect.types.name.Name",
    upload_id: "capo_qconnect.types.upload_id.UploadId",
    *,
    config_overrides: Optional[QConnectClientConfig] = None,
    title: Optional["capo_qconnect.types.content_title.ContentTitle"] = None,
    override_link_out_uri: Optional["capo_qconnect.types.uri.Uri"] = None,
    metadata: Optional[
        "capo_qconnect.types.content_metadata.ContentMetadata"
    ] = None,
    client_token: Optional[
        "capo_qconnect.types.non_empty_string.NonEmptyString"
    ] = None,
    tags: Optional["capo_qconnect.types.tags.Tags"] = None,
) -> "capo_qconnect.types.create_content_response.CreateContentResponse":
    """<p>Creates Amazon Q in Connect content. Before to calling this API, use <a href="https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_StartContentUpload.html">StartContentUpload</a> to upload an asset.</p>

    Args:
        knowledge_base_id: <p>The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
        name: <p>The name of the content. Each piece of content in a knowledge base must have a unique name. You can retrieve a piece of content using only its knowledge base and its name with the <a href="https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_SearchContent.html">SearchContent</a> API.</p>
        title: <p>The title of the content. If not set, the title is equal to the name.</p>
        override_link_out_uri: <p>The URI you want to use for the article. If the knowledge base has a templateUri, setting this argument overrides it for this piece of content.</p>
        metadata: <p>A key/value map to store attributes without affecting tagging or recommendations. For example, when synchronizing data between an external system and Amazon Q in Connect, you can store an external version identifier as metadata to utilize for determining drift.</p>
        upload_id: <p>A pointer to the uploaded asset. This value is returned by <a href="https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_StartContentUpload.html">StartContentUpload</a>.</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="http://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
        tags: <p>The tags used to organize, track, or control access for this resource.</p>

    Raises:
        capo_qconnect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_qconnect.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource. For example, if you're using a <code>Create</code> API (such as <code>CreateAssistant</code>) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.</p>
        capo_qconnect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_qconnect.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.</p>
        capo_qconnect.errors.unauthorized_exception.UnauthorizedException: <p>You do not have permission to perform this action.</p>
        capo_qconnect.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by a service.</p>
        capo_qconnect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_qconnect.types.create_content_request.CreateContentRequest]",
    ) -> OperationResponse[
        "capo_qconnect.types.create_content_response.CreateContentResponse"
    ]:
        import capo_qconnect._operations.wisdom_service.create_content

        output, http_response = (
            capo_qconnect._operations.wisdom_service.create_content.create_content(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_qconnect.types.create_content_response.CreateContentResponse",
    ) -> dict[str, Any]:
        import capo_qconnect.types.create_content_response

        return capo_qconnect.types.create_content_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateContent", redact_output=_redact_output),
    )
    input_: capo_qconnect.types.create_content_request.CreateContentRequest = {
        "knowledge_base_id": knowledge_base_id,
        "name": name,
        "upload_id": upload_id,
    }
    if title is not None:
        input_["title"] = title
    if override_link_out_uri is not None:
        input_["override_link_out_uri"] = override_link_out_uri
    if metadata is not None:
        input_["metadata"] = metadata
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    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