UploadMediaByURL
Uploads audio or video media files by fetching them from source URLs. This operation supports batch uploads.
Operation description
-
Before calling this operation, ensure you understand the billing methods and pricing of ApsaraVideo for VOD. Uploading media asset files to ApsaraVideo for VOD incurs storage fees. For more information, see Media storage. If you have enabled storage transfer acceleration, uploading media asset files to ApsaraVideo for VOD also incurs upload acceleration fees. For more information, see storage transfer acceleration.
-
For a list of supported media formats, see Media formats.
-
Use this operation to upload files from a public URL instead of from a local server or device.
-
This is an asynchronous upload API. The operation does not complete in real time and has no guaranteed processing time. A job may take several hours or even days to complete. For faster uploads, use an upload SDK.
-
If you configure a callback, you receive an
URLUploadCompleteevent notification after the upload completes. You can call the GetURLUploadInfos operation to query the upload status. -
When you submit an upload job, the service creates an asynchronous task. The service queues URL upload jobs from all users in the same region. The time it takes to complete a job depends on the number of existing jobs. After the upload is complete, you can use the URL and video ID returned in the event notification to associate resources.
-
This operation is available only in the following regions: China (Shanghai), China (Beijing), China (Shenzhen), Singapore, and US (Silicon Valley).
-
Each time you submit an upload job for the same media file URL, ApsaraVideo for VOD creates a new media resource with a new media ID.
-
If a single file exceeds 20 GB, the upload fails. If you need to upload files 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 URLs of the source media files.
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 location of the media file. Log on to the ApsaraVideo for VOD console. In the left-side navigation pane, choose Configuration Management > Media Asset Management > Storage to view the storage location. If you do not specify this parameter, the default storage location is used. |
outin-bfefbb90a47c******163e1c7426.oss-cn-shanghai.aliyuncs.com |
| UploadMetadatas |
string |
No |
The metadata of the media file to be uploaded. The value must be a JSON string.
|
[{"SourceURL":"https://example.aliyundoc.com/video01.mp4","Title":"urlUploadTest"}] |
| UserData |
string |
No |
Custom settings. The value must be a JSON string. This parameter supports features such as message callbacks and upload 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. To view the workflow ID, log on to the ApsaraVideo for VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Workflows. Note
If you specify both |
e1e243b42548248197d6f74f9**** |
| SessionId |
string |
No |
A custom deduplication identifier. If you specify this parameter in a request, the service returns an error if a request with the same identifier is repeated within 10 minutes. Note
|
5c62d40299034bbaa4c195da330**** |
| EnableFirstFrameCover |
boolean |
No |
||
| GenerateThumbnail |
boolean |
No |
UploadMetadata
| Parameter | Type | Required | Description |
| SourceURL | String | Yes | The URL of the source media file to be uploaded. |
| Title | String | No | The title of the media file. The title can be up to 128 bytes in length and must be UTF-8 encoded. |
| FileSize | String | No | The size of the file. |
| Description | String | No | The description of the media file. The description can be up to 1,024 bytes in length and must be UTF-8 encoded. |
| CoverURL | String | No | The URL of a custom video cover. |
| CateId | String | No | The category ID. To view the category ID, log on to the ApsaraVideo for VOD console. In the left-side navigation pane, choose Configuration Management > Media Asset Management > Categories. |
| Tags | String | No | The tags of the media file. 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 overrides the TemplateGroupId specified at the top level of the request. |
| WorkflowId | String | No | The ID of the workflow. If you specify both WorkflowId and TemplateGroupId, WorkflowId takes precedence. For more information, see Workflows. |
| FileExtension | String | No | The file extension of the media file. For a list of supported file extensions, see Overview of uploads. |
| ReferenceId | String | No | A custom ID. The ID can be 6 to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_). The ID must be unique within your account. |
-
Parameters in
UploadMetadata, such asTitle,Description, andTags, cannot contain emojis. -
To ensure proper playback when transcoding is disabled (by setting
TemplateGroupIdtoVOD_NO_TRANSCODE), only files in MP4, FLV, MP3, M3U8, and WEBM formats can be played directly after upload. Other formats are supported for storage only. The system checks the file extension. If you use Alibaba Cloud Player, its version must be 3.1.0 or later. -
If you specify a transcoding-disabled template group (
TemplateGroupIdis set toVOD_NO_TRANSCODE), you receive only an event notification forVideoUploadCompleteafter the video is uploaded. You do not receive an event notification forTranscodeComplete. -
If a callback is configured, you will receive an
URLUploadCompleteevent notification in addition to upload and transcoding notifications after the video is uploaded. -
For batch submissions, the service sends a separate notification for each
SourceURL.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response that is returned. |
||
| RequestId |
string |
The request ID. |
25818875-5F78-4AF6-D7393642CA58**** |
| UploadJobs |
array<object> |
A list of upload jobs. |
|
|
object |
The details of the upload job. |
||
| SourceURL |
string |
The source URL of the file in the upload job. |
http://example****.mp4 |
| JobId |
string |
The ID of the upload job. |
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.