Polyv Help Center

Help Center

Add Video to Playlist

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

Interface URL

https://api.polyv.net/v2/play-list/add-video

Interface Description

Add a video to a playlist

Supported Format

JSON

Request Method

POST

Request Parameters

Parameter Required Type and Range Description
userid Yes string User ID
ptime Yes long Current time in milliseconds (13 digits), valid within 3 minutes
sign Yes String Signature, a 40-character uppercase SHA1 value [See Signature Generation Rules]
playListId Yes long Playlist ID
vid Yes string Video VID

Example of Successful JSON Response

{
    "code": 200,
    "status": "success",
    "message": "success"
}

Example of Error JSON Response

签名不正确
{
"code":400,
"status":"error",
"message":"the sign is not right",
"data":""
}
时间戳过期
{
"code":400,
"status":"error",
"message":"ptime is too old.",
"data":""
}
添加失败,请检查视频是否重复添加、或者playListId、vid是否存在且合法
{
    "code": 400,
    "status": "error",
    "message": "Add video failed",
    "data": ""
}

Field Description

Field Type Description
code int Return code
status string Return status
message string Return message
data object Operation result

Java Request Example:

    public void testAddVideoToPlayList() throws Exception {
        String url = "https://api.polyv.net/v2/play-list/add-video";
        Map<String, String> params = new HashMap<>();
        params.put("userid", userid);
        long playListId = 1620142496099L;
        params.put("playListId", String.valueOf(playListId));
        params.put("vid", "a2dc4f25174db4e911ce6fbf2cbd81cc_a");
        params.put("ptime", String.valueOf(System.currentTimeMillis()));
        params.put("sign", getSign(params, secretkey));
        String response = HttpClientUtil.getInstance().sendHttpPost(url, params);
        System.out.println(response);
    }
联系客服,在线咨询