Polyv Help Center

Help Center

Set Video Playback Password

Updated: 2025-01-14 16:10:00

API Description

1、通过视频id修改视频播放密码
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议

API URL

http://api.polyv.net/v2/video/{userid}/video-setting-save

Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
ptime true Long Current time in milliseconds, valid within 3 minutes
sign true String Signature, a 40-character uppercase SHA1 value. The secretkey used to generate the signature is critical for communication data security. It must not be stored 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 for response data. See signature generation rules
vids true String Video IDs, separated by commas for multiple IDs
describ false String Video description
password false String Video password
publishUrl false String First publish external link
tag false String Video tag
title false String Video title

Example

http://api.polyv.net/v2/video/1b448be323/video-setting-save

Form parameters:

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&ptime=1618218158363

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See global error description
status String Response status text
message String Response description. When code is 400 or 500, provides auxiliary error reason
data Object Returns the number of modified videos on success, or an empty string on failure

Java Request Example

For quick integration of basic code, download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and VodSignUtil.java in the downloaded file.

It is strongly recommended to use the VOD Java SDK for API integration. The VOD Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

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("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

}

Response Example

For global system error descriptions, see Global Error Description

Success Example

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

Error Example

{
    "code":400,
    "status":"error",
    "message":"the sign is not right.",
    "data":""
}
联系客服,在线咨询