Uploads multiple media files based on the URLs of mezzanine files to ApsaraVideo VOD at a time.
After upload jobs are submitted, you can receive an UploadByURLComplete event notification. You can query the upload status by calling the GetURLUploadInfos operation.
- After the upload jobs are submitted, the jobs are executed asynchronously in the cloud. All submitted upload jobs are queued for execution. You can check the job status based on the URL and video ID returned in the event notification.
- The UploadMediaByURL operation is suitable for scenarios where you relocate a site with no specific timeliness requirement. Videos are uploaded usually within several hours or days after the jobs are submitted. If you need to upload videos in real time, we recommend that you use server upload SDKs to upload videos on your on-premises device in real time.
- The UploadMediaByURL operation is available only in the China (Shanghai) region.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | UploadMediaByURL |
The operation that you want to perform. Set the value to UploadMediaByURL. |
UploadURLs | String | Yes | https://****.mp4 |
The URL of the video mezzanine file.
|
TemplateGroupId | String | No | ca3a8f6e49*****57b65806709586 |
The ID of the transcoding template group.
|
StorageLocation | String | No | outin-bfefbb90a47c******163e1c7426.oss-cn-shanghai.aliyuncs.com |
The storage location of the video. 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. If you do not specify the storage location, the default bucket is used. |
UploadMetadatas | String | No | {"SourceURL":"http://test.com/a.mp4","Title":"urlUploadTest"} |
The metadata of the videos to be uploaded. The value is a JSON-formatted string.
|
UserData | String | No | {"MessageCallback":{"CallbackURL":"http://test.test.com"},"Extend":{"localId":"xxx","test":"www"}} |
The custom configurations, including callback configurations and upload acceleration. The value is a JSON-formatted string. To enable the upload acceleration feature, submit a ticket. For more information, see the "UserData" section of the Request parameters topic. Note The callback configurations take effect only when you specify the HTTP callback URL
and select the specific callback events in the ApsaraVideo VOD console.
|
AppId | String | No | app-**** |
The ID of the application. Default value: app-1000000. For more information, see Overview. |
WorkflowId | String | No | e1e243b4254*****8248197d6f74f9 |
The ID of the workflow. Note If both the WorkflowId and TemplateGroupId parameters are set, the value of the WorkflowId
parameter takes effect. For more information, see Workflows.
|
UploadMetadata
Parameter |
Type |
Required |
Description |
---|---|---|---|
SourceURL |
String |
Yes |
The URL of the video mezzanine file to be uploaded. |
Title |
String |
Yes |
The title of the video. The title can be up to 128 bytes in length. The value must be encoded in UTF-8. |
FileSize |
String |
No |
The size of the file. |
Description |
String |
No |
The description of the video. The description can be up to 1,024 bytes in length. The value must be encoded in UTF-8. |
CoverURL |
String |
No |
The URL of the custom video thumbnail. |
CateId |
String |
No |
The category ID of the video. 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 IDs or modify categories. |
Tags |
String |
No |
The tag of the video. Each tag can be up to 32 bytes in length. A maximum of 16 tags can be specified. Separate multiple tags with commas (,). The value must be encoded in UTF-8. |
TemplateGroupId |
String |
No |
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 > Transcode. On the Transcode page, you can view the ID of the template group. If this parameter is set to a specific value, the specified template group is used for transcoding. If both the request parameter TemplateGroupId and the nested parameter TemplateGroupId are set, the value of the nested parameter takes effect. |
WorkflowId |
String |
No |
The ID of the workflow. If both the WorkflowId and TemplateGroupId parameters are set, the value of the WorkflowId parameter takes effect. For more information, see Workflows. |
FileExtension |
String |
No |
The file name extension of the video. For more information about the supported file name extensions, see Overview. |
- Nested parameters such as Title, Description, and Tags under the UploadMetadata parameter cannot contain emoticons.
- If you use the No Transcoding template group to upload videos, only the videos in the format of MP4, FLV, MP3, or M3U8 can be played. If you want to use the ApsaraVideo Player, the version must be 3.1.0 or later.
- If the No Transcoding template group is used, only the FileUploadComplete but not the TranscodeComplete event notification is returned after the video is uploaded.
- In addition to the FileUploadComplete and TranscodeComplete event notifications, ApsaraVideo VOD sends an UploadByURLComplete event notification after the video is uploaded.
- If you specify multiple media files at a time, ApsaraVideo VOD sends event notifications separately for each media file.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 25818875-5F78-4A*****F6-D7393642CA58 |
The ID of the request. |
UploadJobs | Array of UploadJob |
The information about the upload jobs. |
|
JobId | String | ad90a501b1b94*****fb72374ad005046 |
The ID of the upload job. |
SourceURL | String | http://****.mp4 |
The URL of the mezzanine file uploaded by the upload job. |
- This operation is used to upload videos asynchronously. Upload jobs are queued for execution after they are submitted. The completion time of each upload job varies based on the number of jobs in the queue.
Examples
Sample requests
https://vod.aliyuncs.com/?Action=UploadMediaByURL
&UploadURLs=https://****.mp4
&<Common request parameters>
Sample success responses
XML
format
<UploadMediaByURLResponse>
<RequestId>25818875-5F78-4A*****F6-D7393642CA58</RequestId>
<UploadJobs>
<JobId>ad90a501b1b94*****fb72374ad005046</JobId>
<SourceURL>http://****.mp4</SourceURL>
</UploadJobs>
</UploadMediaByURLResponse>
JSON
format
{
"RequestId":"25818875-5F78-4A*****F6-D7393642CA58",
"UploadJobs":[
{
"SourceURL":"http://****.mp4",
"JobId":"ad90a501b1b94*****fb72374ad005046"
}]
}
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 code |
Error message |
HTTP status code |
Description |
---|---|---|---|
InvalidParameter.UploadURLs |
The specified parameter UploadURLs is not valid. |
400 |
The error message returned because the UploadURLs parameter is invalid. |
SDK examples
We recommend that you use server SDKs to call this operation. You can view the sample code of different languages to call this operation by clicking the following links: