All Products
Search
Document Center

ApsaraVideo VOD:UploadMediaByURL

Last Updated:Mar 03, 2024

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
UploadURLsstringYes

The URL of the media file.

  • You must include a file name extension in the URL, such as https://****.mp4.

    • If the URL does not contain a file name extension, specify a file name extension for FileExtension in UploadMetadatas.
    • If you specify FileExtension when the URL contains a file name extension, the file name extension that you specified for FileExtension takes effect.
    • 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. You must 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, view the ID of the transcoding template group.
  • Obtain the value of TranscodeTemplateGroupId from the response to the AddTranscodeTemplateGroup operation.
  • Obtain the value of TranscodeTemplateGroupId from the response to the ListTranscodeTemplateGroup operation.
Note
  • If you leave this parameter empty, the default transcoding template group is used for transcoding. If you specify this parameter, the specified transcoding template group is used for transcoding.
  • You can also specify the ID of the transcoding template group in UploadMetadatas. If you specify this parameter and TemplateGroupId in UploadMetadatas, the TemplateGroupId in UploadMetadatas takes effect.
  • ca3a8f6e4957b65806709586****
    StorageLocationstringNo

    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
    UploadMetadatasstringNo

    The metadata of the media file that you want to upload. The value must be a JSON string.

    • This parameter takes effect only if SourceURL matches the URL that you specified for UploadURLs.
    • You must convert the JSON-formatted data such as [UploadMetadata, UploadMetadata,…] to a JSON string.
    • For more information, see the UploadMetadata table.
    [{"SourceURL":"https://example.aliyundoc.com/video01.mp4","Title":"urlUploadTest"}]
    UserDatastringNo

    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
  • The callback configurations take effect only after you specify the HTTP callback URL and select 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.
  • If you want to enable the upload acceleration feature, submit a request on Yida. 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.

    Note If you specify WorkflowId and TemplateGroupId, the value of WorkflowId takes effect. For more information, see Workflows .
    e1e243b42548248197d6f74f9****
    SessionIdstringNo

    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

    ParameterTypeRequiredDescription
    SourceURLStringYesThe URL of the media file that you want to upload.
    TitleStringNoThe title of the media file. The name 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 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.
    TemplateGroupIdStringNoThe ID of the transcoding template group. If you specify this parameter, TemplateGroupId in the preceding table is overwritten.
    WorkflowIdStringNoThe ID of the workflow. If you specify WorkflowId and TemplateGroupId, WorkflowId takes precedence. 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
  • You cannot include emoticons in parameters such as Title, Description, and Tags in UploadMetadata.
  • If you set TemplateGroupId to VOD_NO_TRANSCODE, the media file is uploaded without transcoding. In this case, only videos in the following formats can be played: MP4, FLV, MP3, M3U8, and WebM. Videos in other formats can be stored in ApsaraVideo VOD. You can identify the video format based on FileName. If you want to use ApsaraVideo Player, use ApsaraVideo Player V3.1.0 or later.
  • If you set TemplateGroupId to VOD_NO_TRANSCODE, only the FileUploadComplete event notification is returned when the media file is uploaded. The StreamTranscodeComplete event notification is not returned.
  • If you configure callbacks, you can receive an UploadByURLComplete event notification when the media file is uploaded. You can also receive the FileUploadComplete and StreamTranscodeComplete event notifications.
  • If you upload multiple media files in a batch, ApsaraVideo VOD sends an event notification for each media file when the media file is uploaded.
  • Response parameters

    ParameterTypeDescriptionExample
    object

    The response parameters.

    RequestIdstring

    The ID of the request.

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

    The ID of the upload job.

    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****
    Note This 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 request parameters of the API has changedsee changesets
    Change itemChange content
    Input ParametersThe request parameters of the API has changed.
      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.