GenerateBotElement - Amazon Lex API Reference

GenerateBotElement

Generates sample utterances for an intent.

Request Syntax

POST /bots/botId/botversions/botVersion/botlocales/localeId/generate HTTP/1.1 Content-type: application/json { "intentId": "string" }

URI Request Parameters

The request uses the following URI parameters.

botId

The bot unique Id for the bot request to generate utterances.

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

Required: Yes

botVersion

The bot version for the bot request to generate utterances.

Length Constraints: Minimum length of 1. Maximum length of 5.

Pattern: ^(DRAFT|[0-9]+)$

Required: Yes

localeId

The unique locale Id for the bot request to generate utterances.

Required: Yes

Request Body

The request accepts the following data in JSON format.

intentId

The intent unique Id for the bot request to generate utterances.

Type: String

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

Required: Yes

Response Syntax

HTTP/1.1 202 Content-type: application/json { "botId": "string", "botVersion": "string", "intentId": "string", "localeId": "string", "sampleUtterances": [ { "utterance": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 202 response.

The following data is returned in JSON format by the service.

botId

The unique bot Id for the bot which received the response.

Type: String

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

botVersion

The unique bot version for the bot which received the response.

Type: String

Length Constraints: Fixed length of 5.

Pattern: ^DRAFT$

intentId

The unique intent Id for the bot which received the response.

Type: String

Length Constraints: Fixed length of 10.

Pattern: ^[0-9a-zA-Z]+$

localeId

The unique locale Id for the bot which received the response.

Type: String

sampleUtterances

The sample utterances for the bot which received the response.

Type: Array of SampleUtterance objects

Errors

For information about the errors that are common to all actions, see Common Errors.

ConflictException

The action that you tried to perform couldn't be completed because the resource is in a conflicting state. For example, deleting a bot that is in the CREATING state. Try your request again.

HTTP Status Code: 409

ConflictException

The action that you tried to perform couldn't be completed because the resource is in a conflicting state. For example, deleting a bot that is in the CREATING state. Try your request again.

HTTP Status Code: 409

InternalServerException

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

HTTP Status Code: 500

PreconditionFailedException

Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.

HTTP Status Code: 412

ResourceNotFoundException

You asked to describe a resource that doesn't exist. Check the resource that you are requesting and try again.

HTTP Status Code: 404

ServiceQuotaExceededException

You have reached a quota for your bot.

HTTP Status Code: 402

ThrottlingException

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

HTTP Status Code: 429

ValidationException

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

HTTP Status Code: 400

Examples

Example request

This example illustrates one usage of GenerateBotElement.

POST https://models-v2-lex.us-east-1.amazonaws.com/bots/BOT1234567/botversions/DRAFT/botlocales/en_US/generate Payload: { "intentId":"INTENT1234" }

Example response

This example illustrates one usage of GenerateBotElement.

{ "botId": "BOT1234567", "botVersion": "DRAFT", "intentId": "INTENT1234", "localeId": "en_US", "sampleUtterances": [{ "utterance": "I need to cancel my order {OrderId} due to {CancellationReason}" }, { "utterance": "Please cancel order {OrderId} as {CancellationReason}" }, { "utterance": "{OrderId} requires cancellation because of {CancellationReason}" }, { "utterance": "Cancel order {OrderId} . {CancellationReason}" }, { "utterance": "I have to cancel my order {OrderId} . The reason is {CancellationReason}" }] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: