Polyv Help Center

Help Center

Move Video to Specified Category

Updated: 2025-01-14 15:19:17

API Description

1、通过视频id批量移动视频到指定分类下
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议

API URL

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

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

  2. The concatenation rule for sign (signature) is: ptime=parameter&vids=parameter&cataid=parametersecretkey, and it is passed together with sign via URL.

Request Parameters

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, multiple videos separated by English commas
cataid true String Target category ID. This parameter is obtained from Get Categories and Subcategories

Example

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

Form parameters:

vids=1b448be323ae991b1dfc5136597618d1_1&sign=89173A5372BD1FE2F31610C177D8D075803E9E4E&cataid=1602300731843&ptime=1617158821090

Response Parameters

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, it provides additional error details.
data Object Returns true on success, empty on failure

Java Request Example

For quick integration of basic code, download the related 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 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(VodVideoManagementTest.class);
/**
 * 移动视频到指定分类
 */
@Test
public void testMoveVideo() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String secretKey = super.secretKey;
    String userid = super.userId;
    String ptime = String.valueOf(System.currentTimeMillis());
    //业务参数
    String vids = "1b448be323ae991b1dfc5136597618d1_1";
    String cataid = "1602300731843";
    String url = "http://api.polyv.net/v2/video/" + userid + "/changeCata";

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("userid", userid);
    requestMap.put("ptime", ptime);
    requestMap.put("vids", vids);
    requestMap.put("cataid", cataid);

    //系统只对部分参数进行签名
    Map<String, String> signMap = new HashMap<>();
    signMap.put("userid", userId);
    signMap.put("ptime", ptime);
    signMap.put("vids", vids);
    signMap.put("cataid", cataid);
    requestMap.put("sign", VodSignUtil.getSign(signMap, secretKey));

    String response = HttpUtil.postFormBody(url, requestMap);
    log.debug("测试移动视频到指定分类,{}", response);
    //do somethings
}

Response Example

For system-wide global error descriptions, see Global Error Description

Success Example

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

Error Example

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