All Products
Search
Document Center

CreateUploadVideo

Last Updated: Jul 11, 2019

Description

You can call this operation to obtain the upload URL and credential for a video and create video information.

This operation also applies to audio files. For more information, see Upload URL and credential.

Request parameters

Name Type Required Description
Action String Yes The operation that you want to perform. Set this parameter to CreateUploadVideo.
Title String Yes The title of the video.
  • Length constraint: Maximum length of 128 characters.
  • Encoding: UTF-8.
FileName String Yes The name of the video mezzanine file.
  • The file name must contain an extension. The extension is case-insensitive.
  • For more information about file name extensions supported by ApsaraVideo for VOD, see Restrictions in Upload overview.
FileSize String No The size of the video mezzanine file. Unit: bytes.
Description String No The description of the video.
  • Length constraint: Maximum length of 1,024 characters.
  • Encoding: UTF-8.
CoverURL String No The URL of the custom video thumbnail.
CateId Long No The ID of the video category.
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.
Tags String No The tag of the video.
  • You can enter a maximum of 16 tags.
  • Separate multiple tags with commas (,).
  • Length constraint per tag: Maximum length of 32 characters.
  • Encoding: UTF-8.
TemplateGroupId String No The ID of the transcoding template group.
If you specify this parameter, the specified template group is used to transcode the video. To view the template group ID, log on to the ApsaraVideo for VOD console and choose Global Settings > Transcode in the left-side navigation pane.
UserData UserData No The custom configurations, such as the callback configuration. The value is a JSON-formatted string.
StorageLocation String No The bucket. If you specify this parameter, the video 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.
AppId String No The ID of the application, in app-xxxxxxx format. Default value: app-1000000. For more information, see Multi-application system.

Note:

  • If you select the No Transcoding template group to upload video files, ApsaraVideo for VOD differentiates the file formats to ensure normal playback. ApsaraVideo for VOD can only play video files in .mp4, .flv, .mp3, or .m3u8 format. Video files in any other formats are only stored in ApsaraVideo for VOD but cannot be played. You can check the file name extension specified by the FileName parameter. If you use ApsaraVideo Player, make sure that its version is V3.1.0 or later.
  • If you select the No Transcoding template group, ApsaraVideo for VOD sends a FileUploadComplete event notification after an upload job is completed, but without a StreamTranscodeComplete event notification.

Response parameters

Name Type Description
RequestId String The ID of the request.
VideoId String The ID of the video.
UploadAddress String The upload URL.
UploadAuth String The upload credential.

Note:

  • This operation does not upload video files. 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.
  • If the video upload credential expires, call the RefreshUploadVideo operation to obtain a new upload credential. The validity period of an upload credential is 3,000 seconds.

API examples

Sample request

http://vod.cn-shanghai.aliyuncs.com/?Action=CreateUploadVideo&Title=exampleTitle&FileName=example.avi&FileSize=10485760&Format=JSON&<Common request parameters>

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

Sample response

JSON format

{
"RequestId": "25818875-5F78-4A13-BEF6-D7393642CA58",
"VideoId": "93ab850b4f6f44eab54b6e91d24d81d4",
"UploadAddress": "eyJTZWN1cml0eVRva2VuIjoiQ0FJU3p3TjF",
"UploadAuth": "eyJFbmRwb2ludCI6Im"
}

Error codes

This operation also returns common errors. For more information about errors common to all operations, see common errors.


Error code Error message HTTP status code Description
InvalidFileName.Extension The specified FileName's extension is illegal. 400 The error message returned because the extension specified by the FileName parameter is invalid. For more information about file name extensions supported by ApsaraVideo for VOD, see Restrictions in Upload overview.
IllegalCharacters The specified $Parameter contains illegal emoticon or special characters. 400 The error message returned because the specified request parameter (such as Title, Description, or Tags) value contains emoticons.
LengthExceededMax The specified $Parameter length has exceeded $MaxLength bytes. 400 The error message returned because the length of the specified request parameter (such as Title, Description, or Tags) value exceeds the maximum length specified by its length constraint. For more information about the length constraint on each parameter value, see the description of request parameters.
TagsExceededMax The specified Tags count has exceeded 16. 400 The error message returned because the number of specified tags exceeds 16.
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 bucket does not exist. To view the bucket, log on to the ApsaraVideo for VOD console and click Storage in the left-side navigation pane.
Forbidden.InitFailed Initialization of your account has failed while opening service. 403 The error message returned because the system failed to initialize your account for activating ApsaraVideo for VOD.
AddVideoFailed Adding video has failed due to some unknown error. 503 The error message returned because the system failed to create video information. Try again later.

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: