Obtains an upload URL and an upload credential for uploading an audio or video file and generates the audio or video ID. ApsaraVideo VOD issues upload URLs and credentials to perform authorization and ensure security. This prevents unauthorized users from uploading media files. ApsaraVideo VOD generates media IDs, video IDs, and image IDs together with upload URLs and credentials. Media IDs are used in lifecycle management and media processing.
Operation description
- Make sure that you understand the billing method and prices of ApsaraVideo VOD before you call this operation. You are charged storage fees after you upload media files to ApsaraVideo VOD. For more information, see Billing of media asset storage. If you have activated the acceleration service, you are charged acceleration fees when you upload media files to ApsaraVideo VOD. For more information, see Billing of acceleration traffic.
- You can call this operation to obtain upload URLs and credentials for video and audio files. For more information, see Upload URLs and credentials.
- You can call this operation only to obtain the upload URLs and credentials for media files and create media assets in ApsaraVideo VOD. You cannot call this operation to upload media files. For more information about how to upload media files by calling API operations, see Upload media files by calling API operations.
- If the upload credential expires, 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. For more information, see Overview .
- 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.
- You must obtain a URL and a credential before you upload a media file to ApsaraVideo VOD. ApsaraVideo VOD supports multiple upload methods. Each method has different requirements on upload URLs and credentials. For more information, see Upload URLs and credentials.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vod:CreateUploadVideo | create | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
CoverURL | string | No | The URL of the custom video thumbnail. | https://example.aliyundoc.com/image/D22F553TEST****.jpeg |
Description | string | No | The description of the audio or video file.
| UploadTest |
FileName | string | Yes | The name of the source file.
| D:\video_01.mp4 |
FileSize | long | No | The size of the source file. Unit: bytes. | 123 |
Title | string | Yes | The title of the audio or video file.
| UploadTest |
CateId | long | No | The ID of the category. You can use one of the following methods to obtain the ID:
| 100036**** |
Tags | string | No | The tags of the audio or video file.
| tag1,tag2 |
UserData | string | No | The custom configurations such as callback configurations and upload acceleration configurations. The value must be a JSON string. For more information, see Request parameters. Note
| {"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"*****","test":"www"}} |
TemplateGroupId | string | No | The ID of the transcoding template group. You can use one of the following methods to obtain the ID:
Note
| 405477f9e214d19ea2c7c854**** |
WorkflowId | string | No | 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 you specify the WorkflowId and TemplateGroupId parameters, the value of the WorkflowId parameter takes effect. For more information, see Workflows .
| 613efff3887ec34af685714cc461**** |
StorageLocation | string | No | The storage address. Perform the following operations to obtain the storage address: Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Storage. On the Storage page, view the storage address. Note
If you leave this parameter empty, audio and video files are uploaded to the default storage address. If you specify a storage address, audio and video files are uploaded to the specified address.
| out-****.oss-cn-shanghai.aliyuncs.com |
AppId | string | No | The ID of the application. Default value: app-1000000. For more information, see Overview . | app-1000000 |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "25818875-5F78-4AF6-04D5-D7393642****",
"UploadAddress": "eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****",
"VideoId": "93ab850b4f6f54b6e91d24d81d44****",
"UploadAuth": "eyJFbmRwb2ludCI6Imm****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|
Common errors
The following table describes the error codes 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 FileName parameter is invalid. For more information about file name extensions supported in 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 address does not exist. Log on to the ApsaraVideo VOD console. Choose Configuration Management > Media Management > Storage. On the Storage page, check whether the storage address 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 video ID failed to be generated. Try again later. |