You can invoke getAudioUploadToken to obtain audio file upload addresses and credentials. You can obtain a maximum of 50 audio file upload addresses and credentials in batches.
Name | Description |
---|---|
*fileListString | A list of documents that need to get the up-token, expressed as a json string, with url_safe_base64 encoding, up to 50 at a time
The parameters are as follows:
1) name: Mandatory. The name of the upload file can contain a maximum of 200 characters
2) suffix: Mandatory, file suffix, such as mp3. Currently, only mp3 format is supported
For example: Made from the following string url_safe_base64 coding [{"name":"fileName1","suffix":"mp3"},{"name":"fileName2","suffix":"mp3"}] |
domainString | Audio domain name: If this parameter is left blank, set it to the default audio domain name. If the domain name does not exist, an error is returned. Without http:// or https://, for example, xxx.com |
overwriteBoolean | Upload policy, whether to overwrite. Default to true |
Name | Description |
---|---|
codeInteger | Result status code, 200 indicates success |
messageString | message |
dataObject | Return data |
uploadUrlString | Upload url address |
bucketNameString | The bucket name of the WCS to upload |
httpDnsServerString | HttpDns server address |
itemsList | Specific token information |
nameString | File name |
suffixString | File suffix |
audioIdString | Audio id |
uploadTokenString | Upload token |
fileFullUrlString | The path of the token file was uploaded |
Error code(code) | Description(message) | HTTP status | Semantic |
---|---|---|---|
1000 | Parameter error | 200 | Parameter error |
#!/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 "http://api.cdnetworks.com/vod/audioManage/getAudioUploadToken?fileList=W3sibmFtZSI6ImZpbGVOYW1lMSIsInN1ZmZpeCI6Im1wMyJ9LHsibmFtZSI6ImZpbGVOYW1lMiIsInN1ZmZpeCI6Im1wMyJ9XQ%3D%3D&domain=xxxx.com&overwrite=true" \ -X "GET" \ -u "$username:$password" \ -H "Date: $date" \ -H "x-cnc-auth-method: BASIC" \ -H "Content-Type: application/json" \ -H "Accept: application/json"
{ "code": 200, "data": { "bucketName": "ovptest", "httpDnsServer": "https://sdkoptedge.chinanetcenter.com", "items": [ { "audioId": "55fcf2d601651000a8262f9200000000", "fileFullUrl": "audio/201808/55fcf2d601651000bdf74e8200000000_1534745965/55fcf2d601651000bdf74e8200000000.mp3", "name": "fileName1", "suffix": "mp3", "uploadToken": "7e7dae54118c45a6ffd213a18c9d4847b51a73f1:NWFmNWQ1NTQ2NGVkODQ2ZjNkYmUyNWQ5YTdlNjg3ZWEzOTNkOTBlOA==:eyJzY29wZSI6Im92cHRlc3Q6YXVkaW8vMjAxODA4LzU1ZmNmMmQ2MDE2NTEwMDBiZGY3NGU4MjAwMDAwMDAwXzE1MzQ3NDU5NjUvNTVmY2YyZDYwMTY1MTAwMGJkZjc0ZTgyMDAwMDAwMDAubXAzIiwiZGVhZGxpbmUiOiIxNTY2MjgxOTY1MjcxIiwib3ZlcndyaXRlIjoxLCJmc2l6ZUxpbWl0IjowLCJjYWxsYmFja1VybCI6Imh0dHA6Ly8xMTEuMjA2LjIxOS4yMzU6OTcxMS9jYWxsYmFjay9jYWxsYmFjayFhdWRpb1VwbG9hZENhbGxiYWNrLmFjdGlvbiIsImNhbGxiYWNrQm9keSI6IiZidWNrZXQ9JChidWNrZXQpJmtleT0kKGtleSkmZm5hbWU9JChmbmFtZSkmZnNpemU9JChmc2l6ZSkmbWltZVR5cGU9JChtaW1lVHlwZSkmdXJsPSQodXJsKSZpcD0kKGlwKSZjb3N0VGltZT0kKGNvc3RUaW1lKSZhdmluZm89JChhdmluZm8pJmF1ZGlvSWQ9NTVmY2YyZDYwMTY1MTAwMGE4MjYyZjkyMDAwMDAwMDAmY3VzdG9tZXJJZD0xNjA2MTImdXNlck5hbWU9YjNad2RHVnpkQT09JmRvbWFpbklkPTgzMTU3JmZpbGVOYW1lPVptbHNaVTVoYldVeCJ9" }, { "audioId": "55fcf2ff0165100008274b0000000000", "fileFullUrl": "audio/201808/55fcf2ff016510008f88a69200000000_1534745965/55fcf2ff016510008f88a69200000000.mp3", "name": "fileName2", "suffix": "mp3", "uploadToken": "7e7dae54118c45a6ffd213a18c9d4847b51a73f1:NDFkOWQyNzI3YTc2OGE0MGQxYWIwNDZlOTU1ZjMxZWMxYjQ1MmZhNw==:eyJzY29wZSI6Im92cHRlc3Q6YXVkaW8vMjAxODA4LzU1ZmNmMmZmMDE2NTEwMDA4Zjg4YTY5MjAwMDAwMDAwXzE1MzQ3NDU5NjUvNTVmY2YyZmYwMTY1MTAwMDhmODhhNjkyMDAwMDAwMDAubXAzIiwiZGVhZGxpbmUiOiIxNTY2MjgxOTY1MzExIiwib3ZlcndyaXRlIjoxLCJmc2l6ZUxpbWl0IjowLCJjYWxsYmFja1VybCI6Imh0dHA6Ly8xMTEuMjA2LjIxOS4yMzU6OTcxMS9jYWxsYmFjay9jYWxsYmFjayFhdWRpb1VwbG9hZENhbGxiYWNrLmFjdGlvbiIsImNhbGxiYWNrQm9keSI6IiZidWNrZXQ9JChidWNrZXQpJmtleT0kKGtleSkmZm5hbWU9JChmbmFtZSkmZnNpemU9JChmc2l6ZSkmbWltZVR5cGU9JChtaW1lVHlwZSkmdXJsPSQodXJsKSZpcD0kKGlwKSZjb3N0VGltZT0kKGNvc3RUaW1lKSZhdmluZm89JChhdmluZm8pJmF1ZGlvSWQ9NTVmY2YyZmYwMTY1MTAwMDA4Mjc0YjAwMDAwMDAwMDAmY3VzdG9tZXJJZD0xNjA2MTImdXNlck5hbWU9YjNad2RHVnpkQT09JmRvbWFpbklkPTgzMTU3JmZpbGVOYW1lPVptbHNaVTVoYldVeSJ9" } ], "uploadUrl": "https://upload.cloudv.haplat.net" }, "message": "Operation succeeded" }