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

Usage notes

  • The process of obtaining upload URLs and credentials is a core process in ApsaraVideo VOD and is required for each upload operation. ApsaraVideo VOD provides multiple upload methods. You can upload auxiliary media assets by using server upload SDKs, client upload SDKs, URLs of auxiliary media assets, Object Storage Service (OSS) API, or native 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.

QPS limit

You can call this operation up to 100 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation. For more information, see QPS limits on API operations in ApsaraVideo VOD.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateUploadAttachedMedia

The operation that you want to perform. Set the value to CreateUploadAttachedMedia.

Title String No Test

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.
BusinessType String Yes watermark

The type of the media asset. Valid values:

  • watermark
  • subtitle
  • material
MediaExt String No png

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, and zip
FileName String No D:\test.png

The name of the source file.

FileSize String No 123

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

Tags String No tag1,tag2

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.
StorageLocation String No out-****.oss-cn-shanghai.aliyuncs.com

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.
Description String No uploadTest

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.
UserData String No null

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.
CateIds String No 1298****,0813****

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.
AppId String No app-****

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

Response parameters

Parameter Type Example Description
FileURL String https://****.oss-cn-shanghai.aliyuncs.com/watermark/****.mov

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.

RequestId String 73254DE5-F260-4720-D06856B63C01****

The ID of the request.

UploadAddress String LWNuLXNoYW5naGFpLmFsaXl1b****

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.
MediaId String 97dc17a5abc3668489b84ce9****

The ID of the auxiliary media asset.

MediaURL String http://example.aliyundoc.com/watermark/****.mov?auth_key=****

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.
UploadAuth String UzFnUjFxNkZ0NUIZTaklyNWJoQ00zdHF****

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.

Examples

Sample requests

http(s)://vod.cn-shanghai.aliyuncs.com/?Action=CreateUploadAttachedMedia
&Title=Test
&BusinessType=watermark
&MediaExt=png
&FileName=D:\test.png
&FileSize=123
&Tags=tag1,tag2
&StorageLocation=out-****.oss-cn-shanghai.aliyuncs.com
&Description=uploadTest
&UserData={"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}}
&CateIds=1298****,0813****
&AppId=app-****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateUploadAttachedMediaResponse>
    <FileURL>https://****.oss-cn-shanghai.aliyuncs.com/watermark/****.mov</FileURL>
    <RequestId>73254DE5-F260-4720-D06856B63C01****</RequestId>
    <UploadAddress>LWNuLXNoYW5naGFpLmFsaXl1b****</UploadAddress>
    <MediaId>97dc17a5abc3668489b84ce9****</MediaId>
    <MediaURL>http://example.aliyundoc.com/watermark/****.mov?auth_key=****</MediaURL>
    <UploadAuth>UzFnUjFxNkZ0NUI*****ZTaklyNWJoQ00zdHF</UploadAuth>
</CreateUploadAttachedMediaResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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" : "UzFnUjFxNkZ0NUI*****ZTaklyNWJoQ00zdHF"
}

Error codes

For a list of error codes, visit the API Error Center.

SDK examples

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