Obtains the upload URLs and credentials for media files and creates media assets in ApsaraVideo VOD.
Operation Description
- 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 based on the file status in the response.
- The VideoId parameter that is returned after you call this operation can be used for media processing or 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.
Authorization information
The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action
Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:
- 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 keyword: refers to the condition keyword defined by the cloud product itself.
- 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.
Operate | access level | Resource type | conditional keyword | Association operation |
---|---|---|---|---|
vod:CreateUploadVideo | Write |
|
| without |
vod:CreateUploadVideo | Write |
|
| without |
vod:CreateUploadVideo | Write |
|
| without |
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 audio or video file.
| D:\video_01.mp4 |
FileSize | long | No | The size of the audio or video file. Unit: bytes. | 123 |
Title | string | Yes | The title of the audio or video file.
| UploadTest |
CateId | long | No | The category ID of the media file. You can use one of the following methods to obtain the category 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 of the transcoding template group:
NoteIf you leave this parameter empty, the default transcoding template group is used. If you specify this parameter, the specified transcoding template group is used for transcoding. | 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. NoteIf 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. To obtain the storage address, log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Storage. NoteIf you specify a storage address, media 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 |
If you use the No Transcoding template group to upload videos, only videos in the format of MP4, FLV, MP3, M3U8, or WebM can be played. Videos in other formats can only be stored in ApsaraVideo VOD. You can view the file name extension to obtain the video format. If you want to use ApsaraVideo Player, make sure that the version of the player is V3.1.0 or later.
If the No Transcoding template group is used, only the FileUploadComplete event notification is returned after a video is uploaded. The StreamTranscodeComplete event notification is not returned.
Response parameters
Example
Normal return example
JSON
Format
{
"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 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. |