Polyv Help Center

Help Center

Video Ban and Unban

Updated: 2025-01-14 15:47:36

API Description

1、通过视频id将视频修改为解禁状态或禁播状态,解禁状态的视频可以正常播放,禁播状态的视频无法播放,一次最多只能操作500个视频id
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、支持https协议

API URL

http://api.polyv.net/v2/video/{userid}/forbidden

Online API Call

Request Method

POST

API Constraints

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

  2. Notes: Only videos with "Published" status can be changed to "Banned" status. Only videos with "Banned" status can be changed to "Published" status. When the requested video IDs contain multiple statuses, only the eligible video IDs will have their status modified, and success will be returned. If no eligible video IDs exist, an error will be returned.

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 never be stored or used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server for response data. See signature generation rules
vids true String Video IDs, multiple IDs separated by commas, e.g., a2dc4f25179499d6586362672838cc2d_a,a2dc4f25179499d6586362672838cc2d_a. Maximum of 500 video IDs per request
forbidden true Integer Video status
1: Ban
0: Unban

Example

http://api.polyv.net/v2/video/1b448be323/forbidden

Form parameters:

vids=1b448be3239c2ef0cb3ab9fd105f7fb2_1&forbidden=1&sign=5FBEB20C93D6FB6D715756CA0D25DBE96EFAD05A&ptime=1617156768546

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See global error description
status String Response status text
message String Response description, provides error details when code is 400 or 500
data String Returns an empty string for both success and 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(VodVideoManageManagementTest.class);
/**
 *视频禁播与解禁
 */
@Test
public void testSetForbiddenStatus() 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+"/forbidden";
    String vids="1b448be3239c2ef0cb3ab9fd105f7fb2_1";
    String forbidden=String.valueOf(1);

    //调用参数
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("userId", userId);
    requestMap.put("ptime", ptime);
    requestMap.put("vids", vids);
    requestMap.put("forbidden", forbidden);
    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":""
}

Error Example

Signature error

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

Timestamp expired

{
    "code": 400,
    "status": "error",
    "message": "ptime is too old",
    "data": ""
}

Maximum of 500 vids per operation

{
    "code": 400,
    "status": "error",
    "message": "vid count can't over 500",
    "data": ""
}

Only "Published" videos can be changed to "Banned" status

{
    "code": 400,
    "status": "error",
    "message": "只能修改“已发布”状态的视频为禁播状态",
    "data": ""
}

Only "Banned" videos can be changed to "Published" status

{
    "code": 400,
    "status": "error",
    "message": "只能修改“已禁播”状态的视频为已发布状态",
    "data": ""
}
联系客服,在线咨询
在线咨询