1、通过视频id修改视频播放密码
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
http://api.polyv.net/v2/video/{userid}/video-setting-save
http://api.polyv.net/v2/video/1b448be323/video-setting-save
describ=%E6%8F%8F%E8%BF%B0&password=123456&vids=1b448be323631e6e80e12e0790609f68_1%2C1b448be323d7e4c49d5634abd5af0bcb_1&sign=0A8F7BCF427C94402CBDCBAC23118250B0879782&tag=%E6%A0%87%E7%AD%BE&title=%E8%A7%86%E9%A2%91%E6%A0%87%E9%A2%98&userId=1b448be323&ptime=1618218158363
强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(PasswordTest.class);
/**
* 设置视频播放密码
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testSetVideoPassword() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/v2/video/"+userId+"/video-setting-save";
String vids = "1b448be323631e6e80e12e0790609f68_1,1b448be323d7e4c49d5634abd5af0bcb_1";
String tag = "标签";
String title = "视频标题";
String password = "123456";
String describ = "描述";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userId", userId);
requestMap.put("ptime", ptime);
requestMap.put("vids", vids);
requestMap.put("tag", tag);
requestMap.put("title", title);
requestMap.put("password", password);
requestMap.put("describ", describ);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFormBody(url,requestMap);
log.debug("测试设置视频播放密码,{}", response);
//do somethings
}
{
"code":200,
"status":"success",
"message":"success",
"data":2
}
{
"code":400,
"status":"error",
"message":"the sign is not right.",
"data":""
}