Polyv Help Center

Help Center

Query All Chat Records

Updated: 2022-09-02 18:08:07

API Description

1、查询账号下频道聊天记录
2、接口支持https协议

API URL

http://api.polyv.net/live/v3/user/chat/get-speak-list

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have frequency limits. See details

  2. Do not pass the cursor parameter for the first query. Use the cursor returned from the previous query for subsequent queries until the returned list has no data.

Request Parameters

Parameter Required Type Description
appId true String Account appId See details: Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never be stored on the client side for direct use. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See details: Signature Generation Rules
startTime false Long Query start time, 13-digit millisecond timestamp
endTime false Long Query end time, 13-digit millisecond timestamp
cursor false String Do not pass for the first query. Use the cursor returned from the previous query for subsequent queries until the returned list has no data.
size false Integer Page size, default is 10, maximum is 1000

Example

https://api.polyv.net/live/v3/user/chat/get-speak-list?cursor=6_2&size=3&appId=frlr1zazn3&sign=C63541E7ACE179314B087FB218925FBC&userId=1b448be323&timestamp=1634284501527

Response Parameters

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See details: Global Error Description
status String Response status text
message String Response description, provides error details when code is 400 or 500
data Object Response data See details: data field description

data Field Description

Parameter Type Description
cursor String Cursor, include this parameter in the request to get the next page of data
size Integer Size passed in the request, may differ from the actual list length
list Array Chat content See details: list field description

list Field Description

Parameter Type Description
id String Message ID
content Boolean Message content
user String User information in JSON format [See details: User information JSON field description]
image String Message image
time Long Message timestamp
clientIP String Client IP
msgType String Message type
roomId String Room ID
sessionId String Session ID
accountId String Account ID
quote String Reply ID

User Information JSON Field Description

Parameter Type Description
actor String Role
banned Boolean Whether muted
channelId String Channel ID
clientIp String User IP
nick String Viewer nickname
pic String Viewer avatar
roomId String Room ID
sessionId String Session ID
uid String Socket ID
userId String Unique user identifier
userType String User type
slice: Cloud classroom student
teacher: Instructor
guest: Guest
manager: Manager
assistant: Teaching assistant
viewer: Invited viewer
monitor: Session monitor
attendee: Seminar participant
student: Regular live stream viewer

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.

    /**
     * 测试查询频道连麦详情数据
     * @throws IOException
     */
    @Test
    public void test() throws IOException, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;
        String appSecret = super.appSecret;
        String userId = super.userId;
        String timestamp = String.valueOf(System.currentTimeMillis());
        //业务参数
        String url = "https://api.polyv.net/live/v3/user/chat/get-speak-list";
        
        //http 调用逻辑
        Map<String,String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp",timestamp);
        
        requestMap.put("userId",userId);
        requestMap.put("cursor","6_2");
        requestMap.put("size","3");
        requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
        String response = HttpUtil.get(url, requestMap);
        log.info("测试查询所有聊天记录,当前页查询成功,返回值:{}",response);
        //do somethings
    }

Response Example

For global error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "size": 3,
        "cursor": "7_3",
        "list": [
            {
                "id": "f14e71f0-0fb5-11ec-912a-f7bfa2a37ef8",
                "roomId": "2523307",
                "content": "1",
                "user": "{\"banned\":false,\"channelId\":\"2523307\",\"clientIp\":\"175.10.232.110\",\"customize\":0,\"nick\":\"a\",\"pic\":\"https://liveimages.videocc.net/defaultImg/avatar/viewer.png\",\"roomId\":\"2523307\",\"uid\":\"nhycNjFyZxSXuVz0AKNW\",\"userId\":\"1631003162428\",\"userType\":\"slice\"}",
                "image": "",
                "time": 1631003465350,
                "clientIP": "",
                "msgType": null,
                "userType": "slice",
                "sessionId": null,
                "quote": null,
                "accountId": "1b448be323"
            },
            {
                "id": "f202a6c0-0fb5-11ec-912a-f7bfa2a37ef8",
                "roomId": "2523307",
                "content": "2",
                "user": "{\"banned\":false,\"channelId\":\"2523307\",\"clientIp\":\"175.10.232.110\",\"customize\":0,\"nick\":\"a\",\"pic\":\"https://liveimages.videocc.net/defaultImg/avatar/viewer.png\",\"roomId\":\"2523307\",\"uid\":\"nhycNjFyZxSXuVz0AKNW\",\"userId\":\"1631003162428\",\"userType\":\"slice\"}",
                "image": "",
                "time": 1631003466531,
                "clientIP": "",
                "msgType": null,
                "userType": "slice",
                "sessionId": null,
                "quote": null,
                "accountId": "1b448be323"
            },
            {
                "id": "f39331d0-0fb5-11ec-912a-f7bfa2a37ef8",
                "roomId": "2523307",
                "content": "35",
                "user": "{\"banned\":false,\"channelId\":\"2523307\",\"clientIp\":\"175.10.232.110\",\"customize\":0,\"nick\":\"a\",\"pic\":\"https://liveimages.videocc.net/defaultImg/avatar/viewer.png\",\"roomId\":\"2523307\",\"uid\":\"nhycNjFyZxSXuVz0AKNW\",\"userId\":\"1631003162428\",\"userType\":\"slice\"}",
                "image": "",
                "time": 1631003469156,
                "clientIP": "",
                "msgType": null,
                "userType": "slice",
                "sessionId": null,
                "quote": null,
                "accountId": "1b448be323"
            }
        ]
    }
}

Error Example

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询