Video Fetch

Last update:2022-01-07 14:31:35

Description

The user specifies the video url to be uploaded through the interface, and the cloud vedio background system actively fetches and saves it in the user’s Cloud VOD storage space. This function supports batch fetch.

Request Description

Request method POST/GET
Interface Address https://api.cloudv.haplat.net/vod/videoManage/pullVideo
If token is needed The verification token is needed

Request Parameters

ParameterTypeRequiredRemarks
transNostring      no      

Business ID, users need to control the uniqueness by themselves.

It is recommended to use 32-bit UUID, and the longest 32-bit string.

cmdstringnoCommand, the format is as follows:
{tcTemplateName:xxxx,workflowCode:xxx}
fileListarrayYes

The url of the video to be fetched and the corresponding parameters (parameters include fileName, fileUrl, md5) are expressed as a json string and encoded with url_safe_base64, and at most 50 can be pulled at a time.

Example: Use the following string to encode url_safe_base64 [{"fileName":"fileName1","fetchUrl":"fetchUrl1","md5":"md51"}, {"fileName":"fileName2","fetchUrl":" fetchUrl2","md5":"md52"}]

workflowIdstringnoWorkflow ID
notifyUrlstringnoThe url that receives the processing result. The url does not need to be encrypted.
For details of the notification content, please refer to "Notification Interface Return Content List", the content of the notification will be encoded with url_safe_base64.
separateintnoWhether the processing instructions for fetching multiple videos are notified separately.
Ranges:
  • 0 (the entire batch merge notification)
  • 1 (Independent notification for each video)
Default is 0

The format of fileList before url_safe_base64 encoding is an array, and the data structure of the array elements:

Parameter Type Required Remarks
fileName string No Specify the file name of the fetched file. It is recommended to include the format suffix. If the format suffix is ​​not included, the fetched video will also have no format suffix. If not send the parameter, will use the last URI of the URL as the file name.
fetchUrl String Yes The url of the file to be fetched.
md5 String No The md5 value of the file to be fetched; used to verify whether the file is damaged after the fetch. If not fill in, will not verify.

Return parameter

For common return results, please refer to the Return Result.

Example

Input example

curl -X POST http://api.cloudv.haplat.net/vod/videoManage/pullVideo 
  -H 'content-type: application/x-www-form-urlencoded; charset=utf-8' 
  -H "Host: api.cloudv.haplat.net" 
  <公共的头部参数>
  <自定义的头部参数>
  -d 'fileList=W3tmaWxlbmFtZTo8ZmlsZU5hbWUxPixmZXRjaFVybDo8ZmV0Y2hVcmwxPixtZDU6PG1kNTE+fSx7ZmlsZW5hbWU6PGZpbGVOYW1lMj4sZmV0Y2hVcmw6PGZldGNoVXJsMj4sbWQ1OjxtZDUyPn1d&notifyUrl=aHR0cHM6Ly93d3cuYmFpZHUuY29t&separate=1'

Notes: For the “public parameter” in the example, please refer to Common Parameters.

Output example

{
    "code": 200,
	"message": "操作成功",
	"data":{"taskId":"0123456789012345678912",
	"transNo": "0123456789012345678912"}
}

Error code

The interface has no error codes that are related to interface service logic, the generic error code can be found at Return Result.

Video fetch callback notification

The upload result is fed back to the client through a callback method. The server sends an http
post request to the callback notification address specified in the video file URL fetch interface . The returned data will be encoded in json format using url_safe_base64 and then written into the body of the request.

Return success result

ParameterTypeRemark
taskIdstringTask ID.
transNostringBusiness ID
timestamplongMillisecond timestamp
statusint

Task status

Value range of task status :

  • 1 (processing)
  • 2 (completed)
itemsarrayThe status information of each video fetch result. If the processing request includes multiple videos, the items include multiple pieces of information.

Items field data format

ParameterTypeRemark
fileNamestringfile name
fetchUrlstringFetch URL
md5stringVideo md5
pullStatusstringFetch task execution status
Value range of it:
  • 1 (processing)
  • 2 (success)
  • 3 (failure)
cmdStatusstringIntegrated command execution status
Value range of it:
  • 1 (processing)
  • 2 (success)
  • 3 (failure)
videoInfoobjContains video id, video file list. The file list includes bitrate, definition, resolution, terminal type, and video URL.

videoInfo field data format

Parameter Type Remarks
videoId string Video ID
duration double duration
videoFileList array Video file list

videoFileList field data format

Parameter nameTypeRemark
clarityintDefinition. Ranges:
  • 1 (Original)
  • 2 (Low definition)
  • 3 (Standard definition)
  • 4 (High definition)
  • 5 (UHD)
serverTypeintTerminal type. Ranges:
  • 0 (PC)
  • 1 (original video)
bitrateintBitrate
resolutionstringResolution
fileSizelongFile size
fileUrlstringVideo url

Client server response rules:

  1. If the http status code returns 200, the callback is considered successful.
  2. If the request fails, it will be retried again after an interval of 10 minutes. The number of retries is 3 times. The number of retries can be configured.
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!