

终止支持通知：2025年9月15日， AWS 我们将停止对Amazon Lex V1的支持。2025 年 9 月 15 日之后，您将无法再访问 Amazon Lex V1 控制台或 Amazon Lex V1 资源。如果您使用的是 Amazon Lex V2，请改为参阅 [Amazon Lex V2 指南](https://docs.aws.amazon.com/lexv2/latest/dg/what-is.html)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# GetUtterancesView
<a name="API_GetUtterancesView"></a>

使用 `GetUtterancesView` 操作来获取有关您的用户对您的机器人所说言语的信息。您可以使用这个列表来调整您的机器人响应的言语。

例如，假设您创建了一个机器人来订花。在您的用户使用您的机器人一段时间后，使用 `GetUtterancesView` 操作查看他们发出的请求以及请求是否成功。您可能会发现“我想要花”这句话没有被识别。您可以将这个言语添加到 `OrderFlowers` 意图中，这样您的机器人就能识别出这个言语。

发布新版本的机器人后，您可以获取有关旧版本和新版本的信息，以便比较两个版本的性能。

表达统计数据每天生成一次。可查询过去 15 天的数据。在每次请求中，您最多可以请求 5 个版本的机器人的信息。Amazon Lex 会返回该机器人在过去 15 天内收到的最频繁的言语。响应包含有关每个版本最多 100 句言语的信息。

在以下条件下，系统不会生成言语统计数据：
+ 创建机器人时，`childDirected` 字段设置为 True。
+ 您正在对一个或多个插槽使用插槽混淆处理。
+ 您已选择退出 Amazon Lex 改进计划。

此操作需要 `lex:GetUtterancesView` 操作的权限。

## 请求语法
<a name="API_GetUtterancesView_RequestSyntax"></a>

```
GET /bots/botname/utterances?view=aggregation&bot_versions=botVersions&status_type=statusType HTTP/1.1
```

## URI 请求参数
<a name="API_GetUtterancesView_RequestParameters"></a>

请求使用以下 URI 参数。

 ** [botname](#API_GetUtterancesView_RequestSyntax) **   <a name="lex-GetUtterancesView-request-uri-botName"></a>
应返回其言语信息的机器人的名称。  
长度限制：最小长度为 2。最大长度为 50。  
模式：`^([A-Za-z]_?)+$`  
是否必需：是

 ** [botVersions](#API_GetUtterancesView_RequestSyntax) **   <a name="lex-GetUtterancesView-request-uri-botVersions"></a>
应返回其言语信息的机器人版本的数组。每个请求的限制为 5 个版本。  
数组成员：最少 1 个物品。最多 5 项。  
长度限制：最小长度为 1。长度上限为 64。  
模式：`\$LATEST|[0-9]+`  
是否必需：是

 ** [statusType](#API_GetUtterancesView_RequestSyntax) **   <a name="lex-GetUtterancesView-request-uri-statusType"></a>
要返回已识别且已处理的言语，请使用 `Detected`。要返回未识别的言语，请使用 `Missed`。  
有效值：`Detected | Missed`  
是否必需：是

## 请求体
<a name="API_GetUtterancesView_RequestBody"></a>

该请求没有请求正文。

## 响应语法
<a name="API_GetUtterancesView_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "botName": "string",
   "utterances": [ 
      { 
         "botVersion": "string",
         "utterances": [ 
            { 
               "count": number,
               "distinctUsers": number,
               "firstUtteredDate": number,
               "lastUtteredDate": number,
               "utteranceString": "string"
            }
         ]
      }
   ]
}
```

## 响应元素
<a name="API_GetUtterancesView_ResponseElements"></a>

如果此操作成功，则该服务将会发送回 HTTP 200 响应。

服务以 JSON 格式返回以下数据。

 ** [botName](#API_GetUtterancesView_ResponseSyntax) **   <a name="lex-GetUtterancesView-response-botName"></a>
要返回其言语信息的机器人的名称。  
类型：字符串  
长度限制：最小长度为 2。最大长度为 50。  
模式：`^([A-Za-z]_?)+$`

 ** [utterances](#API_GetUtterancesView_ResponseSyntax) **   <a name="lex-GetUtterancesView-response-utterances"></a>
[UtteranceList](API_UtteranceList.md) 对象数组，每个对象都包含描述机器人已处理的言语的 [UtteranceData](API_UtteranceData.md) 对象列表。每个版本的响应最多包含 100 个 `UtteranceData` 对象。Amazon Lex 会返回该机器人在过去 15 天内收到的最频繁的言语。  
类型：[UtteranceList](API_UtteranceList.md) 对象数组

## 错误
<a name="API_GetUtterancesView_Errors"></a>

 ** BadRequestException **   
请求格式不正确。例如，值无效或必填字段未填充。检查字段值，然后重试。  
HTTP 状态代码：400

 ** InternalFailureException **   
出现内部 Amazon Lex 错误。请再次尝试您的请求。  
HTTP 状态代码：500

 ** LimitExceededException **   
请求超出了限制。请再次尝试您的请求。  
HTTP 状态代码：429

## 另请参阅
<a name="API_GetUtterancesView_SeeAlso"></a>

有关以特定语言之一使用此 API 的更多信息 AWS SDKs，请参阅以下内容：
+  [AWS 命令行界面 V2](https://docs.aws.amazon.com/goto/cli2/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS 适用于.NET 的 SDK V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS 适用于 C\$1\$1 的 SDK](https://docs.aws.amazon.com/goto/SdkForCpp/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS 适用于 Go v2 的 SDK](https://docs.aws.amazon.com/goto/SdkForGoV2/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS 适用于 Java 的 SDK V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS JavaScript V3 版 SDK](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS 适用于 Kotlin 的 SDK](https://docs.aws.amazon.com/goto/SdkForKotlin/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS 适用于 PHP 的 SDK V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS Python 软件开发工具包](https://docs.aws.amazon.com/goto/boto3/lex-models-2017-04-19/GetUtterancesView) 
+  [AWS 适用于 Ruby V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForRubyV3/lex-models-2017-04-19/GetUtterancesView) 