CreateContentCommand

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

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { QConnectClient, CreateContentCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, CreateContentCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // CreateContentRequest
  knowledgeBaseId: "STRING_VALUE", // required
  name: "STRING_VALUE", // required
  title: "STRING_VALUE",
  overrideLinkOutUri: "STRING_VALUE",
  metadata: { // ContentMetadata
    "<keys>": "STRING_VALUE",
  },
  uploadId: "STRING_VALUE", // required
  clientToken: "STRING_VALUE",
  tags: { // Tags
    "<keys>": "STRING_VALUE",
  },
};
const command = new CreateContentCommand(input);
const response = await client.send(command);
// { // CreateContentResponse
//   content: { // ContentData
//     contentArn: "STRING_VALUE", // required
//     contentId: "STRING_VALUE", // required
//     knowledgeBaseArn: "STRING_VALUE", // required
//     knowledgeBaseId: "STRING_VALUE", // required
//     name: "STRING_VALUE", // required
//     revisionId: "STRING_VALUE", // required
//     title: "STRING_VALUE", // required
//     contentType: "STRING_VALUE", // required
//     status: "STRING_VALUE", // required
//     metadata: { // ContentMetadata // required
//       "<keys>": "STRING_VALUE",
//     },
//     tags: { // Tags
//       "<keys>": "STRING_VALUE",
//     },
//     linkOutUri: "STRING_VALUE",
//     url: "STRING_VALUE", // required
//     urlExpiry: new Date("TIMESTAMP"), // required
//   },
// };

CreateContentCommand Input

See CreateContentCommandInput for more details

Parameter
Type
Description
knowledgeBaseId
Required
string | undefined

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
Required
string | undefined

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.

uploadId
Required
string | undefined

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

clientToken
string | undefined

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 .

metadata
Record<string, string> | undefined

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.

overrideLinkOutUri
string | undefined

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.

tags
Record<string, string> | undefined

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

title
string | undefined

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

CreateContentCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
content
ContentData | undefined

The content.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient access to perform this action.

ConflictException
client

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
client

The specified resource does not exist.

ServiceQuotaExceededException
client

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.

ValidationException
client

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

QConnectServiceException
Base exception class for all service exceptions from QConnect service.