The upload URL and credential are provided by ApsaraVideo VOD to address authorization and security concerns, prevent malicious uploads, and enable automatic creation of a media asset ID (MediaId) for management and processing. For auxiliary media assets such as watermarks and subtitles, invoke this operation to obtain the upload credential and create the corresponding media asset information.
Operation description
Before using this operation, make sure that you understand the billing methods and pricing of ApsaraVideo VOD. Uploading media files to ApsaraVideo VOD incurs storage fees. For more information, see Media asset storage billing. If you have enabled storage transfer acceleration, uploading media files to ApsaraVideo VOD also incurs upload acceleration fees. For more information, see Storage transfer acceleration billing.
This operation only obtains the upload URL and credential and creates basic media asset information. It does not upload files. For a complete example of uploading files by using the API, see Upload media files by using the ApsaraVideo VOD API.
If the upload credential expires (valid for 3000 seconds), call this operation again to obtain a new upload URL and credential.
You can configure callbacks to receive event notifications for auxiliary media asset upload complete to determine whether the upload is successful.
Obtaining the upload URL and credential is a core fundamental of ApsaraVideo VOD and a required step for every upload operation. ApsaraVideo VOD provides various upload methods, each with different requirements for obtaining the upload URL and credential. For more information, see the instructions in Upload URLs and credentials.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vod:CreateUploadAttachedMedia |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Title |
string |
No |
The title of the auxiliary media asset. Rules:
|
Test |
| BusinessType |
string |
Yes |
The type of the auxiliary media asset. Valid values:
|
watermark |
| MediaExt |
string |
No |
The file name extension of the auxiliary media asset source file to be uploaded. Valid values:
Valid values:
|
png |
| FileName |
string |
No |
The source file address of the auxiliary media asset to be uploaded. Note
The file name extension is optional. If a file name extension is specified here and is different from the extension specified in MediaExt, the value of MediaExt takes precedence. |
D:\test.png |
| FileSize |
string |
No |
The file size. Unit: bytes. |
123 |
| Tags |
string |
No |
The tags. Rules:
|
tag1,tag2 |
| StorageLocation |
string |
No |
The storage address. You can obtain the storage address by using the following method: Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Management Configuration > Storage Management to view the storage address. Note
If you do not specify this parameter, the auxiliary media asset is uploaded to the default storage address. If you specify this parameter, the auxiliary media asset is uploaded to the specified storage address. |
out-****.oss-cn-shanghai.aliyuncs.com |
| Description |
string |
No |
The description of the media asset. Rules:
|
uploadTest |
| UserData |
string |
No |
The custom settings, which is a JSON string. The settings support message callbacks, upload acceleration, and other configurations. For more information, see UserData. Note
|
{"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}} |
| CateIds |
string |
No |
The category IDs. Separate multiple IDs with commas (,). A maximum of 5 IDs are supported. You can obtain category IDs by using the following methods:
|
1298****,0813**** |
| AppId |
string |
No |
The application ID. Default value: app-1000000. If you have activated the multi-application service, specify the application ID to upload the auxiliary media asset to the specified application. For more information, see Multi-application. |
app-**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| FileURL |
string |
The OSS URL of the auxiliary media asset file (without authentication). When you add an image watermark template, this URL can be used as the request parameter |
https://****.oss-cn-shanghai.aliyuncs.com/watermark/****.mov |
| RequestId |
string |
The request ID. |
73254DE5-F260-4720-D06856B63C01**** |
| UploadAddress |
string |
The upload URL. Note
The upload URL returned by the operation is a Base64-encoded value. When you use the SDK or API to upload media assets, you must Base64-decode the value before use. Only uploads by using the OSS native SDK or OSS API require you to parse UploadAddress yourself. |
LWNuLXNoYW5naGFpLmFsaXl1b**** |
| MediaId |
string |
The media asset ID. |
97dc17a5abc3668489b84ce9**** |
| MediaURL |
string |
The access URL of the media asset. If a CDN domain name is configured, a CDN URL is returned. Otherwise, an OSS URL is returned. Note
If the returned MediaURL is inaccessible in a browser (403), you have enabled URL authentication for the VOD domain name. You can disable URL authentication or generate an authentication signature yourself. |
http://example.aliyundoc.com/watermark/****.mov?auth_key=**** |
| UploadAuth |
string |
The upload credential. Note
The upload credential returned by the operation is a Base64-encoded value. When you use the SDK or API to upload media assets, you must Base64-decode the value before use. Only uploads by using the OSS native SDK or OSS API require you to parse UploadAuth yourself. |
UzFnUjFxNkZ0NUIZTaklyNWJoQ00zdHF**** |
Examples
Success response
JSON format
{
"FileURL": "https://****.oss-cn-shanghai.aliyuncs.com/watermark/****.mov",
"RequestId": "73254DE5-F260-4720-D06856B63C01****",
"UploadAddress": "LWNuLXNoYW5naGFpLmFsaXl1b****",
"MediaId": "97dc17a5abc3668489b84ce9****",
"MediaURL": "http://example.aliyundoc.com/watermark/****.mov?auth_key=****",
"UploadAuth": "UzFnUjFxNkZ0NUIZTaklyNWJoQ00zdHF****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.