All Products
Search
Document Center

ApsaraVideo VOD:UploadMediaByURL

Last Updated:Jun 01, 2023

Uploads a media file to ApsaraVideo VOD based on the URL of the source file. The media file can be an audio file or a video file. You can also call this operation to upload multiple media files at a time.

Operation Description

  • If a callback is configured, 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 an upload job is submitted, the job is asynchronously executed on the cloud. All submitted upload jobs are queued for execution. You can check the job status based on the URL and media file ID that are returned in the event notification.
  • You can call the UploadMediaByURL operation if the media file is not stored on a local server or terminal and needs to be uploaded by using a URL that can be accessed from the Internet.
  • You can call the UploadMediaByURL operation only in the China (Shanghai) region.

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.
OperationAccess levelResource typeCondition keyAssociated operation
vod:UploadMediaByURLWrite
  • VOD
    acs:vod:*:{#accountId}:*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
UploadURLsstringYes

The URL of the source file.

  • The URL must contain a file name extension, such as mp4 in https://****.mp4.
    • If the URL does not contain a file name extension, you can specify one by setting the FileExtension parameter under the UploadMetadatas parameter.
    • If the URL contains a file name extension and the FileExtension parameter is set, the value of the FileExtension parameter is used.
    • For more information about file name extensions supported by ApsaraVideo VOD, see Overview.
  • URL encoding is required. Separate multiple URLs with commas (,). You can specify a maximum of 20 URLs.
  • Special characters may cause upload failures. Therefore, encode URLs before you separate them with commas (,).
https://****.mp4
TemplateGroupIdstringNo

The ID of the transcoding template group. You can use one of the following methods to obtain 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 > Transcoding Template Groups. On the Transcoding Template Groups page, you can view the ID of the transcoding template group.
  • View the value of the TranscodeTemplateGroupId parameter returned by the AddTranscodeTemplateGroup operation that you called to create a transcoding template group.
  • View the value of the TranscodeTemplateGroupId parameter returned by the ListTranscodeTemplateGroup operation that you called to query a transcoding template group.
Note
  • If this parameter is left empty, the default transcoding template group is used for transcoding. If this parameter is set to a specific value, the specified transcoding template group is used for transcoding.
  • You can also specify the ID of the transcoding template group by using the nested TemplateGroupId parameter under the UploadMetadatas parameter. If you set this parameter and the nested TemplateGroupId parameter, the value of the nested TemplateGroupId parameter takes effect.
  • ca3a8f6e4957b65806709586****
    StorageLocationstringNo

    The storage location of the media file.

    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 storage location is used.

    outin-bfefbb90a47c******163e1c7426.oss-cn-shanghai.aliyuncs.com
    UploadMetadatasstringNo

    The metadata of the media file to be uploaded. The value is a JSON string.

    • This parameter takes effect only if the value of the SourceURL parameter matches the URL that is specified by the UploadURLs parameter.
    • The JSON-formatted data, such as [UploadMetadata, UploadMetadata,…], must be converted into a JSON string.
    • For more information, see the UploadMetadata section.
    [{"SourceURL":"https://example.aliyundoc.com/video01.mp4","Title":"urlUploadTest"}]
    UserDatastringNo

    The custom configurations, including callback configurations and upload acceleration configurations. The value is a JSON string. For more information, see the "UserData: specifies the custom configurations for media upload" section of the Request parameters topic.

    Note
  • The callback configurations take effect only if you specify the HTTP callback URL and select the specific callback events in the ApsaraVideo VOD console. For more information about how to configure HTTP callback settings in the ApsaraVideo VOD console, see Configure callback settings.
  • To use the upload acceleration feature, submit a ticket to enable this feature. For more information, see Overview.
  • {"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}}
    AppIdstringNo

    The ID of the application. Default value: app-1000000. For more information, see Overview.

    app-****
    WorkflowIdstringNo

    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.

    NoteIf both the WorkflowId and TemplateGroupId parameters are set, the value of the WorkflowId parameter takes effect. For more information, see Workflows.
    e1e243b42548248197d6f74f9****

    UploadMetadata

    ParameterTypeRequiredDescription
    SourceURLStringYesThe URL of the source file to be uploaded.
    TitleStringYesThe title of the media file. The title can be up to 128 bytes in length. The value must be encoded in UTF-8.
    FileSizeStringNoThe size of the media file.
    DescriptionStringNoThe description of the media file. The description can be up to 1,024 bytes in length. The value must be encoded in UTF-8.
    CoverURLStringNoThe URL of the custom thumbnail of the media file.
    CateIdStringNoThe 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.
    TagsStringNoThe one or more tags of the media file. Each tag can be up to 32 bytes in length. You can set a maximum of 16 tags. Separate multiple tags with commas (,). The value must be encoded in UTF-8.
    TemplateGroupIdStringNoThe ID of the transcoding template group. If both the request parameter TemplateGroupId and the nested parameter TemplateGroupId are set, the value of the nested parameter takes effect.
    WorkflowIdStringNoThe 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.
    FileExtensionStringNoThe file name extension of the media file. For more information about file name extensions supported by ApsaraVideo VOD, see Overview.
    Note
  • Do not include emoticons in the nested parameters, such as Title, Description, and Tags, under the UploadMetadata parameter.
    • If you set the TemplateGroupId parameter to VOD_NO_TRANSCODE to upload videos, only the videos in the format of MP4, FLV, MP3, M3U8, or WebM can be played. Videos in the other formats are supported only for storage. You can identify the video format based on the file name extension. If you want to use ApsaraVideo Player, the version must be 3.1.0 or later.
    • If you set the TemplateGroupId parameter to VOD_NO_TRANSCODE, only the FileUploadComplete but not the StreamTranscodeComplete event notification is returned after the media file is uploaded.
    • If a callback is configured, ApsaraVideo VOD sends an UploadByURLComplete event notification after the media file is uploaded, in addition to the FileUploadComplete and StreamTranscodeComplete event notifications.
    • If you specify multiple media files at a time, ApsaraVideo VOD sends an event notification for each media file after the media file is uploaded.

    Response parameters

    ParameterTypeDescriptionExample
    object

    The returned data.

    RequestIdstring

    The ID of the request.

    25818875-5F78-4AF6-D7393642CA58****
    UploadJobsobject []

    The information about one or more upload jobs.

    SourceURLstring

    The URL of the source file that is uploaded in the upload job.

    http://example****.mp4
    JobIdstring

    The ID of the upload job.

    ad90a501b1b94fb72374ad005046****
    NoteThis operation is used to asynchronously upload media files. Upload jobs are queued for execution after they are submitted. The completion time of an upload job varies with the number of jobs in the queue.

    Examples

    Sample success responses

    JSONformat

    {
      "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 timeSummary of changesOperation
    2023-05-16The input parameters of the API operation change.
    Change itemChange content
    Input ParametersThe input parameters of the API operation change.
      Added Input Parameters: SessionId

    Common errors

    The following table describes the common errors that this operation can return.

    Error codeError messageHTTP status codeDescription
    InvalidParameter.UploadURLsThe specified parameter UploadURLs is not valid.400The error message returned because the UploadURLs parameter is invalid.