All Products
Search
Document Center

CreateUploadAttachedMedia

Last Updated: Jul 11, 2019

Description

You can call this operation to obtain the upload URL and credential for an attached media asset such as a watermark or subtitle file.

Request parameters

Name Type Required Description
Action String Yes The operation that you want to perform. Set this parameter to CreateUploadAttachedMedia.
BusinessType String Yes The business type. Valid values:
  • watermark
  • subtitle
  • material
MediaExt String Yes The file name extension of the attached media asset. Valid values:
  • For watermarks: png, gif, apng, and mov
  • For subtitles: srt, ass, stl, ttml, and vtt
  • For materials: jpg, gif, png, mp4, mat, and zip
Title String No The title of the attached media asset. Rules:
  • Length constraint: Maximum length of 128 bytes.
  • Encoding: UTF-8.
CateIds String No The ID of the category.
  • Separate multiple category IDs with commas (,). You can enter a maximum of five category IDs.
  • To view or edit the category ID, log on to the ApsaraVideo for VOD console and choose Global Settings > Categories in the left-side navigation pane.
FileName String No The name of the mezzanine file.
FileSize String No The file size. Unit: bytes.
Tags String No The tag of the attached media asset. Rules:
  • Length constraint per tag: Maximum length of 32 bytes.
  • You can enter a maximum of 16 tags.
  • Separate multiple tags with commas (,).
  • Encoding: UTF-8.
Description String No The description of the attached media asset.
  • Length constraint: Maximum length of 1,024 bytes.
  • Encoding: UTF-8.
StorageLocation String No The bucket. If you specify this parameter, the file is uploaded to the specified bucket. To view the bucket, log on to the ApsaraVideo for VOD console and click Storage in the left-side navigation pane.
UserData UserData No The custom configurations, such as the callback configuration. The value is a JSON-formatted string.
AppId String No The ID of the application, in app-xxxxxxx format. Default value: app-1000000. For more information, see Multi-application system.

Response parameters

Name Type Description
RequestId String The ID of the request.
UploadAddress String The upload URL.
UploadAuth String The upload credential.
MediaId String The ID of the media asset.
MediaURL String The URL of the media asset. If a CDN domain name was specified, a CDN URL was returned. Otherwise, an OSS URL was returned.
FileURL String The OSS URL of the file (without URL signing). The value can be passed in as the FileUrl parameter for the AddWatermark operation.

Note:

  • This operation does not upload files of attached media assets. To upload a file, you need to obtain the upload URL and credential for the file, and then use an upload SDK to upload it. The process is the same as that of uploading videos and images.
  • If the upload credential expires, call this operation again to obtain the upload URL and a new upload credential. The validity period of an upload credential is 3,000 seconds.
  • If you have enabled the domain name authentication feature of ApsaraVideo for VOD, you cannot access the returned MediaURL in a browser and the HTTP status code 403 is returned. To resolve this issue, you can disable URL signing or generate a signed URL.
  • For more information, see Upload URL and credential.

API examples

Sample request

http://vod.cn-shanghai.aliyuncs.com/?Action=CreateUploadAttachedMedia&MediaType=watermark&MediaExt=mov&Format=JSON&<Common request parameters>

Note: For more information about common request parameters, see Common parameters.

Sample response

JSON format

{
"RequestId": "C1E04A5B-BFD8-4BD8-BA96-95E7CEBXXXXX",
"MediaId": "xxxxxxxxxxxxxxxxxxxxxxx",
"UploadAddress": "eyJFbmRwb2lud...",
"UploadAuth": "eyJTZWN1cml0e..."
" FileURL": "https://sample.oss-cn-shanghai.aliyuncs.com/watermark/xxxx.mov",
"MediaURL": "http://sample.com/watermark/xxxx.mov?auth_key=xxxx",
}

SDK examples

We recommend that you use a server SDK to call this operation. For more information about the sample code used to call this operation in various languages, see the following topics: