Uploads media files based on URLs.
Operation description
- You can call this operation to upload media files that are not stored on a local server or device and must be uploaded based on URLs over the Internet.
- The URL-based upload jobs are asynchronous. After you submit a URL-based upload job by calling this operation, it may take hours, even days to complete. If you require high timeliness, we recommend that you use the upload SDK.
- If you configure callbacks, you can receive an UploadByURLComplete event notification after the media file is uploaded. You can query the upload status by calling the GetURLUploadInfos operation.
- After you submit an upload job, the job is asynchronously processed on the cloud. All URL-based upload jobs that are submitted in each region are queued. The waiting time for the upload job depends on the number of queued jobs. After the upload job is complete, you can associate the playback URL included in the callback with the media ID.
- You can call this operation only in the China (Shanghai) and Singapore regions.
- Every time you submit a URL-based upload job, a new media ID is generated in ApsaraVideo VOD.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- 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 Key: the condition key that is defined by the cloud service.
- 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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vod:UploadMediaByURL | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
UploadURLs | string | Yes | The URL of the media file.
| https://****.mp4 |
TemplateGroupId | string | No | The ID of the transcoding template group. You can use one of the following methods to obtain the ID of the transcoding template group:
Note
UploadMetadatas . If you specify this parameter and TemplateGroupId in UploadMetadatas, the TemplateGroupId in UploadMetadatas takes effect. | ca3a8f6e4957b65806709586**** |
StorageLocation | string | No | The storage address of the media file. To view the storage address, log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Storage. If you do not specify a storage address, the default storage address is used. | outin-bfefbb90a47c******163e1c7426.oss-cn-shanghai.aliyuncs.com |
UploadMetadatas | string | No | The metadata of the media file that you want to upload. The value must be a JSON string.
| [{"SourceURL":"https://example.aliyundoc.com/video01.mp4","Title":"urlUploadTest"}] |
UserData | string | No | The custom configurations such as callback configurations and upload acceleration configurations. The value must be a JSON string. For more information, see Request parameters. Note
| {"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}} |
AppId | string | No | The ID of the application. Default value: app-1000000. For more information, see Overview . | app-**** |
WorkflowId | string | No | 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. Note
If you specify WorkflowId and TemplateGroupId, the value of WorkflowId takes effect. For more information, see Workflows .
| e1e243b42548248197d6f74f9**** |
SessionId | string | No | The custom identifier for deduplication. If you specify this parameter and send a request, an error is returned if a request with the same identifier was sent in the last 10 minutes. A custom identifier can be up to 50 characters in length and can contain letters, digits, hyphens (-), and underscores (_). If you do not specify this parameter or leave this parameter empty, duplicate requests are not filtered. | 5c62d40299034bbaa4c195da330**** |
UploadMetadata
Parameter | Type | Required | Description |
---|---|---|---|
SourceURL | String | Yes | The URL of the media file that you want to upload. |
Title | String | No | The title of the media file. The name can be up to 128 bytes in length. The value must be encoded in UTF-8. |
FileSize | String | No | The size of the media file. |
Description | String | No | The description of the media file. 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 thumbnail of the media file. |
CateId | String | No | The category ID of the media file. To view the category ID of the media file, log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Categories. |
Tags | String | No | The tags of the media file. A tag can be up to 32 bytes in length. You can specify a maximum of 16 tags. Separate multiple tags with commas (,). The value must be encoded in UTF-8. |
TemplateGroupId | String | No | The ID of the transcoding template group. If you specify this parameter, TemplateGroupId in the preceding table is overwritten. |
WorkflowId | String | No | The ID of the workflow. If you specify WorkflowId and TemplateGroupId, WorkflowId takes precedence. For more information, see Workflows . |
FileExtension | String | No | The file name extension of the media file. For more information about file name extensions supported by ApsaraVideo VOD, see Overview . |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "25818875-5F78-4AF6-D7393642CA58****",
"UploadJobs": [
{
"SourceURL": "http://example****.mp4",
"JobId": "ad90a501b1b94fb72374ad005046****"
}
]
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-05-16 | The request parameters of the API has changed | View Change Details |