Polyv Help Center

Help Center

Modify Category Settings

Updated: 2024-12-31 18:37:43

API Description

1、通过分类id修改视频分类属性设置
2、接口支持https协议

API URL

http://api.polyv.net/v3/category/update-profile

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

Request Parameter Description

Parameter Required Type Description
userid true String POLYV VOD account ID. Refer to Get Secret Key for acquisition. Path: Official Website -> Login -> VOD (API Interface)
appId true String Account appId. See Get Secret Key for details
timestamp true Long Current time in milliseconds, valid for 3 minutes
sign true String Signature, 32-bit uppercase MD5 value. See MD5 Signature Generation Rules for details
cateId true Long Category ID. Obtain via Query Category List
enabled false String Whether to enable category settings. Default is N: Disabled
When disabled, the category's attribute settings follow the account's video attribute settings. When enabled, separate settings can be configured for this category
Y: Enable
N: Disable
keepSource false String Source file playback setting switch (only valid for newly uploaded videos). Default is 0: Non-source file playback
If source file playback is enabled, the encrypt, encryptLevel, isEdu, and encodeAAC parameters are ineffective
1: Enable
0: Disable
encrypt false String Video encryption setting switch (only valid for newly uploaded videos). Default is 0: Disable
1: Enable
0: Disable
encryptLevel false String Encryption level (only valid for newly uploaded videos). Default is open: No encryption authorization
open: No encryption authorization
web: WEB authorization
app: APP authorization
wxa_app: Mini Program authorization
isEdu false String Video optimization (only valid for newly uploaded videos). Default is 0: Disable
1: Enable
0: Disable
encodeAAC false String Generate audio file (only valid for newly uploaded videos). Default is 0: Disable
This feature is only available to authorized users
1: Enable
0: Disable

Example

http://api.polyv.net/v3/category/update-profile

Form Parameters:

isEdu=1&encode_aac=1&cateId=1617877139774&encrypt=1&appId=a0Wmol5EwX&keepSource=0&sign=05AF8FB0336F152D9140DB92A94B80F1&encryptLevel=web&userid=1b448be323&enabled=Y&timestamp=1617933240089

Response Parameter Description

Parameter Type Description
requestId String Business serial number for each request, must be unique for client/server troubleshooting
code Integer Response status code. 200 indicates success, non-200 indicates failure. See Global Error Description for details
status String Response status text
error Object Error information. See error field description for details
data Boolean Returns true on success, null on failure

error Field Description

Parameter Type Description
code Integer Error code
desc String Error description

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download the 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 functionality 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(VodSubAccountTest.class);

/**
 * 修改分类设置
 */
@Test
public void testSubModifyCategorySetting() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String secretKey = super.appSecret;//使用子账号的secretKey
    String userid = super.userId;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/v3/category/update-profile";
    String appId = super.appId;
    String cateId = "1617877139774";
    String enabled = "Y";
    String keepSource = "0";
    String encrypt = "1";
    String encryptLevel = "web";
    String isEdu = "1";
    String encode_aac = "1";

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("userid", userid);
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("cateId", cateId);
    requestMap.put("enabled", enabled);
    requestMap.put("keepSource", keepSource);
    requestMap.put("encrypt", encrypt);
    requestMap.put("encryptLevel", encryptLevel);
    requestMap.put("isEdu", isEdu);
    requestMap.put("encode_aac", encode_aac);

    //用md5进行签名
    requestMap.put("sign", VodSignUtil.getSignMd5(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

{
    "requestId": "87bbd09d-0d31-45dc-a4b7-21068f5f5564",
    "code": 200,
    "status": "success",
    "error": null,
    "data": true
}

Error Example

Timestamp Error

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 100,
        "desc": "invalid timestamp"
    },
    "data": null
}

Incorrect appId

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 101,
        "desc": "application not exist"
    },
    "data": null
}

Sub-account Does Not Exist

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 102,
        "desc": "user children not exist"
    },
    "data": null
}

Sub-account Expired

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 103,
        "desc": "user children expired"
    },
    "data": null
}

Signature Error

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 104,
        "desc": "invalid signature"
    },
    "data": null
}

Insufficient Account Permissions

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 105,
        "desc": "permission limited"
    },
    "data": null
}

Category ID Does Not Exist

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 3001,
        "desc": "category not exist"
    },
    "data": null
}

Cannot Modify This Category Setting; Only First-Level Directories Under the Root Directory Can Be Modified

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 3005,
        "desc": "category could not be modified"
    },
    "data": true
}
联系客服,在线咨询