CreateUploadVideo

Updated at:
Copy as MD

ApsaraVideo VOD provides an upload address and credential for secure and authorized uploads. Call this operation to obtain the upload address and credential, create a media ID (returned as VideoId), and set basic information for the media file.

Operation description

  • Before you use this operation, make sure you understand the billing methods and pricing of ApsaraVideo VOD. Uploading a media file incurs media storage fees. For more information, see Media storage billing. If you have enabled storage and transfer acceleration, you are also charged for upload acceleration. For more information, see Storage and transfer acceleration billing. Storage fees are calculated after the file is successfully uploaded. Acceleration fees are charged for uploads after the feature is enabled. Calling this operation alone does not incur any charges.

  • Obtaining an upload address and credential is the first step for every upload to ApsaraVideo VOD. The service supports various upload methods, each with different requirements for obtaining the address and credential. For more information, see Upload address and credential.

  • This operation only obtains the upload address, credential, and basic media information. It does not upload the media file itself. For a complete example of how to upload a media file by using an API, see Upload a media file by using the ApsaraVideo VOD API.

  • You can call this operation to obtain the upload address and credential for both video and audio files. For more information, see Upload address and credential.

  • If the upload credential expires (the default validity period is 3,000 seconds), call the RefreshUploadVideo operation to obtain a new one.

  • After the upload is complete, you can configure a callback to receive an event notification or call the GetMezzanineInfo operation to check the file status and verify that the upload was successful.

  • Use the returned VideoId for media asset lifecycle management or media processing.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vod:CreateUploadVideo

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

CoverURL

string

No

The URL of the custom video cover.

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

Description

string

No

The description of the media file that is displayed in ApsaraVideo VOD after the upload is complete.

  • The description can be up to 1,024 characters in length.

  • The value must be encoded in UTF-8.

UploadTest

FileName

string

Yes

The path of the source media file to upload.

  • The file name must include an extension, which is case-insensitive.

  • For a list of supported file extensions, see Upload overview.

D:\video_01.mp4

FileSize

integer

No

The size of the source media file, in bytes.

123

Title

string

Yes

The title of the media file that is displayed in ApsaraVideo VOD after the upload is complete.

  • The title can be up to 128 characters in length.

  • The value must be encoded in UTF-8.

UploadTest

CateId

integer

No

The category ID. You can obtain the category ID in one of the following ways:

  • Log on to the ApsaraVideo VOD console and choose Settings > Media Asset Management > Category Management to view the category ID.

  • The category ID is the value of the CateId parameter in the response to the AddCategory operation.

  • The category ID is the value of the CateId parameter in the response to the GetCategories operation.

100036****

Tags

string

No

The tags of the media file.

  • A maximum of 16 tags are supported.

  • To add multiple tags, separate them with commas (,).

  • A single tag can be up to 32 characters in length.

  • The value must be encoded in UTF-8.

tag1,tag2

UserData

string

No

Custom settings in a JSON string format. This parameter lets you configure features such as message callbacks and upload acceleration. For more information, see UserData.

Note
  • To use message callbacks, you must configure an HTTP callback URL and select the corresponding event types in the ApsaraVideo VOD console. Otherwise, the callback settings are ignored. If you do not specify a callback URL for subsequent tasks, event notifications are sent to the configured URL by default. For more information about how to configure HTTP callbacks in the console, see Callback settings.

  • To use the upload acceleration feature, you must fill out a form on Yida to activate the feature. For more information, see Upload-related instructions.

{"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"*****","test":"www"}}

TemplateGroupId

string

No

The ID of the transcoding template group. You can obtain the ID in one of the following ways:

  • Log on to the ApsaraVideo VOD console and choose Settings > Media Processing Settings > Transcoding Template Group to view the transcoding template group ID.

  • The ID is the value of the TranscodeTemplateGroupId parameter in the response to the AddTranscodeTemplateGroup operation.

  • The ID is the value of the TranscodeTemplateGroupId parameter in the response to the ListTranscodeTemplateGroup operation.

Note
  • If you specify both WorkflowId and TemplateGroupId, WorkflowId takes precedence.

  • If you do not specify this parameter, the default transcoding template group is used. If you specify this parameter, the specified template group is used.

  • If you set this parameter to the built-in No Transcoding template group, only the UploadComplete event notification is sent after the upload. No TranscodeComplete event notification is sent.

  • This parameter triggers an asynchronous task. After the request is sent, the task is queued for background processing.

  • To ensure proper playback, if you use the built-in No Transcoding template group, only the following formats can be played directly without transcoding: MP4, FLV, MP3, M3U8, and WEBM. Other formats can only be stored (the format is determined by the extension in FileName). If you use Alibaba Cloud Player, its version must be 3.1.0 or later.

405477f9e214d19ea2c7c854****

WorkflowId

string

No

The workflow ID. To view the workflow ID, log on to the ApsaraVideo VOD console and choose Settings > Media Processing Settings > Workflow Management.

Note
  • If you specify both WorkflowId and TemplateGroupId, WorkflowId takes precedence. For more information, see Workflows.

  • This parameter triggers an asynchronous task. After the request is sent, the task is queued for background processing.

613efff3887ec34af685714cc461****

StorageLocation

string

No

The storage location. To view the storage location, log on to the ApsaraVideo VOD console and choose Settings > Media Asset Management > Storage Management.

Note

If you do not specify this parameter, the media file is uploaded to the default storage location. If no default storage location is specified, the file is uploaded to the first storage location in the list. If you specify this parameter, the file is uploaded to the specified storage location.

out-****.oss-cn-shanghai.aliyuncs.com

AppId

string

No

The application ID. Default value: app-1000000. For more information, see Multi-application.

app-1000000

ReferenceId

string

No

A custom ID. It can contain only lowercase letters, uppercase letters, digits, hyphens (-), and underscores (_). The ID must be 6 to 64 characters in length and must be unique for each user.

123-123

EnableFirstFrameCover

boolean

No

GenerateThumbnail

boolean

No

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The request ID.

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

UploadAddress

string

The upload address.

Note

The upload address returned by this operation is Base64-encoded. You must Base64-decode the address before you use it to upload a media file. This parsing is required only when using an OSS SDK or an OSS API to upload files.

eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****

VideoId

string

The ID of the media file. Use this ID as a request parameter for operations such as media asset management, media processing, and media moderation.

93ab850b4f6f54b6e91d24d81d44****

UploadAuth

string

The upload credential.

Note

The upload credential returned by this operation is Base64-encoded. You must Base64-decode the credential before you use it to upload a media file. This parsing is required only when using an OSS SDK or an OSS API to upload files.

eyJFbmRwb2ludCI6Imm****

Examples

Success response

JSON format

{
  "RequestId": "25818875-5F78-4AF6-04D5-D7393642****",
  "UploadAddress": "eyJTZWN1cml0a2VuIjoiQ0FJU3p3TjF****",
  "VideoId": "93ab850b4f6f54b6e91d24d81d44****",
  "UploadAuth": "eyJFbmRwb2ludCI6Imm****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.