All Products
Search
Document Center

ApsaraVideo VOD:CreateUploadAttachedMedia

Last Updated:Mar 03, 2024

Obtains a URL and a credential for uploading an auxiliary media asset, such as a watermark, subtitle, or material.

Operation description

  • Make sure that you understand the billing method and price of ApsaraVideo VOD before you call this operation. You are charged storage fees after you upload media files to ApsaraVideo VOD. For more information, see Billing of media asset storage. If you have activated the acceleration service, you are charged acceleration fees when you upload media files to ApsaraVideo VOD. For more information, see Billing of acceleration traffic.
  • You must obtain a URL and a credential before you upload an image to ApsaraVideo VOD. ApsaraVideo VOD provides multiple upload methods. You can upload auxiliary media assets by using SDKs for upload from servers, SDKs for upload from clients, URLs of auxiliary media assets, Object Storage Service (OSS) API, or OSS SDKs. Each upload method has different requirements for obtaining upload URLs and credentials. For more information, see the "Usage notes" section of the Upload URLs and credentials topic.
  • If the upload credential expires, you can call this operation to obtain a new upload URL and credential. The default validity period of an upload credential is 3,000 seconds.
  • You can configure a callback to receive an AttachedMediaUploadComplete event notification to determine whether the upload is successful.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
vod:CreateUploadAttachedMediaWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TitlestringNo

The title of the media asset. Take note of the following items:

  • The title can be up to 128 bytes in length.
  • The value must be encoded in UTF-8.
testTitle
BusinessTypestringYes

The type of the media asset. Valid values:

  • watermark
  • subtitle
  • material
watermark
MediaExtstringYes

The file name extension. Valid values:

  • Valid values for watermarks: png, gif, apng, and mov
  • Valid values for subtitles: srt, ass, stl, ttml, and vtt
  • Valid values for materials: jpg, gif, png, mp4, mat, zip, and apk
png
FileNamestringNo

The name of the source file.

D:\test.png
FileSizestringNo

The size of the auxiliary media asset. Unit: byte.

123
TagsstringNo

The one or more tags of the auxiliary media asset. Take note of the following items:

  • You can specify a maximum of 16 tags.
  • If you need to specify multiple tags, separate the tags with commas (,).
  • Each tag can be up to 32 characters in length.
  • The value must be encoded in UTF-8.
tag1,tag2
StorageLocationstringNo

The storage location. You can use one of the following methods to obtain the storage location:

Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Storage. On the Storage page, you can view the storage location.

Note If this parameter is set to a specific value, the auxiliary media asset is uploaded to the specified storage location.
out-****.oss-cn-shanghai.aliyuncs.com
DescriptionstringNo

The description of the auxiliary media asset. Take note of the following items:

  • The description can be up to 1,024 bytes in length.
  • The value must be encoded in UTF-8.
uploadTest
UserDatastringNo

The custom configurations, including callback configurations and upload acceleration configurations. The value is a JSON string. For more information, see the "UserData: specifies the custom configurations for media upload" section of the Request parameters topic.

Note
  • The callback configurations take effect only after you specify the HTTP callback URL and select the specific callback events in the ApsaraVideo VOD console. For more information about how to configure an HTTP callback in the ApsaraVideo VOD console, see Configure callback settings.
  • To use the upload acceleration feature, submit a ticket to enable this feature. For more information, see Overview .
  • {"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}}
    CateIdsstringNo

    The one or more category IDs of the auxiliary media asset. Separate multiple category IDs with commas (,). A maximum of five category IDs can be specified. You can use one of the following methods to obtain the category ID:

    • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Categories. On the Categories page, you can view the category ID.
    • View the value of the CateId parameter returned by the AddCategory operation that you called to create a category.
    • View the value of the CateId parameter returned by the GetCategories operation that you called to query a category.
    1298****,0813****
    AppIdstringNo

    The ID of the application. Default value: app-1000000. For more information, see Overview .

    app-****

    Response parameters

    ParameterTypeDescriptionExample
    object
    FileURLstring

    The OSS URL of the file. The URL does not contain the information used for URL signing. You can set the FileUrl parameter to this URL when you call the AddWatermark operation.

    https://****.oss-cn-shanghai.aliyuncs.com/watermark/****.mov
    RequestIdstring

    The ID of the request.

    73254DE5-F260-4720-D06856B63C01****
    UploadAddressstring

    The upload URL.

    Note The upload URL returned by this operation is Base64-encoded. Before you can use an SDK or an API operation to upload a media asset based on the upload URL, you must decode the upload URL by using the Base64 algorithm. You must parse the upload URL only if you use native OSS SDKs or OSS API for uploads.
    LWNuLXNoYW5naGFpLmFsaXl1b****
    MediaIdstring

    The ID of the auxiliary media asset.

    97dc17a5abc3668489b84ce9****
    MediaURLstring

    The URL of the auxiliary media asset. If a domain name for Alibaba Cloud CDN (CDN) is specified, a CDN URL is returned. Otherwise, an OSS URL is returned.

    Note If you enable the URL signing feature of ApsaraVideo VOD, you may be unable to access the returned URL of the auxiliary media asset by using a browser and the HTTP status code 403 may be returned. You can disable the URL signing feature or generate an authentication signature.
    http://example.aliyundoc.com/watermark/****.mov?auth_key=****
    UploadAuthstring

    The upload credential.

    Note The upload credential returned by this operation is Base64-encoded. Before you can use an SDK or an API operation to upload a media asset based on the upload credential, you must decode the upload credential by using the Base64 algorithm. You must parse the upload credential only if you use native OSS SDKs or OSS API for uploads.
    UzFnUjFxNkZ0NUIZTaklyNWJoQ00zdHF****

    Examples

    Sample success responses

    JSONformat

    {
      "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

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

    Change history

    Change timeSummary of changesOperation
    No change history