API Center

GetUploadToken

Update time: 2023-10-08 15:02:09

Applicable Products

Cloud VoD

API Description

Invoke getUploadToken to obtain the video file upload address and credentials

Call frequency

Single user trigger frequency: 300/5min

We recommend you to use API Explorer

The API Explorer provides the ability of visual interface online call API, code examples generation, and API documents quickly search .Try it

Request parameter(s)

Body Params

NameDescription
*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 and transcoding combination name. After successful upload, subtitle will be added automatically

Response parameter(s)

Body Params

NameDescription
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

Error code(code)Description(message)HTTP statusSemantic
1500The video name is more than 40 characters long200The video name is more than 40 characters long
1604The MD5 value of the file cannot be empty200The MD5 value of the file cannot be empty
1605The MD5 value of the file is too long. Procedure200The MD5 value of the file is too long. Procedure
1606The video name cannot be empty200The video name cannot be empty
1607Video source error200Video source error
1608The overwrite policy value can only be 0 or 1200The overwrite policy value can only be 0 or 1
1609Video size can only be a non-negative integer200Video size can only be a non-negative integer
1610The video size is out of range200The video size is out of range

Example

JSON
JSON
Request example
Copy Copy success
#!/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"
}'
Response example
Copy Copy success
{
	"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": "操作成功"
}
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!