Retrieves the upload URL and credential for audio, video, image, and auxiliary media assets, and creates media asset information.
Operation description
Operation description
Retrieving the upload URL and credential is a core foundation of Intelligent Media Services and a required procedure for every upload operation.
If the video upload credential expires (the default validity epoch is 3000 seconds), invoke the refresh video upload credential operation to obtain a new upload credential.
After the upload, you can configure callbacks to accept upload event notifications, or invoke the GetMediaInfo operation to check the returned media asset status to determine whether the upload is successful.
The MediaId parameter returned by this operation can be used for media asset lifecycle management or media processing.
Limits
This operation supports uploads only to VOD storage. Uploads to user-owned OSS storage are not supported. If you use your own OSS storage, upload files to OSS by using the OSS SDK, and then invoke the RegisterMediaInfo operation to register the OSS file in the media library.
This operation currently supports only the China (Shanghai), China (Beijing), and China (Shenzhen) regions.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ice:CreateUploadMedia |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| AppId |
string |
No |
The application ID. Default value: app-1000000. |
app-1000000 |
| EntityId |
string |
No |
The entity ID. You can call the CreateEntity operation to create an entity and customize the dynamic metadata structure. |
9e177cac2fb44f8b8c67b199fcc7bffd |
| FileInfo |
string |
No |
The file information in JSON format. This parameter contains the following fields:
|
{\"Type\":\"video\",\"Name\":\"test\",\"Size\":108078336,\"Ext\":\"mp4\"} |
| UserData |
string |
No |
The custom settings. The value is a JSON string that supports settings such as message callbacks. |
{"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"*****","test":"www"}} |
| UploadTargetConfig |
string |
No |
The destination storage address.
|
{\"StorageType\":\"oss\",\"StorageLocation\":\"outin-***.oss-cn-shanghai.aliyuncs.com\"} |
| MediaMetaData |
string |
No |
The metadata of the media asset to upload, in JSON format. Title (required):
Description (optional):
CateId (optional): the category ID. Tags (optional): the tags. BusinessType (required): the business type. Valid values:
CoverURL (optional): the cover URL. DynamicMetaData: the dynamic metadata. The value is a string. |
{\"Title\": \"UploadTest\", \"Description\": \"UploadImageTest\", \"Tags\": \"tag1,tag2\",\"BusinessType\":\"cover\"} |
| PostProcessConfig |
string |
No |
Specifies the post-upload processing action when Type = video or audio. ProcessType: set to Workflow. Note
|
{\"ProcessType\":\"Workflow\",\"ProcessID\":\"74ba870f1a4873a3ba238e0bf6fa9***\"} |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
4E84BE44-58A7-****-****-FBEBEA16EF94 |
| MediaId |
string |
The media asset ID. |
****20b48fb04483915d4f2cd8ac**** |
| MediaURL |
string |
The media asset URL. Note
If a CDN domain name is configured, a CDN URL is returned. Otherwise, an OSS URL is returned. If the returned MediaURL is inaccessible (403) in a browser, URL signing is enabled for the VOD domain name. Disable URL signing or generate a signing signature. |
https://xxq-live-playback.oss-cn-shanghai.aliyuncs.com/capture/5d96d2b4-111b-4e5d-a0e5-20f44405bb55.mp4 |
| FileURL |
string |
The OSS URL of the file (without authentication). |
http://outin-***.oss-cn-north-2-gov-1.aliyuncs.com/sv/40360f05-181f63c3110-0004-cd8e-27f-de3c9.mp4 |
| UploadAddress |
string |
The upload address. Note
The upload address returned by the operation is a Base64-encoded value. When you call an SDK or API to upload media assets, decode the value by using Base64 before use. Only uploads through the native OSS SDK or OSS API require you to parse UploadAddress. |
eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF**** |
| UploadAuth |
string |
The upload credential. Note
The upload credential returned by the operation is a Base64-encoded value. When you call an SDK or API to upload media assets, decode the value by using Base64 before use. Only uploads through the native OSS SDK or OSS API require you to parse UploadAuth. |
eyJFbmRwb2ludCI6Imm**** |
Examples
Success response
JSON format
{
"RequestId": "4E84BE44-58A7-****-****-FBEBEA16EF94",
"MediaId": "****20b48fb04483915d4f2cd8ac****",
"MediaURL": "https://xxq-live-playback.oss-cn-shanghai.aliyuncs.com/capture/5d96d2b4-111b-4e5d-a0e5-20f44405bb55.mp4",
"FileURL": "http://outin-***.oss-cn-north-2-gov-1.aliyuncs.com/sv/40360f05-181f63c3110-0004-cd8e-27f-de3c9.mp4",
"UploadAddress": "eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****",
"UploadAuth": "eyJFbmRwb2ludCI6Imm****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.