GetBotVersionsCommand

Gets information about all of the versions of a bot.

The GetBotVersions operation returns a BotMetadata object for each version of a bot. For example, if a bot has three numbered versions, the GetBotVersions operation returns four BotMetadata objects in the response, one for each numbered version and one for the $LATEST version.

The GetBotVersions operation always returns at least one version, the $LATEST version.

This operation requires permissions for the lex:GetBotVersions action.

Example Syntax

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

import { LexModelBuildingServiceClient, GetBotVersionsCommand } from "@aws-sdk/client-lex-model-building-service"; // ES Modules import
// const { LexModelBuildingServiceClient, GetBotVersionsCommand } = require("@aws-sdk/client-lex-model-building-service"); // CommonJS import
const client = new LexModelBuildingServiceClient(config);
const input = { // GetBotVersionsRequest
  name: "STRING_VALUE", // required
  nextToken: "STRING_VALUE",
  maxResults: Number("int"),
};
const command = new GetBotVersionsCommand(input);
const response = await client.send(command);
// { // GetBotVersionsResponse
//   bots: [ // BotMetadataList
//     { // BotMetadata
//       name: "STRING_VALUE",
//       description: "STRING_VALUE",
//       status: "BUILDING" || "READY" || "READY_BASIC_TESTING" || "FAILED" || "NOT_BUILT",
//       lastUpdatedDate: new Date("TIMESTAMP"),
//       createdDate: new Date("TIMESTAMP"),
//       version: "STRING_VALUE",
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

GetBotVersionsCommand Input

See GetBotVersionsCommandInput for more details

Parameter
Type
Description
name
Required
string | undefined

The name of the bot for which versions should be returned.

maxResults
number | undefined

The maximum number of bot versions to return in the response. The default is 10.

nextToken
string | undefined

A pagination token for fetching the next page of bot versions. If the response to this call is truncated, Amazon Lex returns a pagination token in the response. To fetch the next page of versions, specify the pagination token in the next request.

GetBotVersionsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
bots
BotMetadata[] | undefined

An array of BotMetadata objects, one for each numbered version of the bot plus one for the $LATEST version.

nextToken
string | undefined

A pagination token for fetching the next page of bot versions. If the response to this call is truncated, Amazon Lex returns a pagination token in the response. To fetch the next page of versions, specify the pagination token in the next request.

Throws

Name
Fault
Details
BadRequestException
client

The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and try again.

InternalFailureException
server

An internal Amazon Lex error occurred. Try your request again.

LimitExceededException
client

The request exceeded a limit. Try your request again.

NotFoundException
client

The resource specified in the request was not found. Check the resource and try again.

LexModelBuildingServiceServiceException
Base exception class for all service exceptions from LexModelBuildingService service.