Polyv Help Center

Help Center

VOD CDN Refresh and Preload

Updated: 2022-05-23 19:02:59

API URL

https://api.polyv.net/v2/video/refresh-cdn-cache

API Description

1. 点播视频CDN刷新预热,目前仅支持预热点播zip文件
2. 提交任务后,需 5-10 分钟左右才能生效
3. 同一个用户,每天最多刷新预热 2000 个文件

Request Method

1. 支持POST请求,参数需放在请求体中,并以form表单的形式提交
2. Content-Type: application/x-www-form-urlencoded

Request Parameters

Parameter Name Required Type & Range Description
userid true string User ID
ptime true long 13-digit millisecond timestamp of the current time
sign true String Signature, a 40-character uppercase SHA1 value [See Signature Generation Rules]
action true string Operation to perform, preload: "push"
fileType true string File type, VOD video zip file: "zip"
videos true array Array of video information, formatted as a JSON string. The number of requests per call must not exceed 100
videos[0].vid true string Video ID
videos[0].brIndex true int Bitrate index, 1: Smooth, 2: HD, 3: Ultra HD

videos Parameter Example

[
    {
    "vid": "e6b23c6f513fbe025b94efdd10d7ab47_e",
    "brIndex": 1
    },
    {
    "vid": "e6b23c6f513fbe025b94efdd10d7ab47_e",
    "brIndex": 2
    },
    {
    "vid": "e6b23c6f513fbe025b94efdd10d7ab47_e",
    "brIndex": 3
    }
]

Response Result

JSON Example

上传成功返回示例
{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": {
        "taskId": "b3ad461ef1df4afc9340427767968a4c"
    }
}

Request Failure JSON Example

时间戳过期
{
    "code": 400,
    "status": "error",
    "message": "ptime is too old",
    "data": null
}
签名不正确
{
    "code": 400,
    "status": "error",
    "message": "the sign is not right.",
    "data": null
}
提交的vid中存在不合法值
{
    "code": 400,
    "status": "error",
    "message": "illeagal vid",
    "data": null
}
每次提交不能超过100个文件
{
    "code": 400,
    "status": "error",
    "message": "can't submit more than 100 files",
    "data": null
}
码率不存在
{
    "code": 400,
    "status": "error",
    "message": "bitrate does not exist",
    "data": null
}
每天不能提交超过2000个文件
{
    "code": 400,
    "status": "error",
    "message": "can't submit more than 2000 files one day",
    "data": null
}

Field Description

Field Description
code Request return status code
status Request return status
message Request return message
data Return data
data.taskId Task ID

Java Request Example

public void testRefreshCdnCache() {
        String url = "https://api.polyv.net/v2/video/refresh-cdn-cache";
        String userid = "xxxxxxx";
        String vid = "xxxxxxxxxxxxxxxxxxxx";
        String secretkey = "xxxxxxx";
        String videos = "[{\"vid\": \"e6b23c6f513fbe025b94efdd10d7ab47_e\",\"brIndex\": 1}]";
        long ptime = System.currentTimeMillis();

        Map<String, String> params = new HashMap<>();
        params.put("ptime", String.valueOf(ptime));
        params.put("userid", userid);
        params.put("videos", videos);
        params.put("action", "push");
        params.put("fileType", "zip");
        params.put("sign", getSign(params, secretkey));
        String content = HttpClientUtil.getInstance().sendHttpPost(url, params);
        System.out.println(content);
}
联系客服,在线咨询