功能说明
本接口用于获取指定直播间的统计数据,包括观看人次、礼物数据、点赞数据以及消息数量等。
适用场景
运营后台统计单个房间的互动数据。
接口调用说明
请求 URL 示例
https://xxxxxx/v4/live_engine_http_srv/get_room_stats?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
请求参数说明
参数 | 说明 |
xxxxxx | SDKAppID 所在国家/地区对应的专属域名: 中国: console.tim.qq.com新加坡: adminapisgp.im.qcloud.com硅谷: adminapiusa.im.qcloud.com雅加达: adminapiidn.im.qcloud.com |
v4/live_engine_http_srv/get_room_stats | 获取房间统计数据接口。 |
sdkappid | |
identifier | |
usersig | |
random | 请输入随机的 32 位无符号整数,取值范围 0 - 4294967295。 |
contenttype | 请求格式,固定值为 json。 |
最高调用频率
100次/秒。
请求参数
请求包体为 JSON 格式。
请求示例
{"RoomId": "live-room"}
字段详解
字段 | 类型 | 属性 | 说明 |
RoomId | String | 必填 | 房间唯一标识。最长48个字节。 |
返回参数
接口返回 HTTP 200 状态码时,需根据包体中的 ErrorCode 判断业务逻辑是否成功。
成功响应示例
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"RequestId": "Id-8c9858f01e954611ae2d4c1b1ed7d583-O-Seq-52720","Response": {"TotalViewers": 1024,"TotalGiftsSent": 56,"TotalGiftCoins": 8800,"TotalUniqueGiftSenders": 12,"TotalLikesReceived": 3200,"TotalMsgCount": 450}}
字段详解
字段 | 类型 | 说明 |
ActionStatus | String | 请求处理的结果: OK 表示处理成功。 FAIL 表示失败。 |
ErrorCode | Integer | 错误码: 0:表示成功。 非0:表示失败。 |
ErrorInfo | String | 错误信息。 |
RequestId | String | 唯一请求 ID,每次请求都会返回,定位问题时需要提供该次请求的 RequestId。 |
Response | Object | 房间统计数据对象,详见下方 Response 字段详解。 |
Response 字段详解
字段 | 类型 | 说明 |
TotalViewers | Integer | 累计观看人次。 |
TotalGiftsSent | Integer | 累计收到的礼物数量。 |
TotalGiftCoins | Integer | 累计收到的礼物金币数。 |
TotalUniqueGiftSenders | Integer | 累计送礼人数(去重)。 |
TotalLikesReceived | Integer | 累计收到的点赞数。 |
TotalMsgCount | Integer | 累计消息数量。 |
常见错误码
错误码 | 含义说明 |
100001 | 服务器内部错误,请重试。 |
100002 | 请求参数非法,请根据错误描述检查请求是否正确。 |
100004 | 房间不存在,请确认房间 ID 是否正确。 |
调用示例
场景:直播结束后获取数据面板
请求示例
{"RoomId": "live_testA"}
成功响应示例
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"RequestId": "Id-abc123def456-O-Seq-10001","Response": {"TotalViewers": 5680,"TotalGiftsSent": 234,"TotalGiftCoins": 46800,"TotalUniqueGiftSenders": 89,"TotalLikesReceived": 12500,"TotalMsgCount": 1830}}