CreateUploadMedia

更新时间:
复制 MD 格式

This operation retrieves an upload address and upload credential for audio, video, image, and auxiliary media assets, and creates the corresponding media asset.

Operation description

Overview

  • Obtaining an upload address and upload credential is a prerequisite for all uploads in Intelligent Media Service.

  • If an upload credential expires (the default validity is 3,000 seconds), call the RefreshUploadMedia operation to get a new one.

  • After an upload is complete, you can confirm its success by either configuring a callback for event notifications or calling the GetMediaInfo operation to check the media asset's status.

  • Use the returned MediaId for media asset lifecycle management or media processing.

Limitations

  • This operation supports uploads only to VOD storage, not to your own Object Storage Service (OSS) buckets. If you use your own OSS buckets, first upload the files by using the OSS SDK, and then call the RegisterMediaInfo operation to register the OSS files in your media library.

  • This operation is available only in the China (Shanghai), China (Beijing), and China (Shenzhen) regions.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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. The default value is app-1000000.

app-1000000

EntityId

string

No

The ID of the entity. You can call the CreateEntity operation to create an entity and define a custom schema for dynamic metadata.

9e177cac2fb44f8b8c67b199fcc7bffd

FileInfo

string

No

The file information, provided as a JSON string containing the following fields:

  • Type (Required): The file type. Valid values: video, image, audio, text, and other.

  • Name (Required): The filename without the extension.

  • Size (Optional): The file size.

  • Ext (Required): The file extension.

{\"Type\":\"video\",\"Name\":\"test\",\"Size\":108078336,\"Ext\":\"mp4\"}

UserData

string

No

A JSON string for custom settings, such as configuring a message callback.

{"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"*****","test":"www"}}

UploadTargetConfig

string

No

The destination storage configuration, provided as a JSON string.

  • StorageType: Only oss is supported.

  • StorageLocation: Only VOD storage is supported. You cannot upload to your own OSS buckets.

{\"StorageType\":\"oss\",\"StorageLocation\":\"outin-***.oss-cn-shanghai.aliyuncs.com\"}

MediaMetaData

string

No

The media asset metadata, provided as a JSON string.

Title (Required):

  • The title can be up to 128 characters in length.

  • The title must be UTF-8 encoded.

Description (Optional):

  • The description can be up to 1,024 characters in length.

  • The description must be UTF-8 encoded.

CateId (Optional): The category ID.

Tags (Optional): The tags of the media asset, separated by commas.

BusinessType (Required): The business type. Valid values depend on the Type specified in FileInfo.

  • If Type is video: opening or ending.

  • If Type is image: default, cover, or watermark.

  • If Type is text: subtitles or font.

  • If Type is other: general.

CoverURL (Optional): The URL of the cover image.
DynamicMetaData (Optional): A string for custom dynamic metadata.

{\"Title\": \"UploadTest\", \"Description\": \"UploadImageTest\", \"Tags\": \"tag1,tag2\",\"BusinessType\":\"cover\"}

PostProcessConfig

string

No

The post-processing configuration for video or audio uploads.

Set ProcessType to Workflow.

Note
  • This parameter specifies an asynchronous task, which is queued and runs in the background after you submit the request.

{\"ProcessType\":\"Workflow\",\"ProcessID\":\"74ba870f1a4873a3ba238e0bf6fa9***\"}

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The ID of the request.

4E84BE44-58A7-****-****-FBEBEA16EF94

MediaId

string

The ID of the media asset.

****20b48fb04483915d4f2cd8ac****

MediaURL

string

The URL of the media asset.

Note

This will be a CDN URL if a CDN domain is configured, or an OSS URL otherwise. If you receive a 403 error when accessing this URL in a browser, it is likely because URL authentication is enabled for the VOD domain. To resolve this, either disable URL authentication or generate a signed URL for access.

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 parameters.

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 returned upload address is Base64-encoded and must be decoded before use. You only need to manually decode this address if you are using a native OSS SDK or an OSS API to perform the upload.

eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****

UploadAuth

string

The upload credential.

Note

The returned upload credential is Base64-encoded and must be decoded before use. You only need to manually decode this credential if you are using a native OSS SDK or an OSS API to perform the upload.

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.