Obtains a URL and a credential for uploading a video and generates the video ID.

Note This operation also supports audio. 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. 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.

FileName String Yes D:\****.mp4

The name of the video mezzanine file.

  • The name must contain a file name extension, which is not case-sensitive.
  • For more information about the supported file name extensions, see Overview.
Title String Yes UploadTest

The title of the video.

  • The title can be up to 128 characters in length.
  • The value must be encoded in UTF-8.
CoverURL String No https://*****test.cn/image/D22F553*****TEST.jpeg

The URL of the custom video thumbnail.

Description String No UploadTest

The description of the video.

  • The description can be up to 1,024 characters in length.
  • The value must be encoded in UTF-8.
FileSize Long No 123

The size of the video. Unit: byte.

CateId Long No 6771111

The category ID of the video.

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 IDs or modify categories.

Tags String No tag1,tag2

The tag of the video.

  • A maximum of 16 tags can be specified.
  • Separate multiple tags with commas (,).
  • Each tag can be up to 32 characters in length.
  • The value must be encoded in UTF-8.
UserData String No {"MessageCallback":"{"CallbackURL":"http://test.test.com"}", "Extend":"{"localId":"*****", "test":"www"}"}

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

Note
  • The callback configurations take effect only when you specify the HTTP callback URL and select the specific callback events in the ApsaraVideo VOD console.
  • To use the upload acceleration feature, submit a ticket. For more information, see Upload instructions.
TemplateGroupId String No 405477f9e21*****d19ea2c7c854

The ID of the transcoding template group.

Note If this parameter is set to a specific value, the specified template group is used for transcoding. Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcode. On the Transcode page, you can view the ID of the template group.
WorkflowId String No 405477f9e21*****d19ea2c7c854

The ID of the workflow.

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.

If this parameter is set to a specific value, the video is uploaded to the specified 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.

AppId String No app-****

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, or M3U8 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, the version must be 3.1.0 or later.
  • If the No Transcoding template group is used, only the FileUploadComplete but not the TranscodeComplete event notification is returned after the video is uploaded.

Response parameters

Parameter Type Example Description
RequestId String 25818875-5F78-4A*****F6-D7393642CA58

The ID of the request.

VideoId String 93ab850b4f6f*****54b6e91d24d81d4

The ID of the video.

UploadAddress String eyJTZWN1cml0*****a2VuIjoiQ0FJU3p3TjF

The upload URL.

UploadAuth String eyJFbmRw*****b2ludCI6Im

The upload credential.

Note

Examples

Sample requests

https://vod.aliyuncs.com]/?Action=CreateUploadVideo
&FileName=D:\****.mp4
&Title=UploadTest
&<Common request parameters>

Sample success responses

XML format

<CreateUploadVideoResponse>
      <RequestId>25818875-5F78-4A*****F6-D7393642CA58</RequestId>
      <VideoId>93ab850b4f6f*****54b6e91d24d81d4</VideoId>
      <UploadAddress>eyJTZWN1cml0*****a2VuIjoiQ0FJU3p3TjF</UploadAddress>
      <UploadAuth>eyJFbmRw*****b2ludCI6Im</UploadAuth>
</CreateUploadVideoResponse>

JSON format

{
	 "RequestId": "25818875-5F78-4A*****F6-D7393642CA58",
	 "VideoId": "93ab850b4f6f*****54b6e91d24d81d4",
	 "UploadAddress": "eyJTZWN1cml0*****a2VuIjoiQ0FJU3p3TjF",
	 "UploadAuth": "eyJFbmRw*****b2ludCI6Im"	
}

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 for the video.

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 the storage location.

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 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: