Get Video Upload Token

Last update:2023-01-29 18:04:20

To upload a video, you need to get a URL and a credential(token) first. This API helps to get a URL and a credential for you.

Request Description

Item Description
Request Method POST/GET
URL https://api.cloudv.haplat.net/vod/videoManage/getUploadToken
Require Aunthentication Yes

We recommend you to try this API directly in OpenAPI. After running successfully, OpenAPI can automatically generate code samples for you.

Request Parameters

Parameter Type Required Description
originFileName string Yes The name of the video file, including the extension. For example, “uploadtest.mp4”.
fileId string No BreakPoint ID, up to 32 characters in length. The parameter will be used for breakpoint-resume upload. And the breakpoint-resume upload will work only after you have specified this parameter.
domain string No Playback domain of the video.
workflowId string No Workflow ID. You can check the workflow ID on Cloud VoD console, Preferences > Workflows > Workflow ID.
Note: workflowId will cover parameter cmd, waterMarkName, transCodeCombineName and subtitleId.
overwrite string No Whether to overwrite existing files:
0–No
1–Yes
categoryNames string No Video category, can set parent category and child category at a time.
For example,
[{“childName”:“child-category1”,“parentName”:“parent-category1”},{“childName”:“child-category2”,“parentName”:“parent-category2”}]
waterMarkName string No The watermark. It will be automatically added into the video after uploading successfully.
transCodeCombineName string No The name of the transcoding templated. If specified, the video will be transcoded by the transcoding templated after uploading successfully.
subtitleId string No Subtitle ID. If specified, the subtitle will be added into the video.

Response Parameters

For common responses, visit the Common Responses.

Parameter Type Description
fileKey string A relative path without the domain name and the top slash, for example,“video/201704/245bbb46f2c1456ae076d2f131949999_1492507971/test.flv”.
uploadToken string The token(credential) will be used for authentication in the upload later.
uploadUrl string An upload URL specifies where to upload the video file to. The URL will be used in upload later.
videoId string The ID of the video file, which can be used to query related information about the video after the upload is complete.
httpDnsServe string HTTP DNS server address.

Example

Input Example

curl -X POST 
  https://api.cloudv.haplat.net/vod/videoManage/getUploadToken 
  -H 'content-type: application/x-www-form-urlencoded; charset=utf-8' 
  -H "Host: api.cloudv.haplat.net" 
  -H "Authorization: your token" 
  -H "X-WS-Timestamp: current timestamp" 
  -H "X-WS-AccessKey: your AccessKey ID" 
  -d 'originFileName=uploadtest.mp4'

Output Example

{
    "code": 200,
    "data": {
        "speedDomainlUrl": "",
        "bucketName": "iven-test-cloudv",
        "uploadUrl": "https://upload.cloudv.haplat.net",
        "uploadToken": "7e7dae54118c45a6ffd213a*****",
        "fileKey": "video/20230129/aea31e8fa8b441eba82ae0d0d900cf3b/555555554o90q7np55560365422q21os_62363dfef1a8446db77f4931a179a676.mp4",
        "httpDnsServer": "",
        "videoId": "fb67d77901851000ca2d54b900000000"
    },
    "message": "Operation successfully"
}

Error Code

The following error codes are dedicated for get video upload token request. For common errors, see Common Responses.

Error Code Description
1500 The file name has exceeded 40 characters.
1604 The file MD5 value cannot be empty.
1605 The length of MD5 string is too long.
1606 The video name cannot be empty.
1607 Video source error.
1608 Parameter overwrite is neither 0 nor 1.
1609 Video size can only be a non-negative integer.
1610 Video size has exceeded the limit.
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!