Polyv Help Center

Help Center

Set Playback Domain Whitelist/Blacklist

Updated: 2022-09-02 18:08:07

API Description

1、设置播放域名为黑名单或者白名单
2、接口支持https协议

API URL

http://v.polyv.net/uc/services/rest?method=saveHostUrl

Online API Call

Request Method

POST

API Constraints

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

Request Parameter Description

Parameter Required Type Description
writetoken true String POLYV user's video-on-demand write token, consistent with the official Polyv website. Retrieval path: Official website -> Login -> Cloud VOD (API interface)
host true String Host string, separated by English commas, e.g., www.baidu.com,www.163.com
settingType true String Setting type
1: Blacklist
2: Whitelist

Example

http://v.polyv.net/uc/services/rest?method=saveHostUrl

Form parameters:

writetoken=f9810825-7512-476d-95ec-9ff2968df5de&host=www.baidu.com&settingType=2

Response Parameter Description

Parameter Type Description
error String Returns 0 on success, returns error code on failure [See Return Error Code List]

Return Error Code List

Return Description
0 No error
1 User associated with writetoken not found
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 here to download the source code. Add it to your own source code project after downloading. HttpUtil.java and VodSignUtil.java in the test cases are included 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(VodVideoDomainRestrictTest.class);

/**
 * 设置播放域名黑白名单
 */
@Test
public void testSetDomainRestrict() throws Exception, NoSuchAlgorithmException {
        //业务参数
        String url = "http://v.polyv.net/uc/services/rest?method=saveHostUrl";
        String writeToken = super.writeToken;
        String host = "www.baidu.com";
        String settingType = "2";

        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("writetoken", writeToken);
        requestMap.put("host", host);
        requestMap.put("settingType", settingType);
        String response = HttpUtil.postFormBody(url, requestMap);
        log.debug("测试设置播放域名黑白名单,{}", response);
        //do somethings
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
  "error": "0"
}

Error Example

{
    "error": "2"
}
联系客服,在线咨询