Delete Subtitle File
Updated: 2025-01-14 15:56:07
API Description
1、通过视频id删除视频字幕文件
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
API URL
http://api.polyv.net/v2/video/{userid}/srt/delete
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls are subject to rate limits. See details
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 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 |
| vid | true | String | Video ID, e.g., 1b448be3235552e5fafb16489eb01839_1 |
| ranks | true | String | Refer to Query Subtitle List for the list of subtitle file upload sequence numbers. Sequence numbers start from 1. Multiple values separated by commas, e.g., 2,3 |
Example
http://api.polyv.net/v2/video/1b448be323/srt/delete
Form Parameters:
vid=1b448be323dec2a7bed6db61bd7d8a77_1&ranks=1&sign=CB0C11F82F14F5515E950B10F3C25B65C69FD402&ptime=1617263469183
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, provides additional error details |
| data | String | Returns {} on success, empty on failure |
Error Code List
| Error Code | message | Description |
|---|---|---|
| 400 | sign can not be empty. | Signature is empty |
| 400 | ptime is too old. | Timestamp expired |
| 400 | ptime is illegal. | Invalid timestamp format or exceeds current time by 3 minutes |
| 400 | Could not find user by userid. | User ID does not exist |
| 400 | the sign is not right. | Incorrect signature |
| 401 | vid is blank. | Video ID is empty |
| 401 | ranks is blank. | Ranks is empty |
| 402 | cannot find the video. | Video not found |
| 402 | invalid srt ranks. | Invalid video subtitle sequence number |
Java Request Example
HttpUtil.java and VodSignUtil.java Base code can be downloaded locally or accessed online at Base Code
private static final Logger log = LoggerFactory.getLogger(VodVideoSubtitleTest.class);
/**
* 删除字幕
*/
@Test
public void testDeleteSubtitle() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userid = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/video/%s/srt/delete",userid);
String vid = "1b448be3230fa05b4d2d0003bf5a8ad0_1";
String ranks = "1";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
requestMap.put("ranks",ranks);
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
{
"code": 400,
"status": "error",
"message": "ptime is too old.",
"data": ""
}
