ListSlotsCommand

Gets a list of slots that match the specified criteria.

Example Syntax

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

import { LexModelsV2Client, ListSlotsCommand } from "@aws-sdk/client-lex-models-v2"; // ES Modules import
// const { LexModelsV2Client, ListSlotsCommand } = require("@aws-sdk/client-lex-models-v2"); // CommonJS import
const client = new LexModelsV2Client(config);
const input = { // ListSlotsRequest
  botId: "STRING_VALUE", // required
  botVersion: "STRING_VALUE", // required
  localeId: "STRING_VALUE", // required
  intentId: "STRING_VALUE", // required
  sortBy: { // SlotSortBy
    attribute: "SlotName" || "LastUpdatedDateTime", // required
    order: "Ascending" || "Descending", // required
  },
  filters: [ // SlotFilters
    { // SlotFilter
      name: "SlotName", // required
      values: [ // FilterValues // required
        "STRING_VALUE",
      ],
      operator: "CO" || "EQ", // required
    },
  ],
  maxResults: Number("int"),
  nextToken: "STRING_VALUE",
};
const command = new ListSlotsCommand(input);
const response = await client.send(command);
// { // ListSlotsResponse
//   botId: "STRING_VALUE",
//   botVersion: "STRING_VALUE",
//   localeId: "STRING_VALUE",
//   intentId: "STRING_VALUE",
//   slotSummaries: [ // SlotSummaryList
//     { // SlotSummary
//       slotId: "STRING_VALUE",
//       slotName: "STRING_VALUE",
//       description: "STRING_VALUE",
//       slotConstraint: "Required" || "Optional",
//       slotTypeId: "STRING_VALUE",
//       valueElicitationPromptSpecification: { // PromptSpecification
//         messageGroups: [ // MessageGroupsList // required
//           { // MessageGroup
//             message: { // Message
//               plainTextMessage: { // PlainTextMessage
//                 value: "STRING_VALUE", // required
//               },
//               customPayload: { // CustomPayload
//                 value: "STRING_VALUE", // required
//               },
//               ssmlMessage: { // SSMLMessage
//                 value: "STRING_VALUE", // required
//               },
//               imageResponseCard: { // ImageResponseCard
//                 title: "STRING_VALUE", // required
//                 subtitle: "STRING_VALUE",
//                 imageUrl: "STRING_VALUE",
//                 buttons: [ // ButtonsList
//                   { // Button
//                     text: "STRING_VALUE", // required
//                     value: "STRING_VALUE", // required
//                   },
//                 ],
//               },
//             },
//             variations: [ // MessageVariationsList
//               {
//                 plainTextMessage: {
//                   value: "STRING_VALUE", // required
//                 },
//                 customPayload: {
//                   value: "STRING_VALUE", // required
//                 },
//                 ssmlMessage: {
//                   value: "STRING_VALUE", // required
//                 },
//                 imageResponseCard: {
//                   title: "STRING_VALUE", // required
//                   subtitle: "STRING_VALUE",
//                   imageUrl: "STRING_VALUE",
//                   buttons: [
//                     {
//                       text: "STRING_VALUE", // required
//                       value: "STRING_VALUE", // required
//                     },
//                   ],
//                 },
//               },
//             ],
//           },
//         ],
//         maxRetries: Number("int"), // required
//         allowInterrupt: true || false,
//         messageSelectionStrategy: "Random" || "Ordered",
//         promptAttemptsSpecification: { // PromptAttemptsSpecificationMap
//           "<keys>": { // PromptAttemptSpecification
//             allowInterrupt: true || false,
//             allowedInputTypes: { // AllowedInputTypes
//               allowAudioInput: true || false, // required
//               allowDTMFInput: true || false, // required
//             },
//             audioAndDTMFInputSpecification: { // AudioAndDTMFInputSpecification
//               startTimeoutMs: Number("int"), // required
//               audioSpecification: { // AudioSpecification
//                 maxLengthMs: Number("int"), // required
//                 endTimeoutMs: Number("int"), // required
//               },
//               dtmfSpecification: { // DTMFSpecification
//                 maxLength: Number("int"), // required
//                 endTimeoutMs: Number("int"), // required
//                 deletionCharacter: "STRING_VALUE", // required
//                 endCharacter: "STRING_VALUE", // required
//               },
//             },
//             textInputSpecification: { // TextInputSpecification
//               startTimeoutMs: Number("int"), // required
//             },
//           },
//         },
//       },
//       lastUpdatedDateTime: new Date("TIMESTAMP"),
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

ListSlotsCommand Input

See ListSlotsCommandInput for more details

Parameter
Type
Description
botId
Required
string | undefined

The identifier of the bot that contains the slot.

botVersion
Required
string | undefined

The version of the bot that contains the slot.

intentId
Required
string | undefined

The unique identifier of the intent that contains the slot.

localeId
Required
string | undefined

The identifier of the language and locale of the slots to list. The string must match one of the supported locales. For more information, see Supported languages .

filters
SlotFilter[] | undefined

Provides the specification of a filter used to limit the slots in the response to only those that match the filter specification. You can only specify one filter and only one string to filter on.

maxResults
number | undefined

The maximum number of slots to return in each page of results. If there are fewer results than the max page size, only the actual number of results are returned.

nextToken
string | undefined

If the response from the ListSlots operation contains more results than specified in the maxResults parameter, a token is returned in the response. Use that token in the nextToken parameter to return the next page of results.

sortBy
SlotSortBy | undefined

Determines the sort order for the response from the ListSlots operation. You can choose to sort by the slot name or last updated date in either ascending or descending order.

ListSlotsCommand Output

See ListSlotsCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
botId
string | undefined

The identifier of the bot that contains the slots.

botVersion
string | undefined

The version of the bot that contains the slots.

intentId
string | undefined

The identifier of the intent that contains the slots.

localeId
string | undefined

The language and locale of the slots in the list.

nextToken
string | undefined

A token that indicates whether there are more results to return in a response to the ListSlots operation. If the nextToken field is present, you send the contents as the nextToken parameter of a ListSlots operation request to get the next page of results.

slotSummaries
SlotSummary[] | undefined

Summary information for the slots that meet the filter criteria specified in the request. The length of the list is specified in the maxResults parameter of the request. If there are more slots available, the nextToken field contains a token to get the next page of results.

Throws

Name
Fault
Details
InternalServerException
server

The service encountered an unexpected condition. Try your request again.

ServiceQuotaExceededException
client

You have reached a quota for your bot.

ThrottlingException
client

Your request rate is too high. Reduce the frequency of requests.

ValidationException
client

One of the input parameters in your request isn't valid. Check the parameters and try your request again.

LexModelsV2ServiceException
Base exception class for all service exceptions from LexModelsV2 service.