Polyv Help Center

Help Center

Asynchronous Chat History Download API

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

API URL

http://api.polyv.net/live/v3/channel/chat/content/create-task

API Description

1、异步下载聊天室聊天记录接口
2、如果异步下载成功,返回下载地址,下载地址有效期一天
2、接口支持https

Supported Format

JSON

Request Method

POST

Request Limit

TRUE

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live streaming system
timestamp Yes long Current 13-digit millisecond timestamp, valid within 3 minutes
sign Yes 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 saved or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server and obtain response data. For details, see Signature Generation Rules
channelId Yes int Channel ID

Successful Response JSON Example:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
       "status": "done",
       "url": "https://doc-oss.polyv.net/chat/export/xls/130760/130760_1597804097778.xls",
       "lastExportTime": 1597804097778
    }
}

Failed Response JSON Examples:

No appId provided

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

Incorrect appId

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

Timestamp error

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

Signature error

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Field Description

Parameter Type Description
code int Response code: 200 for success, 400 for failure, 401 for signature error, 500 for exception error
status string "success" for success, "error" for failure
message string Error message when an error occurs
data object Response result set
status string Asynchronous download status
todo: pending download
done: completed
doing: downloading
url string Download URL
lastExportTime long Timestamp of the last download, in milliseconds

Java Request Example

public static void main(String[] args) {
        String url = "http://api.polyv.net/live/v3/channel/chat/content/create-task";
        // 用户对应的appId和加密串
        String appId = "xxxxxxxxx";
        String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
        Map<String, String> params = new HashMap<>();
        params.put("channelId", "0000000");
        PolyvTool.setLiveSign(params, appId, appSecret);
        // 调用Polyv的httpClient工具类发送请求
        String content = HttpClientUtil.getInstance()
                .sendHttpPost(url, params);
        System.out.println(content);
    }
联系客服,在线咨询