保利威文档中心

幫助中心

新增影片至播放清單

更新時間:2022-05-23 19:02:59

介面URL

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

介面說明

新增影片至播放清單

支援格式

JSON

請求方式

POST

請求參數

參數名 必填 類型及範圍 說明
userid string 使用者ID
ptime long 當前時間的毫秒級時間戳(13位),3分鐘內有效
sign String 簽名,為40位大寫的SHA1值【詳見簽名生成規則
playListId long 播放清單ID
vid string 影片vid

返回正確結果JSON範例

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

返回錯誤結果JSON範例

签名不正确
{
"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": ""
}

欄位說明

欄位 類型 說明
code int 回傳碼
status string 回傳狀態
message string 回傳資訊
data object 操作結果

java請求範例:

    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);
    }
联系客服,在线咨询