Polyv Help Center

Help Center

Create Video Source File Retrieval Task

Updated: 2023-09-15 10:54:33

API Description

  1. Creates a task to obtain download links for source files of published videos. When a single video resource is ready, a callback will be sent to the user. Users can also proactively query the task.
  2. The API supports the HTTPS protocol.

API URL

http://api.polyv.net/v3/video/source-file-task/create

Request Method

POST

API Constraints

  1. 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
appId true String POLYV VOD sub-account appId. Path: POLYV VOD Console -> Settings -> Account Management
timestamp true Long Millisecond-level timestamp of the current time, valid for 3 minutes
sign true String Signature, 32-character uppercase MD5 value See MD5 Signature Generation Rules
vids true String Video IDs, separated by commas for multiple IDs, up to 100. Example:
"1b448be32370f4822ac40fd926112a66_1,1b448be32305bb29879b1eb06abd9fa1_1"
expireDays true Integer Number of valid days for file thawing. Range (inclusive): 1-7

Example

http://api.polyv.net/v3/video/source-file-task/create

Form Parameters:

vids=1b448be32370f4822ac40fd926112a66_1%2C1b448be32305bb29879b1eb06abd9fa1_1&expireDays=1&appId=a0Wmol5EwX&sign=197679CCF105DD80E0378BEF75993D31&timestamp=1617950661602

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
requestId String Business request ID for this request, facilitating troubleshooting on client/server side
error Object Detailed error information returned on failure [See error field description](/vod/api/private/video_source_task_create.md?id=error字段说明], returned empty on success
data Object Task ID returned on success [See data field description](/vod/api/private/video_source_task_create.md?id=data字段说明], returned empty on failure

error Field Description

Field Type Description
code Integer Error code
desc String Error description See Global Error Description

data Field Description

Field Type Description
taskId String Task ID

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. HttpUtil.java and VodSignUtil.java in the test case are included in the downloaded file.

private static final Logger log = LoggerFactory.getLogger(Test.class);

/**
 * 创建视频源文件取回任务
 * @throws Exception
 * @throws NoSuchAlgorithmException
 */
@Test
public void tesCreateVideoSourceFileTask() throws Exception, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;
        String appSecret = super.appSecret;
        String timestamp = String.valueOf(System.currentTimeMillis());

        //业务参数
        String url = "http://api.polyv.net/v3/video/source-file-task/create";
        String vids = "1b448be32370f4822ac40fd926112a66_1,1b448be32305bb29879b1eb06abd9fa1_1";
        int expireDays = 1;

        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("vids", vids);
        requestMap.put("expireDays", expireDays);

        //用md5进行签名,使用子账号的secretKey签名
        requestMap.put("sign", VodSignUtil.getSignMd5(requestMap, appSecret));
        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": "9d43e946-5354-45a8-a4a7-0db49784fecf",
    "code": 200,
    "status": "success",
    "error": null,
    "data": {
        "taskId": "16661c08b9564c1ea6f4544ccd568e58"
    }
}

Error Example

{
    "requestId": "e7544473-250a-40eb-b53b-8768195617e0", 
    "code": 403, 
    "status": "error", 
    "error": {
        "code": 104, 
        "desc": "invalid signature"
    }, 
    "data": null
}
联系客服,在线咨询