Invoke getUploadToken to obtain the video file upload address and credentials
Name | Description |
---|---|
*originFileNameString | Upload the file name, including the file format |
fileIdString | File ID. The value is a string of up to 32 characters. It is used for resumable data from breakpoints. If the data is not transmitted, the resumable data from breakpoints is not supported. |
fileMd5String | md5 value of the file, to be deprecated and replaced by fileId |
domainString | If the video distribution domain name is not transmitted, the default video management domain name is used as the video distribution domain name. You can set the default domain name on the VOD Console > Global Configuration > Default Domain Name |
workflowIdString | Workflow ID, workflowId overrides cmd, waterMarkName, transCodeCombineName, and subtitleId |
overwriteInteger | Pass policy, whether to overwrite. Value range:
0(no)
1(Yes) |
categoryNamesString | Video classification. You can specify parent and child categories.Such as: [{"childName":"sub category 1","parentName":"parent category 1"},{"childName":"subclassification 2","parentName":"Parent category 2"}] |
waterMarkNameString | Watermark name. After successful upload, the watermark will be automatically transcoded |
transCodeCombineNameString | Transcoding combination name, after successful upload will automatically transcoding to increase clarity |
subtitleIdString | Subtitle ID, corresponding to the material ID of Cloud VOD material management. After successful upload, subtitles will be automatically Transcoding and added; only ass or srt subtitle formats are supported. |
subtitleString | Supports multiple subtitles, up to 13 subtitles can be added. Only supports multi- Bitrate adaptive Transcoding. Only supports vtt subtitle format.
The format content is:
lang: subtitle code, which can be defined according to your needs
subtitleId: subtitle ID, corresponding to the material ID of Cloud VOD material management
code[{"lang":"cn","subtitleId":"8a36dfe101921000368ac14400000000"},{"lang":"en-US","subtitleId":"8a38e428019210004d56ef8c00000000"},{"lang":"ko","subtitleId":"8a36dfe101921000368ac14400000000"}] base64 encryption
The subtitle language corresponding code of the console player.
Language code
Chinese: cn
English: en-US
Japanese:ja
Traditional Chinese:zh-tw
French:fr
German: de
Spanish: es
Portuguese:pt
Russian:ru
Korean:ko
Thai:th
Vietnamese:vt
Indonesian:id |
Name | Description |
---|---|
codeInteger | Create the result status code. 200 indicates success |
messageString | message |
dataObject | return data |
uploadUrlString | Upload domain address |
fileKeyString | The relative path to the uploaded file, without the domain name or the leading slash |
httpDnsServerString | HttpDns server address |
videoIdString | Video ID. You can use this ID to query information about the video after it is uploaded |
uploadTokenString | Upload token |
speedDomainlUrlString | [Planned Deprecation] Upload Accelerated domain address |
bucketNameString | Spatial name |
Error code(code) | Description(message) | HTTP status | Semantic |
---|---|---|---|
1500 | The video name is more than 40 characters long | 200 | The video name is more than 40 characters long |
1604 | The MD5 value of the file cannot be empty | 200 | The MD5 value of the file cannot be empty |
1605 | The MD5 value of the file is too long. Procedure | 200 | The MD5 value of the file is too long. Procedure |
1606 | The video name cannot be empty | 200 | The video name cannot be empty |
1607 | Video source error | 200 | Video source error |
1608 | The overwrite policy value can only be 0 or 1 | 200 | The overwrite policy value can only be 0 or 1 |
1609 | Video size can only be a non-negative integer | 200 | Video size can only be a non-negative integer |
1610 | The video size is out of range | 200 | The video size is out of range |
#!/bin/bash
username='example_username'
apiKey='example_apiKey'
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://api.cdnetworks.com/vod/videoManage/getUploadToken" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "x-cnc-auth-method: BASIC" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"originFileName": "test.mp4",
"fileId":"XXXXXX",
"domain":"xxxx.com",
"workflowId":"XXXXXX",
"categoryNames":"category1",
"waterMarkName":"waterMark1",
"transCodeCombineName":"transCodeCombine1",
"subtitleId":"XXXXXX",
"overwrite":"0"
}'
{
"code": 200,
"data": {
"fileKey": "video/201704/245bbb46f2c1456ae076d2f131949999_1492507971/test.flv",
"httpDnsServer": "https://sdkoptedge.chinanetcenter.com",
"uploadToken":"7e7dae54118c45a6ffd213a18c9d4847b51a73f1:NmVlZGVhMDNkYTMzMDY2MWE2ODU2Yjg1NjNlYTNkNTU0YmUyZmZiOA==:eyJzY29wZSI6Im92cHRlc3Q6dmlkZW8vMjAxNzA0LzI0NWJiYjQ2ZjJjMTQ1NmFlMDc2ZDJmMTMxOTQ5OTk5XzE0OTI1MDc5NzEvdGVzdCIsImRlYWRsaW5lIjoiMjUyNDYyMjQwMDAwMCIsIm92ZXJ3cml0ZSI6MCwiZnNpemVMaW1pdCI6MCwiY2FsbGJhY2tVcmwiOiJodHRwOi8vMTIwLjQxLjMuNDU6OTA4MS9jYWxsYmFjay9jYWxsYmFjayF1cGxvYWRDYWxsYmFjay5hY3Rpb24iLCJjYWxsYmFja0JvZHkiOiImYnVja2V0PSQoYnVja2V0KSZrZXk9JChrZXkpJmZuYW1lPSQoZm5hbWUpJmZzaXplPSQoZnNpemUpJm1pbWVUeXBlPSQobWltZVR5cGUpJnVybD0kKHVybCkmaXA9JChpcCkmY29zdFRpbWU9JChjb3N0VGltZSkmYXZpbmZvPSQoYXZpbmZvKSJ9",
"uploadUrl": "http://ovptest.up2.v1.wcsapi.com",
"videoId": "4B8F584A572B15712998422C3363177D",
},
"message": "Operation succeeded"
}