Obtains a URL and a credential for uploading a video and generates the video ID.
Debugging
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.
|
Title | String | Yes | UploadTest |
The title of the video.
|
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.
|
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.
|
UserData | String | No | {"MessageCallback":"{"CallbackURL":"http://test.test.com"}", "Extend":"{"localId":"*****", "test":"www"}"} |
The custom configurations, including callback configurations and upload acceleration. The value is a JSON-formatted string. To enable the upload acceleration feature, submit a ticket. 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.
|
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. |
- 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 extensions of the FileName parameter. If you want to use the 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. |
- This operation does not upload videos. To upload a video, you must obtain the upload URL and credential, decode the URL and credential by using the Base64 algorithm, and then use OSS SDKs to upload the video to a specified bucket. For more information, see Upload videos by using the OSS native SDK.
- If the video upload credential expires after 3,000 seconds, you can call the RefreshUploadVideo operation to obtain a new upload credential.
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 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 the request parameter such as Title, Description, and Tags contains emoticons. |
LengthExceededMax |
The specified $Parameter length has exceeded $MaxLength bytes. |
400 |
The error message returned because the value length of the request parameter such as Title, Description, and 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 server SDKs to call this operation. You can view the sample code of different languages to call this operation by clicking the following links: