aws lex bot api

0

when I tried to deal with aws lex bot api, I created a bot using aws console and it's wokring fine and face no probelm; but when I tried to use the aws api I got this error : { "message": "INVALID_REQUEST - Invalid bot name or alias" } I used this params into my api : https://runtime.lex.us-east-1.amazonaws.com/bot/botname/alias/aliasname/user/useid/text

I want to know if the probelm is related to the bot verison ? the botname and the aliasname are correct

2 回答
1
已接受的回答

Hi,

Looks like you are not using Lex V2 endpoint (https://runtime-v2-lex.us-east-1.amazonaws.com/bot/botname/alias/aliasname/user/userid/text) as expected. In order to access Lex V2 Recognize Text API, you need to send a post request to the endpoint https://runtime-v2-lex.us-east-1.amazonaws.com//bots/botId/botAliases/botAliasId/botLocales/localeId/sessions/sessionId/text. I would recommend following this documentation closely to hit RecognizeText API through postman or any other http client.

Another option is to AWS CLI.

Sample command to hit RecognizeText API

aws lexv2-runtime recognize-text --bot-id “7TBXBYVXOE” --bot-alias-id “TSTALIASID” --locale-id “en_US” --session-id “test_123” --region us-east-1 --text “book hotel”

Related AWS CLI documentation can be found here

AWS
Satish
已回答 1 年前
  • thanks so much, your response is the correct one

0

Hi,

One possibility is you may have created the bot using Lex V2 console which is the default interface for creating bots. And you are trying to access this bot through Lex V1 runtime APIs (https://runtime.lex.us-east-1.amazonaws.com/bot/botname/alias/aliasname/user/useid/text). Can you please try using Lex V2 runtime endpoint as documented here.

AWS
Satish
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则