Call getMaterialUploadToken to obtain the upload address and credentials of materials. You can batch obtain a maximum of 50 material addresses and credentials.
Name | Description |
---|---|
*fileListList | |
*nameString | The upload file name contains a maximum of 40 characters |
suffixString | File suffix |
domainString | Material domain name. If this parameter is left blank, set it to the default material 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 is false |
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 |
materialIdString | Material id |
uploadTokenString | Upload token |
fileFullUrlString | File path |
Error code(code) | Description(message) | HTTP status | Semantic |
---|---|---|---|
1301 | User has no permission | 200 | User has no permission |
1004 | The parameter is incorrect. Please ensure that all required fields are filled in | 200 | The parameter is incorrect. Please ensure that all required fields are filled in |
1000 | The file list is invalid | 200 | The file list is invalid |
1000 | The material suffix is out of the length range | 200 | The material suffix is out of the length range |
1000 | Invalid domain name | 200 | Invalid domain name |
#!/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/material/getMaterialUploadToken" \ -X "POST" \ -u "$username:$password" \ -H "Date: $date" \ -H "x-cnc-auth-method: BASIC" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "fileList":[{"name":"test01","suffix":"jpg"},{"name":"test02","suffix":"jpeg"}], "domain":"xxxx.com", "overwrite":false }'
{ "code": 200, "data": { "bucketName": "ovptest", "items": [ { "fileFullUrl": "ovptest:cloudv-material/20200629/feb8ec8801721000b3c0f2f500000000.jpg", "materialId": "feb8ec880172100060d1cff500000000", "name": "test01.", "suffix": "jpg", "uploadToken": "7e7dae54118c45a6ffd213a18c9d4847b51a73f1:NzNiZjc2NzRkYjUzMTk0NDY4NDhiNGY2N2YxMjVlOWNjZjBjMjBiYg==:eyJzY29wZSI6Im92cHRlc3Q6Y2xvdWR2LW1hdGVyaWFsLzIwMjAwNjI5L2ZlYjhlYzg4MDE3MjEwMDBiM2MwZjJmNTAwMDAwMDAwLmpwZyIsImRlYWRsaW5lIjoiOTIyMzM3MjAzNjg1NDc3NTgwNyIsIm92ZXJ3cml0ZSI6MCwiZnNpemVMaW1pdCI6MCwiY2FsbGJhY2tVcmwiOiJodHRwOi8vY2FsbGJhY2tkZXYub3ZwdGVzdC5oYXBsYXQubmV0L2NhbGxiYWNrL2NhbGxiYWNrIW1hdGVyaWFsVXBsb2FkQ2FsbGJhY2suYWN0aW9uIiwiY2FsbGJhY2tCb2R5IjoiJmtleT0kKGtleSkmZm5hbWU9dGVzdDAxLmpwZyZmc2l6ZT0kKGZzaXplKSZtaW1lVHlwZT0kKG1pbWVUeXBlKSZ1cmw9JCh1cmwpJm1hdGVyaWFsSWQ9ZmViOGVjODgwMTcyMTAwMDYwZDFjZmY1MDAwMDAwMDAmdXNlck5hbWU9b3ZwdGVzdCZkb21haW5JZD04MzA1In0=" }, { "fileFullUrl": "ovptest:cloudv-material/20200629/feb8eca801721000462961b400000000.jpeg", "materialId": "feb8eca8017210001ddc3b3900000000", "name": "test02.", "suffix": "jpeg", "uploadToken": "7e7dae54118c45a6ffd213a18c9d4847b51a73f1:MWU4NWM3YWIxOWUwN2MyYmIwYTNkMjdlYjQzMjQxMDg4NjAzZjE1Yg==:eyJzY29wZSI6Im92cHRlc3Q6Y2xvdWR2LW1hdGVyaWFsLzIwMjAwNjI5L2ZlYjhlY2E4MDE3MjEwMDA0NjI5NjFiNDAwMDAwMDAwLmpwZWciLCJkZWFkbGluZSI6IjkyMjMzNzIwMzY4NTQ3NzU4MDciLCJvdmVyd3JpdGUiOjAsImZzaXplTGltaXQiOjAsImNhbGxiYWNrVXJsIjoiaHR0cDovL2NhbGxiYWNrZGV2Lm92cHRlc3QuaGFwbGF0Lm5ldC9jYWxsYmFjay9jYWxsYmFjayFtYXRlcmlhbFVwbG9hZENhbGxiYWNrLmFjdGlvbiIsImNhbGxiYWNrQm9keSI6IiZrZXk9JChrZXkpJmZuYW1lPXRlc3QwMi5qcGVnJmZzaXplPSQoZnNpemUpJm1pbWVUeXBlPSQobWltZVR5cGUpJnVybD0kKHVybCkmbWF0ZXJpYWxJZD1mZWI4ZWNhODAxNzIxMDAwMWRkYzNiMzkwMDAwMDAwMCZ1c2VyTmFtZT1vdnB0ZXN0JmRvbWFpbklkPTgzMDUifQ==" } ], "uploadUrl": "https://upload.cloudv.haplat.net" }, "message": "Operation succeeded" }