
# 上报直播间事件 - LiveEventReport
#### 功能介绍
该接口用于上报直播间事件。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-metastudio/metastudio_02_0002.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-metastudio/metastudio_02_0071.html)。
#### URI
POST /v1/{project_id}/smart-live-rooms/{room_id}/smart-live-jobs/{job_id}/live-event-report
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                            |
|:---|:---|:---|:---|
| project_id | 是    | String | 项目ID，获取方法请参考[获取项目ID](https://support.huaweicloud.com/api-metastudio/metastudio_02_0006.html)。 |
| room_id    | 是    | String | 直播间ID。                                                                                        |
| job_id     | 是    | String | 任务ID。                                                                                         |
   
表2Query参数 
| 参数           | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                    |
|:---|:---|:---|:---|
| auth_key     | 否    | String  | 鉴权Key。通过HmacSHA256生成的鉴权key                                                                                                                                                                            |
| expires_time | 否    | Long    | 鉴权key过期时间。从1970年1月1日（UTC/GMT的午夜）开始所经过的毫秒数。 **取值范围：** 0\~4102415999000 |
| refresh_url  | 否    | Boolean | 是否刷新URL                                                                                                                                                                                               |
   
#### 请求参数
表3请求Header参数 
| 参数                 | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| X-Auth-Token       | 否    | String | 用户Token。使用Token鉴权方式时必选。 通过调用IAM服务获取用户Token接口获取。 响应消息头中X-Subject-Token的值。                                                                        |
| Authorization      | 否    | String | 使用AK/SK方式认证时必选，携带的鉴权信息。                                                                                                                                                                                                                                                         |
| X-Sdk-Date         | 否    | String | 使用AK/SK方式认证时必选，请求的发生时间。 格式为(YYYYMMDD'T'HHMMSS'Z')。                                                                                                                                                              |
| X-Project-Id       | 否    | String | 使用AK/SK方式认证时必选，携带项目ID信息。                                                                                                                                                                                                                                                        |
| X-App-UserId       | 否    | String | 第三方用户ID。不允许输入中文。                                                                                                                                                                                                                                                                |
| x-mss-auth-key     | 否    | String | 鉴权Key。通过HmacSHA256生成的鉴权key                                                                                                                                                                                                                                                      |
| x-mss-expires-time | 否    | Long   | **参数解释**： 鉴权key过期时间。从1970年1月1日（UTC/GMT的午夜）开始所经过的毫秒数。 **取值范围：** 0\~4102415999000 |
   
表4请求Body参数 
| 参数            | 是否必选 | 参数类型                                                                                           | 描述                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| total         | 是    | Integer                                                                                        | **参数解释**： 事件条目数。 **取值范围：** 1\~1000 |
| events        | 否    | Array of [LiveEvent] objects | 事件内容。                                                                                                                                                                                                                              |
| review_config | 否    | [ReviewConfig] object     | 内容审核配置                                                                                                                                                                                                                             |
   
 表5LiveEvent 
| 参数        | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|:---|:---|:---|:---|
| timestamp | 是    | Long    | **参数解释**： 事件戳。从1970-01-01 00:00:00:000开始的毫秒数 **取值范围：** 0\~4102415999000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| type      | 否    | Integer | **参数解释**： 事件类型。 - 1 弹幕信息   - 2 用户入场   - 3 用户点赞   - 4 用户送礼   - 5 用户订阅\\关注   - 6 房间观看人数    **取值范围：** 0\~100                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| content   | 否    | String  | 事件内容。 事件类型不同，content内容也不同，定义如下所示： - type=1 弹幕信息 - user:用户，json   - content: string,弹幕内容   - userId：用户id，string   - name：用户姓名，string   - level：用户平台等级，int   - badge：用户牌子名称，string   - badgeLevel：牌子等级，int    user定义： 举例： ``` { "timestamp": 1694481224245, "type": 1, "content": "{\"user\":{\"userId\":\"2027271526\",\"name\":\"***\",\"level\":17,\"badge\":\"\",\"badgeLevel\":0},\"content\":\"***\"}" } ```   - type=2 用户入场 - user:用户，json    举例： ``` { "timestamp": 1694481227655, "type": 2, "content": "{\"user\":{\"userId\":\"2978899271\",\"name\":\"***\",\"level\":1,\"badge\":\"\",\"badgeLevel\":0}}" } ```   - type=3 用户点赞 - user：用户，json    举例： ``` { "timestamp": 1694481227655, "type": 2, "content": "{\"user\":{\"userId\":\"2978899271\",\"name\":\"***\",\"level\":1,\"badge\":\"\",\"badgeLevel\":0}}" } ```   - type=4 用户送礼 - user：用户，json   - gift：礼物信息,json   - giftName：礼物名称，string   - giftNum：礼物数量，int   - totalValue：此处礼物总价值，int   - giftValue：单个礼物价值，int    gift定义： 举例： ``` { "timestamp": 1690531652862, "type": 4, "content": "{\"gift\":{\"giftName\":\"小星星\",\"giftNum\":10,\"totalValue\":10,\"giftValue\":3},\"user\":{\"userId\":\"douyin_95882940927\",\"name\":\"纯爱战士熙熙\",\"level\":2,\"badge\":\"\",\"badgeLevel\":0}}" } ```   - type=5 用户订阅   - type=6 房间观看人数 - numberOfViewers：房间观看人数，int    举例： ``` { "timestamp": 1694481236886, "type": 6, "content": "{\"numberOfViewers\":5466}" } ```    content定义： content定义： content定义： content定义： 暂未使用 content定义： |
   
 表6ReviewConfig 
| 参数             | 是否必选 | 参数类型    | 描述                                  |
|:---|:---|:---|:---|
| no_need_review | 否    | Boolean | 免审核。 目前仅白名单用户可使用此参数，非白名单用户跟随系统策略审核。 |
   
#### 响应参数
**状态码：200**
表7响应Header参数 
| 参数           | 参数类型   | 描述    |
|:---|:---|:---|
| X-Request-Id | String | 请求ID。 |
   
表8响应Body参数 
| 参数                       | 参数类型                                                                                                          | 描述            |
|:---|:---|:---|
| live_event_report_url    | String                                                                                                        | 刷新后的直播事件上传URL |
| live_event_report_config | [LiveEventReportConfig] object | 直播事件上报配置      |
   
 表9LiveEventReportConfig 
| 参数                    | 参数类型   | 描述                                                                                                                                                                                                                                      |
|:---|:---|:---|
| live_event_report_url | String | 直播事件上报地址。用户将自行获取的直播间事件上报到此地址，用于触发智能互动，自动回复话术。                                                                                                                                                                                           |
| auth_key              | String | 直播事件上报认证key。请求直播事件上报地址时，把auth_key放到请求头域中。如"auth_key:50fa6bb8aa2b3f88xxxx..."                                                                                                                                                            |
| expires_time          | Long   | 直播事件url上报过期时间。请求直播事件上报地址时，把expires_time放到请求头域中。如"expires_time:1757464200000" **取值范围：** 0\~4102415999000 |
   
**状态码：400**
表10响应Body参数 
| 参数         | 参数类型   | 描述    |
|:---|:---|:---|
| error_code | String | 错误码。  |
| error_msg  | String | 错误描述。 |
   
**状态码：401**
表11响应Body参数 
| 参数         | 参数类型   | 描述    |
|:---|:---|:---|
| error_code | String | 错误码。  |
| error_msg  | String | 错误描述。 |
   
**状态码：500**
表12响应Body参数 
| 参数         | 参数类型   | 描述    |
|:---|:---|:---|
| error_code | String | 错误码。  |
| error_msg  | String | 错误描述。 |
   
#### 请求示例
```
POST https://{endpoint}/v1/70b76xxxxxx34253880af501cdxxxxxx/smart-live-rooms/24bad716-87b1-45e5-8912-6102f7693265/smart-live-jobs/26f06524-4f75-4b3a-a853-b649a21aaf66/live-event-report
{
  "total" : 1,
  "events" : [ {
    "timestamp" : 1690819199000,
    "type" : 1,
    "content" : "xxxxx"
  } ]
}
```
#### 响应示例
**状态码：200**
成功。
```
{
  "live_event_report_url" : "https://{endpoint}/v1/70b76xxxxxx34253880af501cdxxxxxx/smart-live-rooms/24bad716-87b1-45e5-8912-6102f7693265/smart-live-jobs/26f06524-4f75-4b3a-a853-b649a21aaf66/live-event-report"
}
```
**状态码：400**
请求传参异常，包含错误码及对应描述。
```
{
  "error_code" : "MSS.00000003",
  "error_msg" : "Invalid parameter"
}
```
**状态码：401**
未鉴权或鉴权失败。
```
{
  "error_code" : "MSS.00000001",
  "error_msg" : "Unauthorized"
}
```
**状态码：500**
内部服务错误。
```
{
  "error_code" : "MSS.00000004",
  "error_msg" : "Internal Error"
}
```
#### 状态码
| 状态码 | 描述                 |
|:---|:---|
| 200 | 成功。                |
| 400 | 请求传参异常，包含错误码及对应描述。 |
| 401 | 未鉴权或鉴权失败。          |
| 500 | 内部服务错误。            |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-metastudio/ErrorCode.html)。
