All Products
Search
Document Center

ApsaraVideo VOD:CreateUploadVideo

Last Updated:Nov 09, 2022

Obtains a URL and a credential for uploading an audio or video file and generates the audio or video ID.

Operation Description

  • You can call this operation to obtain upload URLs and credentials for both video and audio files. For more information, see Upload URLs and credentials.
  • The process of obtaining upload URLs and credentials is a core process in ApsaraVideo VOD and is required for each upload operation. ApsaraVideo VOD provides multiple upload methods. You can upload media files by using SDKs for upload from servers, SDKs for upload from clients, file URLs, Object Storage Service (OSS) API, or OSS SDKs. Each upload method has different requirements for obtaining upload URLs and credentials. For more information, see the "Usage notes" section of the Upload URLs and credentials topic.
  • If the upload credential expires, you can 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 value of the Status response parameter.
  • 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.

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.
Operateaccess levelResource typeconditional keywordAssociation operation
vod:CreateUploadVideoWrite
  • VOD
    acs:vod:*:{#accountId}:*/*
    without
without
vod:CreateUploadVideoWrite
    All resources
    without
without
vod:CreateUploadVideoWrite
    All resources
    without
without

Request parameters

ParameterTypeRequiredDescriptionExample
CoverURLstringNo

The URL of the custom video thumbnail.

https://example.aliyundoc.com/image/D22F553TEST****.jpeg
DescriptionstringNo

The description of the audio or video file.

  • The description can be up to 1,024 characters in length.
  • The value must be encoded in UTF-8.
UploadTest
FileNamestringYes

The name of the audio or video file.

  • The name must contain a file name extension, which is not case-sensitive.
  • For more information about file name extensions supported by ApsaraVideo VOD, see Overview.
D:\video_01.mp4
FileSizelongNo

The size of the audio or video file. Unit: byte.

123
TitlestringYes

The title of the audio or video file.

  • The title can be up to 128 characters in length.
  • The value must be encoded in UTF-8.
UploadTest
CateIdlongNo

The category ID of the audio or video file. You can use one of the following methods to obtain the category ID:

  • 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 ID.
  • View the value of the CateId parameter returned by the AddCategory operation that you called to create a category.
  • View the value of the CateId parameter returned by the GetCategories operation that you called to query a category.
100036****
TagsstringNo

The one or more tags of the audio or video file.

  • You can specify a maximum of 16 tags.
  • If you need to specify multiple tags, separate the tags with commas (,).
  • Each tag can be up to 32 characters in length.
  • The value must be encoded in UTF-8.
tag1,tag2
UserDatastringNo

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

Note
  • The callback configurations take effect only after you specify the HTTP callback URL and select the specific callback events in the ApsaraVideo VOD console. For more information about how to configure an HTTP callback in the ApsaraVideo VOD console, see Configure callback settings.
  • To use the upload acceleration feature, submit a ticket to enable this feature. For more information, see Overview.
  • {"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"*****","test":"www"}}
    TemplateGroupIdstringNo

    The ID of the transcoding template group. You can use one of the following methods to obtain the ID of the transcoding template group:

    • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups. On the Transcoding Template Groups page, you can view the ID of the transcoding template group.
    • View the value of the TranscodeTemplateGroupId parameter returned by the AddTranscodeTemplateGroup operation that you called to create a transcoding template group.
    • View the value of the TranscodeTemplateGroupId parameter returned by the ListTranscodeTemplateGroup operation that you called to query a transcoding template group.
    NoteIf you leave this parameter empty, the default transcoding template group is used for transcoding. If you set this parameter to the ID of a specific transcoding template group, the specified transcoding template group is used for transcoding.
    405477f9e214d19ea2c7c854****
    WorkflowIdstringNo

    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 both the WorkflowId and TemplateGroupId parameters are set, the value of the WorkflowId parameter takes effect. For more information, see Workflows.
    613efff3887ec34af685714cc461****
    StorageLocationstringNo

    The storage location. You can use one of the following methods to obtain the 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.

    NoteIf this parameter is set to a specific value, the audio or video file is uploaded to the specified storage location.
    out-****.oss-cn-shanghai.aliyuncs.com
    AppIdstringNo

    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 the videos in the format of MP4, FLV, MP3, M3U8, or WebM 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, make sure that the version is V3.1.0 or later.
    • If the No Transcoding template group is used, only the FileUploadComplete event notification but not the StreamTranscodeComplete event notification is returned after a video is uploaded.

    Response parameters

    ParameterTypeDescriptionExample
    object

    The returned data.

    RequestIdstring

    The ID of the request.

    25818875-5F78-4AF6-04D5-D7393642****
    UploadAddressstring

    The upload URL.

    NoteThe upload URL returned by this operation is Base64-encoded. Before you can use an SDK or an API operation to upload a media asset based on the upload URL, you must decode the upload URL by using the Base64 algorithm. You must parse the upload URL only if you use native OSS SDKs or OSS API for uploads.
    eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****
    VideoIdstring

    The ID of the audio or video file. You can set the request parameter VideoId to this ID when you call an operation for media asset management, media processing, or media review.

    93ab850b4f6f54b6e91d24d81d44****
    UploadAuthstring

    The upload credential.

    NoteThe upload credential returned by this operation is Base64-encoded. Before you can use an SDK or an API operation to upload a media asset based on the upload credential, you must decode the upload credential by using the Base64 algorithm. You must parse the upload credential only if you use native OSS SDKs or OSS API for uploads.
    eyJFbmRwb2ludCI6Imm****

    Example

    Normal return example

    JSONFormat

    {
      "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 common errors that this operation can return.

    Error codeError messageHTTP status codeDescription
    InvalidFileName.ExtensionThe specified FileName's extension is illegal.400The 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.
    IllegalCharactersThe specified $Parameter contains illegal emoticon or special characters.400The error message returned because the value of a request parameter such as Title, Description, or Tags contains emoticons.
    LengthExceededMaxThe specified $Parameter length has exceeded $MaxLength bytes.400The 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.
    TagsExceededMaxThe specified Tags count has exceeded 16.400The error message returned because more than 16 tags were specified.
    InvalidTemplateGroupId.NotFoundThe TemplateGroupId does not exist.404The error message returned because the specified template group ID does not exist.
    InvalidStorage.NotFoundThe StorageLocation does not exist.404The 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 whether the storage location exists.
    Forbidden.InitFailedInitialization of your account has failed while opening service.403The error message returned because your account failed to be initialized when the service was activated.
    AddVideoFailedAdding video has failed due to some unknown error.503The error message returned because the audio or video ID failed to be generated. Try again later.