Polyv Help Center

Help Center

Asynchronous Batch Video Upload

Updated: 2026-01-16 09:27:09

API Description

1、通过视频URL链接,异步批量上传视频
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议

API URL

http://api.polyv.net/v2/video/grab/{userid}/upload/multi

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

  2. Either uploadInfos or (fileUrl, title) must be provided, and uploadInfos takes precedence over (fileUrl, title). Using uploadInfos is recommended.

Request Parameter Description

Parameter Required Type Description
ptime true Long Current time in milliseconds, valid for 3 minutes
sign true String Signature, a 40-character uppercase SHA1 value. The secretkey used for generating 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 requests to the POLYV server for response data. See Signature Generation Rules
cataid false Long Set the category ID for the uploaded video. Obtain category IDs via the Get Categories and Subcategories API
luping false Integer Screen recording optimization. Default is 0: no optimization.
0: No optimization
1: Optimization
watermark false String Custom watermark image URL. The image must be in PNG format. Supports http and https protocols
watermarkLocation false String Custom watermark image position. If absent, the watermark display follows the category or account settings.
1: Top left
2: Top right
3: Bottom left
4: Bottom right
uploadInfos false Array JSON array of video upload information, up to 100 items. See uploadInfos Parameter Description
fileUrl false String URL(s) of videos to be uploaded in batch. Multiple URLs are separated by commas. Supports http and https protocols. Deprecated, use uploadInfos instead
title false String Title(s). Multiple titles are separated by commas. The number of titles must match the number of file URLs. Deprecated, use uploadInfos instead
uploadInfos Parameter Description
Parameter Required Type Description
fileUrl true String URL of the video to upload. Supports http and https protocols. Length limit: 1000 characters
title true String Video title. Length limit: 100 characters
state false String Custom data. Length limit: 100 characters. If provided, it will be passed back transparently in the upload completion callback. See Callback Notification Usage
tag false String Video tag. Length limit: 200 characters. Excess characters will be automatically truncated

uploadInfos Example:

[{"fileUrl":"test.mp4","title":"test","state":"test","tag":"tag1,tag2"}]

Example

http://api.polyv.net/v2/video/grab/1b448be323/upload/multi

Form Parameters:

watermark=https%3A%2F%2Fimg.videocc.net%2Fuimage%2F1%2F1b448be323%2Fe%2F1b448be323fddcd3f8823f534918039e_0_b.jpg&uploadInfos=%5B%7B%22fileUrl%22%3A%22https%3A%2F%2Foss.polyv.net%2Fuploads%2F2023%2F12%2F27YlLZVCM_test.mp4%22%2C%22title%22%3A%22%E6%B5%8B%E8%AF%95%E5%BC%82%E6%AD%A5%E4%B8%8A%E4%BC%A0%E8%A7%86%E9%A2%911%22%2C%22state%22%3A%22test%22%7D%5D&sign=68EF1B1A3F9D4D726D68F882C9EBA11A0584CFE8&cataid=1602671097888&luping=0&ptime=1670902537111&watermarkLocation=4

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 additional error details
data String Returns "success" on success, empty on failure

Callback Description

The API only returns the upload result. The processing result of asynchronously uploaded video files must be obtained via callback. See Callback Notification Usage

Java Request Example

For quick integration of basic code, 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 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(VodVideoUploadTest.class);
/**
 * 异步批量上传视频
 */
@Test
public void testUrlBatchUpload() 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/grab/%s/upload/multi", userid);
    
    String uploadInfos = "[{\"fileUrl\":\"https://oss.polyv.net/uploads/2023/12/27YlLZVCM_test.mp4\"," +
    "\"title\":\"测试异步上传视频1\",\"state\":\"test\",\"tag\":\"tag1,tag2\"}]";
    
    String cataid = "1602671097888";
    String luping = "0";
    String watermark = "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0_b.jpg";
    String watermarkLocation = "4";
    
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("ptime", ptime);
    requestMap.put("uploadInfos", uploadInfos);
    requestMap.put("cataid", cataid);
    requestMap.put("luping", luping);
    requestMap.put("watermark", watermark);
    requestMap.put("watermarkLocation", watermarkLocation);
    requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
    
    String response = HttpUtil.postFormBody(url, requestMap);
    log.debug("测试异步批量上传视频,{}", response);
    //do somethings
    
}

Response Example

See Global Error Description for system-wide error descriptions.

Success Example

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": "成功"
}

Error Example

File URL cannot be empty

{
  "code":400,
  "status":"error",
  "message":"FileUrl is null!",
  "data":""
}

File title cannot be empty

{
  "code":400,
  "status":"error",
  "message":"Title is null!",
  "data":""
}

uploadInfos count exceeds limit

{
  "code":400,
  "status":"error",
  "message":"[uploadInfos] exceed the limit.",
  "data":""
}

Invalid uploadInfos parameter format

{
  "code":400,
  "status":"error",
  "message":"[uploadInfos] is invalid",
  "data":""
}

The number of file URLs must match the number of titles

{
  "code":400,
  "status":"error",
  "message":"FileUrl and title are inconsistent!",
  "data":""
}
联系客服,在线咨询