Delete Video
Updated: 2024-12-31 18:37:43
API Description
1、通过视频id删除视频,支持批量删除
2、接口支持https协议
API URL
http://api.polyv.net/v2/video/del-videos
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API 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) |
| 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 used directly on the client side. All APIs must be relayed through the customer's own server to call the POLYV server for response data. See Signature Generation Rules |
| vids | true | String | Video IDs, multiple IDs separated by commas. Maximum 500 IDs per request. |
| deleteType | false | String | Deletion method, default is 1. 1: Move to recycle bin 2: Permanently delete |
| ignoreInvalidVids | false | String | Whether to ignore invalid video IDs. Values: Y or N. Default is N. Y: Ignore invalid video IDs; valid IDs will be processed normally. N: If invalid video IDs exist, no deletion will be performed and an error message will be returned. |
Example
http://api.polyv.net/v2/video/del-videos
Form Parameters:
vids=1b448be323e6eee0484ad35a4b55b96d_1,1b448be323e131655fe4a70cc01fd490_1&sign=CDF38C1476AF7578A55D81FB8B4162BD29F9FE53&userid=1b448be323&ptime=1617097496305
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. When code is 400 or 500, provides auxiliary error description. |
| data | String | If the ignoreInvalidVids parameter value is Y and the request contains invalid video IDs, data will contain a list of invalid video IDs; otherwise, data is an empty string. |
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 HttpUtil.java and VodSignUtil.java are included in the download 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 pooling.
private static final Logger log = LoggerFactory.getLogger(VodVideoManagementTest.class);
/**
* 删除视频
*/
@Test
public void testDeleteVideo() 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/del-videos";
String vids = "1b448be323e6eee0484ad35a4b55b96d_1,1b448be323e131655fe4a70cc01fd490_1";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userid);
requestMap.put("ptime", ptime);
requestMap.put("vids", vids);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFormBody(url, requestMap);
log.debug("测试删除视频,{}", response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "success",
"data": ""
}
Error Example
Incorrect Signature
{
"code":400,
"status":"error",
"message":"the sign is not right",
"data":""
}
Timestamp Expired
{
"code":400,
"status":"error",
"message":"ptime is too old.",
"data":""
}
Empty Parameter
{
"code":400,
"status":"error",
"message":"xxx is empty",
"data":""
}
Maximum 500 videos can be deleted at once
{
"code":400,
"status":"error",
"message":"delete vids size can't greater than 500 once",
"data":""
}
