All Products
Search
Document Center

ApsaraVideo VOD:CreateUploadAttachedMedia

更新時間:Jul 29, 2024

Obtains an upload URL and an upload credential for an auxiliary media asset such as a watermark image, subtitle file, or material and generates the media ID. ApsaraVideo VOD issues upload URLs and credentials to perform authorization and ensure security. This prevents unauthorized users from uploading media files. ApsaraVideo VOD generates media IDs together with upload URLs and credentials. Media IDs are used in lifecycle management and media processing.

Operation description

  • Make sure that you understand the billing method and prices 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 can call this operation only to obtain the upload URLs and credentials for media files and create media assets in ApsaraVideo VOD. You cannot call this operation to upload media files. For more information about how to upload media files by calling API operations, see Upload media files by calling API operations.
  • If the upload credential expires after 3,000 seconds, you can call the CreateUploadAttachedMedia operation again to obtain a new upload URL and a new upload credential.
  • You can configure a callback to receive an AttachedMediaUploadComplete event notification to determine whether the upload is successful.
  • You must obtain a URL and a credential before you upload a media file to ApsaraVideo VOD. ApsaraVideo VOD supports multiple upload methods. Each method has different requirements on upload URLs and credentials. For more information, see Upload URLs and credentials.

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

Request parameters

ParameterTypeRequiredDescriptionExample
TitlestringNo

The title of the auxiliary media asset. The following rules apply:

  • The title cannot exceed 128 bytes.
  • The title must be encoded in UTF-8.
testTitle
BusinessTypestringYes

The type of the auxiliary media asset. Valid values:

  • watermark
  • subtitle
  • material
watermark
MediaExtstringYes

The file name extension of the auxiliary media asset.

  • 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 source file URL of the auxiliary media asset.

Note The file name extension is optional. If the file name extension that you specified for this parameter is different from the value of MediaExt, the value of MediaExt takes effect.
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 address. Perform the following operations to obtain the storage address:

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

Note If you leave this parameter empty, 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
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. For example, you can specify callback configurations and upload acceleration configurations. The value must be a JSON string. For more information, see Request parameters.

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 HTTP callback settings in the ApsaraVideo VOD console, see Configure callback settings.
  • If you want to enable the upload acceleration feature, submit a ticket. For more information, see Overview . For more information about how to submit a ticket, see Contact us.
  • {"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}}
    CateIdsstringNo

    The ID of the category. Separate multiple IDs with commas (,). You can specify up to five IDs. You can use one of the following methods to obtain the ID:

    • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Categories to view the category ID of the media file.
    • Obtain the category ID from the response to the AddCategory operation that you call to create a category.
    • Obtain the category ID from the response to the GetCategories operation that you call to query categories.
    1298****,0813****
    AppIdstringNo

    The ID of the application. Default value: app-1000000. If you have activated the multi-application service, specify the ID of the application to add the watermark template in the specified application. For more information, see Overview .

    app-****

    Response parameters

    ParameterTypeDescriptionExample
    object

    The response parameters.

    FileURLstring

    The URL of the auxiliary media asset file. The URL is an Object Storage Service (OSS) URL and does not contain the information used for URL signing.

    You can use specify this value for the FileUrl parameter when you call the AddWatermark operation to create a watermark template.

    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 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. To resolve this issue, you can disable the URL signing feature or generate a signed URL.
    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