All Products
Search
Document Center

Intelligent Media Services:CreateUploadMedia

Last Updated:Dec 16, 2024

Obtains the upload URL and credential of a media asset and creates information about the media asset.

Operation description

  • You can call this operation to obtain the upload URLs and credentials of audio and video files. You can also call this operation to obtain the upload URLs and credentials of images and auxiliary media assets.
  • Obtaining an upload URL and credential is essential for Intelligent Media Services (IMS) and is required in each upload operation.
  • If the video upload credential expires, you can call the RefreshUploadMedia operation to obtain a new upload credential. The default validity period of a video upload credential is 3,000 seconds.
  • After you upload a media asset, you can configure a callback to receive upload event notifications or call the GetMediaInfo operation to determine whether the media asset is uploaded based on the returned status.
  • The MediaId parameter returned by this operation can be used for media asset lifecycle management or media processing.
  • You can call this operation to upload media assets only to ApsaraVideo VOD, but not to your own Object Storage Service (OSS) buckets. To upload a media asset to your own OSS bucket, you can upload the file to your OSS bucket by using OSS SDK, and then call the RegisterMediaInfo operation to register the file in the OSS bucket with the media asset library.
  • This operation is available only in the China (Shanghai), China (Beijing), and China (Shenzhen) regions.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ice:CreateUploadMediacreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
AppIdstringNo

The application ID. Default value: app-1000000.

app-1000000
EntityIdstringNo

The entity ID. You can call the CreateEntity operation to create an entity and specify a dynamic metadata structure.

9e177cac2fb44f8b8c67b199fcc7bffd
FileInfostringNo

The file information, which is in the JSON format and contains the following fields:

  • Type: required. The file type. Valid values: video, image, audio, text, and other.
  • Name: required. The file name without the extension.
  • Size: optional. The file size.
  • Ext: required. The file name extension.
{\"Type\":\"video\",\"Name\":\"test.mp4\",\"Size\":108078336,\"Ext\":\"mp4\"}
UserDatastringNo

The user data. The value must be a JSON string. You can configure settings such as message callbacks.

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

The destination storage address.

Set StorageType to oss.

Set StorageLocation to an address in ApsaraVideo VOD. You cannot set this field to an OSS URL.

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

The metadata of the media asset, which is a JSON string that contains the following fields:

Title: required.

  • The value can be up to 128 characters in length.
  • The value must be encoded in UTF-8.

Description: optional.

  • The value can be up to 1,024 characters in length.
  • The value must be encoded in UTF-8.

CateId: optional.

Tags: optional.

BusinessType: required. Valid values:

  • opening or ending if Type is set to video
  • default or cover if Type is set to image
  • subtitles or font if Type is set to text
  • watermark if Type is set to material
  • general CoverURL: optional.

DynamicMetaData: The value is a string.

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

The postprocessing configurations. You can specify this parameter if Type is set to video or audio.

Set ProcessType to Workflow.

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

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

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

The ID of the media asset.

****20b48fb04483915d4f2cd8ac****
MediaURLstring

The URL of the media asset.

Note If a domain name for Alibaba Cloud CDN (CDN) is specified, a CDN URL is returned. Otherwise, an OSS URL is returned. If the HTTP status code 403 is returned when you access the URL from your browser, the URL authentication feature of ApsaraVideo VOD is enabled. To resolve this issue, disable URL authentication or generate an authentication signature.
https://xxq-live-playback.oss-cn-shanghai.aliyuncs.com/capture/5d96d2b4-111b-4e5d-a0e5-20f44405bb55.mp4
FileURLstring

The OSS URL of the file. The URL does not contain the information used for authentication.

http://outin-***.oss-cn-north-2-gov-1.aliyuncs.com/sv/40360f05-181f63c3110-0004-cd8e-27f-de3c9.mp4
UploadAddressstring

The upload URL.

Note The returned upload URL is a Base64-encoded URL. You must decode the Base64-encoded upload URL before you use an SDK or call an API operation to upload media files. You need to parse UploadAddress only if you use OSS SDK or call an OSS API operation to upload media files.
eyJFbmRwb2ludCI6Imh0dHBzOi8vb3NzLWNuLXNoYW5naGFpLmFsaXl1bmNzLmNvbSIsIkJ1Y2tldCI6InN6aGQtdmlkZW8iLCJGaWxlTmFtZSI6InZvZC0yOTYzMWEvc3YvNTBmYTJlODQtMTgxMjdhZGRiMTcvNTBmYTJlODQtMTgxMjdhZGRiM***
UploadAuthstring

The upload credential.

Note The returned upload credential is a Base64-encoded value. You must decode the Base64-encoded upload URL before you use an SDK or call an API operation to upload media files. You need to parse UploadAuth only if you use OSS SDK or call an OSS API operation to upload media files.
eyJBY2Nlc3NLZXlJZCI6IkxUQUk0Rm53bTk1dHdxQjMxR3IzSE5hRCIsIkFjY2Vzc0tleVNlY3JldCI6Ik9lWllKR0dTMTlkNkZaM1E3UVpJQmdmSVdnM3BPaiIsIkV4cGlyYXRpb24iOiI***

Examples

Sample success responses

JSONformat

{
  "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": "eyJFbmRwb2ludCI6Imh0dHBzOi8vb3NzLWNuLXNoYW5naGFpLmFsaXl1bmNzLmNvbSIsIkJ1Y2tldCI6InN6aGQtdmlkZW8iLCJGaWxlTmFtZSI6InZvZC0yOTYzMWEvc3YvNTBmYTJlODQtMTgxMjdhZGRiMTcvNTBmYTJlODQtMTgxMjdhZGRiM***",
  "UploadAuth": "eyJBY2Nlc3NLZXlJZCI6IkxUQUk0Rm53bTk1dHdxQjMxR3IzSE5hRCIsIkFjY2Vzc0tleVNlY3JldCI6Ik9lWllKR0dTMTlkNkZaM1E3UVpJQmdmSVdnM3BPaiIsIkV4cGlyYXRpb24iOiI***"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history