Modify Category Settings
Updated: 2025-01-14 15:52:38
API Description
1、通过分类id,修改一级分类的属性,例如是否源文件播放等
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
4、每个账户预设根目录,名字为默认分类
API URL
http://api.polyv.net/v2/video/{userid}/updateCataProfile
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have a frequency limit. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| ptime | true | Long | Current time in milliseconds timestamp, valid within 3 minutes |
| sign | true | String | Signature, a 40-character uppercase SHA1 value. The secret key used to generate the signature is critical for communication data security. It must never be saved or used directly on the client side. All APIs must be called through the customer's own server to relay request data to the POLYV server and obtain the response. See Signature Generation Rules |
| cataid | true | String | Category ID. Only attributes of the first-level category can be set. This parameter is obtained from Get Category and Subcategories |
| isSettings | false | String | Whether to enable settings. Default value is Y: enabled Y: enabled N: disabled |
| keepSource | false | String | Source file playback setting switch (only valid for newly uploaded videos). Default value is 0: non-source file playback If source file playback is enabled, the encrypt, encryptLevel, isEdu, and encodeAAC parameters will not take effect. 1: enabled 0: disabled |
| encrypt | false | String | Video encryption setting switch (only valid for newly uploaded videos). Default value is 0: disabled 1: enabled 0: disabled |
| hlslevel | false | String | Mobile encryption setting (only valid for newly uploaded videos). Default value is open: non-encrypted authorization open: non-encrypted authorization; web: WEB authorization; app: APP authorization; wxa_app: Mini Program authorization; |
| isEdu | false | String | Video optimization (only valid for newly uploaded videos). Default value is 0: disabled 1: enabled 0: disabled |
| encode_aac | false | String | Generate audio file (only valid for newly uploaded videos). Default value is 0: disabled This feature is only available to authorized users. 1: enabled 0: disabled |
| playerId | false | String | Player ID, used to set which player to use for playing videos under the current category |
Example
http://api.polyv.net/v2/video/1b448be323/updateCataProfile
Form Parameters:
isEdu=1&encode_aac=1&encrypt=1&isSettings=Y&keepSource=0&sign=726E92932FA8EB35E4BD6B01E3F740CF512FBD86&cataid=1617160372987&ptime=1617235796542&hlslevel=app
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 message. When code is 400 or 500, it provides auxiliary error description. |
| data | String | Returns true on success, returns an empty string on error. |
Java Request Example
For quick integration of the basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. The 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 to implement API functionality integration. The VOD Java SDK provides unified packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(VodVideoCategoryTest.class);
/**
* 修改分类设置
*/
@Test
public void testUpdateVideoCategoryProfile() 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 + "/updateCataProfile";
String cataId = "1617160372987";
String isSettings = "Y";
String keepSource = "0";
String encrypt = "1";
String hlsLevel = "app";
String isEdu = "1";
String encodeAac = "1";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("cataid", cataId);
requestMap.put("isSettings", isSettings);
requestMap.put("keepSource", keepSource);
requestMap.put("encrypt", encrypt);
requestMap.put("hlslevel", hlsLevel);
requestMap.put("isEdu", isEdu);
requestMap.put("encode_aac", encodeAac);
requestMap.put("sign", VodSignUtil.getSign(requestMap, 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": "sign can not be empty.",
"data": ""
}
