Pulls and uploads audio or video files from source URLs. Batch uploads are supported.
Operation description
Before you use this operation, make sure that you fully understand the billing methods and pricing of ApsaraVideo VOD. Uploading media files to ApsaraVideo VOD incurs storage fees. For more information about billing, see Media asset storage billing. If you have enabled transfer acceleration, upload acceleration fees are also incurred when you upload media files to ApsaraVideo VOD. For more information about billing, see Storage and transfer acceleration billing.
For information about the media file formats that this operation supports, see Media formats.
This operation is suitable for scenarios where files are not stored on a local server or terminal and must be uploaded from a URL that is accessible over the public network.
This is an asynchronous operation. It is not performed in real time, and timeliness is not guaranteed. After a task is submitted, the upload may take several hours or even days to complete. If you have high requirements for timeliness, use an upload SDK.
If a callback is configured, you receive an URLUploadComplete event notification after the upload is complete. You can call the GetURLUploadInfos operation to query the upload status.
After you submit an upload task, an asynchronous task is generated in the cloud. All URL upload tasks submitted by users in the region are queued for execution. The completion time depends on the number of existing tasks. After the upload is complete, you can use the URL and video ID from the event notification (message callback) to associate the media asset.
This operation is available only in the China (Shanghai), China (Beijing), China (Shenzhen), Singapore, and US (Silicon Valley) regions.
Each time you submit an upload task for the same media file URL, a new media asset with a new media ID is generated in ApsaraVideo VOD.
If a single file is larger than 20 GB, the upload fails. To upload a file larger than 20 GB, use an upload SDK. For more information, see Overview of upload SDKs.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vod:UploadMediaByURL |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| UploadURLs |
string |
Yes |
The URL of the source media file.
Note
|
https://****.mp4 |
| TemplateGroupId |
string |
No |
The ID of the transcoding template group. You can obtain the ID in one of the following ways:
Note
|
ca3a8f6e4957b65806709586**** |
| StorageLocation |
string |
No |
The storage address of the media file. Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Asset Management > Storage to view the storage address. If you do not specify this parameter, the default storage address is used. |
outin-bfefbb90a47c******163e1c7426.oss-cn-shanghai.aliyuncs.com |
| UploadMetadatas |
string |
No |
The metadata of the media file to upload, in a JSON string.
|
[{"SourceURL":"https://example.aliyundoc.com/video01.mp4","Title":"urlUploadTest"}] |
| UserData |
string |
No |
Custom settings in a JSON string. You can configure settings such as message callbacks and transfer acceleration. For more information, see UserData. Note
|
{"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}} |
| AppId |
string |
No |
The application ID. The default value is app-1000000. For more information, see Multi-application service. |
app-**** |
| WorkflowId |
string |
No |
The workflow ID. Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Processing > Workflows to view the workflow ID. Note
If you specify both WorkflowId and TemplateGroupId, WorkflowId takes precedence. For more information, see Workflows. |
e1e243b42548248197d6f74f9**** |
| SessionId |
string |
No |
A custom deduplication ID. If you specify this parameter in a request, an error is returned if the system detects a request with the same ID in the last 10 minutes. Note
|
5c62d40299034bbaa4c195da330**** |
UploadMetadata
| Name | Type | Required | Description |
| SourceURL | String | Yes | The URL of the source media file to upload. |
| Title | String | No | The title of the media asset. The title can be up to 128 bytes in length and must be UTF-8 encoded. |
| FileSize | String | No | The file size. |
| Description | String | No | The description. The description can be up to 1,024 bytes in length and must be UTF-8 encoded. |
| CoverURL | String | No | The URL of the custom video thumbnail. |
| CateId | String | No | The category ID. Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Asset Management > Categorization to view the category ID. |
| Tags | String | No | The tags. A single tag can be up to 32 bytes in length. You can specify a maximum of 16 tags. Separate multiple tags with commas (,). The tags must be UTF-8 encoded. |
| TemplateGroupId | String | No | The ID of the transcoding template group. This parameter overwrites the outer TemplateGroupId parameter. |
| WorkflowId | String | No | The workflow ID. If you specify both WorkflowId and TemplateGroupId, WorkflowId takes precedence. For more information, see Workflows. |
| FileExtension | String | No | The file name extension of the media file. For information about supported file name extensions, see Upload overview. |
| ReferenceId | String | No | A custom ID. The ID can be 6 to 64 characters in length and can contain lowercase letters, uppercase letters, digits, hyphens (-), and underscores (_). The ID must be unique for each user. |
Parameters in UploadMetadata, such as Title, Description, and Tags, cannot contain emojis.
To ensure normal playback, if you set TemplateGroupId to `VOD_NO_TRANSCODE` to upload a video file without transcoding, only files in MP4, FLV, MP3, M3U8, and WEBM formats can be played directly. Files in other formats can only be stored. Pay attention to the file name extension. If you use ApsaraVideo Player, the player version must be 3.1.0 or later.
If you specify a transcoding template group that does not require transcoding (TemplateGroupId is set to `VOD_NO_TRANSCODE`), you receive only an FileUploadComplete event notification after the video is uploaded. You do not receive a SingleStreamTranscodeComplete event notification.
If a callback is configured, after the video is uploaded, you receive an URLUploadComplete event notification in addition to the standard upload and transcoding notifications.
When you submit a batch request, a separate notification is sent for each SourceURL.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response. |
||
| RequestId |
string |
The request ID. |
25818875-5F78-4AF6-D7393642CA58**** |
| UploadJobs |
array<object> |
The list of upload jobs. |
|
|
object |
The details of an upload job. |
||
| SourceURL |
string |
The source file URL of the upload job. |
http://example****.mp4 |
| JobId |
string |
The upload job ID. |
ad90a501b1b94fb72374ad005046**** |
Examples
Success response
JSON format
{
"RequestId": "25818875-5F78-4AF6-D7393642CA58****",
"UploadJobs": [
{
"SourceURL": "http://example****.mp4",
"JobId": "ad90a501b1b94fb72374ad005046****"
}
]
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.