Polyv Help Center

Help Center

Query Video Playback Password

Updated: 2025-01-14 16:09:30

API Description

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

API URL

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

Online API Call

Request Method

GET

API Constraints

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

Request Parameter Description

Parameter Required Type Description
ptime true Long Current time in milliseconds timestamp, valid for 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 to obtain response data. See signature generation rules
vids true String Video IDs, separated by commas for multiple IDs

Example

http://api.polyv.net/v2/video/1b448be323/video-setting-page?vids=1b448be323b452641878b54f21241188_1&sign=1304532D24F75B2209D2B3D7BE62722265E6D21B&ptime=1618281315107

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 Video playback password information returned on success. See data field description
data Parameter Description
Parameter Type Description
questionnaire Object Questionnaire. See questionnaire field description
isShowPassword Boolean Whether to display the password
true: display password
false: do not display password
vids String Video ID
videoPool Object Video information. See videoPool field description
qid String Visitor information collection ID
questionnaire Parameter Description
Parameter Type Description
qid String Visitor information collection ID
videoPool Parameter Description
Parameter Type Description
describ String Video description
videoPoolExt Object Video extension information. See videoPoolExt field description
tag String Video tag
title String Video title
publishUrl String First publish external link
videoPoolExt Parameter Description
Parameter Type Description
password String Video password. Empty indicates no password

Error List

No. Description
1 Cannot find user associated with writetoken
2 File is empty or writetoken is empty
3 Submitted JSON name JSONRPC is null
4 Submitted file format is incorrect
5 readtoken is empty
6 Pagination input error
7 vid cannot be empty
8 Method name not found

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. HttpUtil.java and VodSignUtil.java in the test case are included in the download 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 pool.

private static final Logger log = LoggerFactory.getLogger(PasswordTest.class);
/**
 * 查询视频播放密码
 * @throws Exception
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetVideoPassword() 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-page";
    String vids = "1b448be323b452641878b54f21241188_1";

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("ptime", ptime);
    requestMap.put("vids", vids);
    requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
    String response = HttpUtil.get(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":{
        "questionnaire":{
            "qid":""
        },
        "isShowPassword":false,
        "vids":"1b448be323b452641878b54f21241188_1",
        "videoPool":{
            "describ":"美食",
            "videoPoolExt":{
                "password":"123456"
            },
            "tag":"合并美食",
            "title":"合并美食视频",
            "publishUrl":""
        },
        "qid":""
    }
}

Error Example

{
    "code":400,
    "status":"error",
    "message":"vids为空.",
    "data":""
}
联系客服,在线咨询