Obtains a URL and a credential for uploading an audio or video file and generates the audio or video ID.

Usage notes

  • You can call this operation to obtain upload URLs and credentials for both video and audio files. For more information, see Upload URLs and credentials.
  • 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 media files by using server upload SDKs, client upload SDKs, file URLs, 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 the RefreshUploadVideo operation to obtain a new upload credential. The default validity period of an upload credential is 3,000 seconds.
  • You can configure a callback to receive an event notification when an audio or video file is uploaded. Alternatively, after you upload an audio or video file, you can call the GetMezzanineInfo operation to determine whether the upload is successful based on the value of the Status response parameter.
  • The value of the VideoId parameter that is returned after you call this operation can be used for media processing or the lifecycle management of media assets.

QPS limit

You can call this operation up to 120 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 CreateUploadVideo

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

CoverURL String No https://example.aliyundoc.com/image/D22F553TEST****.jpeg

The URL of the custom video thumbnail.

Description String No UploadTest

The description of the audio or video file.

  • The description can be up to 1,024 characters in length.
  • The value must be encoded in UTF-8.
FileName String Yes D:\video_01.mp4

The name of the audio or video file.

  • The name must contain a file name extension, which is not case-sensitive.
  • For more information about file name extensions supported by ApsaraVideo VOD, see Overview.
FileSize Long No 123

The size of the audio or video file. Unit: byte.

Title String Yes UploadTest

The title of the audio or video file.

  • The title can be up to 128 characters in length.
  • The value must be encoded in UTF-8.
CateId Long No 100036****

The category ID of the audio or video file. 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.
Tags String No tag1,tag2

The one or more tags of the audio or video file.

  • 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.
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.
TemplateGroupId String No 405477f9e214d19ea2c7c854****

The ID of the transcoding template group. You can use one of the following methods to obtain the ID of the transcoding template group:

  • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups. On the Transcoding Template Groups page, you can view the ID of the transcoding template group.
  • View the value of the TranscodeTemplateGroupId parameter returned by the AddTranscodeTemplateGroup operation that you called to create a transcoding template group.
  • View the value of the TranscodeTemplateGroupId parameter returned by the ListTranscodeTemplateGroup operation that you called to query a transcoding template group.
Note If you leave this parameter empty, the default transcoding template group is used for transcoding. If you set this parameter to the ID of a specific transcoding template group, the specified transcoding template group is used for transcoding.
WorkflowId String No 613efff3887ec34af685714cc461****

The ID of the workflow. To view the ID of the workflow, log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Workflows.

Note If both the WorkflowId and TemplateGroupId parameters are set, the value of the WorkflowId parameter takes effect. For more information, see Workflows.
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 audio or video file is uploaded to the specified storage location.
AppId String No app-1000000

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

Note
  • If you use the No Transcoding template group to upload videos, only the videos in the format of MP4, FLV, MP3, M3U8, or WebM can be played. Videos in the other formats are supported only for storage. You can know the video format based on the file name extension in the value of the FileName parameter. If you want to use ApsaraVideo Player, make sure that the version is V3.1.0 or later.
  • If the No Transcoding template group is used, only the FileUploadComplete event notification but not the StreamTranscodeComplete event notification is returned after a video is uploaded.

Response parameters

Parameter Type Example Description
RequestId String 25818875-5F78-4AF6-04D5-D7393642****

The ID of the request.

UploadAddress String eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****

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.
VideoId String 93ab850b4f6f54b6e91d24d81d44****

The ID of the audio or video file. You can set the request parameter VideoId to this ID when you call an operation for media asset management, media processing, or media review.

UploadAuth String eyJFbmRwb2ludCI6Imm****

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=CreateUploadVideo
&CoverURL=https://example.aliyundoc.com/image/D22F553TEST****.jpeg
&Description=UploadTest
&FileName=D:\video_01.mp4
&FileSize=123
&Title=UploadTest
&CateId=1000369573
&Tags=tag1,tag2
&UserData={"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"*****","test":"www"}}
&TemplateGroupId=405477f9e214d19ea2c7c854****
&WorkflowId=613efff3887ec34af685714cc461****
&StorageLocation=out-****.oss-cn-shanghai.aliyuncs.com
&AppId=app-****
&<Common request parameters>

Sample success responses

XML format

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

<CreateUploadVideoResponse>
    <RequestId>25818875-5F78-4AF6-04D5-D7393642****</RequestId>
    <UploadAddress>eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****</UploadAddress>
    <VideoId>93ab850b4f6f54b6e91d24d81d44****</VideoId>
    <UploadAuth>eyJFbmRwb2ludCI6Imm****</UploadAuth>
</CreateUploadVideoResponse>

JSON format

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

{
  "RequestId" : "25818875-5F78-4AF6-04D5-D7393642****",
  "UploadAddress" : "eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****",
  "VideoId" : "93ab850b4f6f54b6e91d24d81d44****",
  "UploadAuth" : "eyJFbmRwb2ludCI6Imm****"
}

Error codes

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

Common errors

The following table describes the common errors that this operation can return.

Error code

Error message

HTTP status code

Description

InvalidFileName.Extension

The specified FileName's extension is illegal.

400

The error message returned because the file name extension in the value of the FileName parameter is invalid. For more information about file name extensions supported by ApsaraVideo VOD, see Overview.

IllegalCharacters

The specified $Parameter contains illegal emoticon or special characters.

400

The error message returned because the value of a request parameter such as Title, Description, or Tags contains emoticons.

LengthExceededMax

The specified $Parameter length has exceeded $MaxLength bytes.

400

The error message returned because the value length of a request parameter such as Title, Description, or Tags exceeds the upper limit. For more information about the length limit of parameter values, see the description of the request parameters in this topic.

TagsExceededMax

The specified Tags count has exceeded 16.

400

The error message returned because more than 16 tags were specified.

InvalidTemplateGroupId.NotFound

The TemplateGroupId does not exist.

404

The error message returned because the specified template group ID does not exist.

InvalidStorage.NotFound

The StorageLocation does not exist.

404

The error message returned because the specified storage location does not exist. Log on to the ApsaraVideo VOD console. Choose Configuration Management > Media Management > Storage. On the Storage page, check whether the storage location exists.

Forbidden.InitFailed

Initialization of your account has failed while opening service.

403

The error message returned because your account failed to be initialized when the service was activated.

AddVideoFailed

Adding video has failed due to some unknown error.

503

The error message returned because the audio or video ID failed to be generated. Try again later.

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: