Polyv Help Center

Help Center

Query Playback Domain Restrictions

Updated: 2025-10-10 12:02:04

API Description

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

API URL

http://api.polyv.net/v2/play/{userid}/domain

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, 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 for response data. See Signature Generation Rules

Example

http://api.polyv.net/v2/play/1b448be323/domain?sign=817F704343C8E599BD84DF39451E9394F609B470&ptime=1620632165194

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 playback domain restriction information on success [See data field description](/vod/api/playsafe/domain_restrict/get_domain_restrict_setting.md?id=data字段说明], returns empty on failure

data Field Description

Field Type Description
userid String POLYV VOD account ID, e.g., 1b448be323
settingType Integer Domain restriction type
0: No domain restriction
1: Blacklist
2: Whitelist
3: Composite whitelist and blacklist restriction
enableHost String Allowed playback domains (whitelist), multiple domains separated by commas. Valid when settingType = 2
disableHost String Prohibited playback domains (blacklist), multiple domains separated by commas. Valid when settingType = 1

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 pools.

private static final Logger log = LoggerFactory.getLogger(VodVideoDomainRestrictTest.class);
/**
 * 查询播放域名限制
 */
@Test
public void testGetDomainRestrictSetting() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String secretKey = super.secretKey;
    String userId = super.userId;
    String ptime = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = String.format("http://api.polyv.net/v2/play/%s/domain",userId);

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("ptime", ptime);
    requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
    String response = HttpUtil.get(url, requestMap);

    log.debug("测试查询播放域名限制,{}", response);
    //do somethings
}

Response Example

For global error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": {
        "userid": "1b448be323",
        "settingType": 1,
        "enableHost": "",
        "disableHost": "www.baidu.com"
    }
}

Error Example

Incorrect Signature

{
    "code":400,
    "status":"error",
    "message":"the sign is not right",
    "data":""
}

Timestamp Expired

{
    "code":400,
    "status":"error",
    "message":"ptime is too old.",
    "data":""
}
联系客服,在线咨询