Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Pulls media files from URLs

Function

Pulls a source media file using its URL to VOD. This method is applicable to a file of less than 5 TB. If the file size exceeds 5 TB, you need to use the migration tool to upload the file to VOD. Submit a service ticket to obtain the tool and operation guide.

Constraints

  • A maximum of 16 audio/video clips can be pulled at a time by calling this API.

  • When a URL is used to pull an M3U8 file, the URL cannot contain authentication parameters such as hotlink protection.

URI

POST /v1.0/{project_id}/asset/upload_by_url

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory for AK/SK authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

upload_metadatas

Yes

Array of UploadMetaDataByUrl objects

Metadata of a media asset to be created

Table 4 UploadMetaDataByUrl

Parameter

Mandatory

Type

Description

video_type

Yes

String

Uploaded audio/video file format.

Options:

  • Video: MP4, TS, MOV, MXF, MPG, FLV, WMV, AVI, M4V, F4V, MPEG, 3GP, ASF, MKV, WebM, and M3U8

  • Audio: MP3, OGG, WAV, WMA, APE, FLAC, AAC, AC3, MMF, AMR, M4A, M4R, WV, and MP2

If an audio file is uploaded, transcoding, watermarking, and subtitling are not supported.

title

Yes

String

Media asset title. The value is UTF-8-encoded and contains a maximum of 128 characters.

url

Yes

String

URL of the audio or video file to be pulled.

NOTE:

The URL must end with a file name extension. Currently, only HTTP and HTTPS are supported. HTTP has security risks. HTTPS is recommended. You are advised not to write sensitive information such as authentication credentials in URLs.

description

No

String

Video description. The value contains a maximum of 1024 characters.

category_id

No

Integer

Media file category ID

You can call the API for Creating a Media File Category to create a media file category, or create a media file category in the category settings on the VOD console and obtain the category ID.

NOTE:

If this parameter is not specified or is set to -1, the uploaded audio/video files fall into the preconfigured Other category.

tags

No

String

Video tag.

Each tag contains up to 24 characters and up to 16 tags are allowed.

Use commas (,) to separate tags, which are UTF-8-encoded.

auto_publish

No

Integer

Whether to publish the content automatically.

The options are as follows:

  • 0: The content is not automatically published.

  • 1: The content is automatically published.

Default value: 1

template_group_name

No

String

Name of a transcoding template group

If this parameter is specified, the specified transcoding template is used to transcode the uploaded audio/video. You can configure a transcoding template on the VOD console. For details, see Transcoding Settings in VOD User Guide.

NOTE:

If both template_group_name and workflow_name are specified, template_group_name takes effect.

auto_encrypt

No

Integer

Whether to automatically encrypt a file

Possible values are:

  • 0: not encrypted

  • 1: encrypted

Default value: 0. If encryption is required, a transcoding template must be configured and the transcoded file must be in HLS format.

auto_preheat

No

Integer

Whether to automatically pre-load content to the CDN

Possible values are:

  • 0: The content is not automatically pre-loaded.

  • 1: The content is automatically pre-loaded.

Default value: 0

thumbnail

No

Thumbnail object

Snapshot parameters

review

No

Review object

Media asset review parameter.

NOTE:

[Only VOD in CN North-Beijing1 and CN North-Beijing4 supports this function.] (tag:hws)

[Only VOD in AP-Singapore supports this function.] (tag:hws_hk)

workflow_name

No

String

Workflow name

If this parameter is specified, the specified workflow is used to transcode the uploaded audio/video. You can configure a workflow on the VOD console. For details, see Transcoding Settings in VOD User Guide.

Table 5 Thumbnail

Parameter

Mandatory

Type

Description

type

Yes

String

Snapshot capturing mode.

The options are as follows:

  • time: Snapshots are captured by interval.

  • dots: Snapshots are captured at a specified time point.

  • quantity: Snapshots are captured based on the specified quantity and video duration.

quantity

No

Integer

This parameter is mandatory when type is set to quantity. Snapshots are captured based on the specified quantity and video duration.

Value range: an integer between 1 and 10

quantity_time

No

Integer

This parameter is optional when type is set to quantity. Snapshots are captured based on the specified quantity at a specified interval.

Value range: an integer between 0 and 2,147,483,647

time

No

Integer

Interval for sampling, in seconds.

type is set to time.

Default value: 12

Value range: an integer between 0 and 100

dots

No

Array of integers

This parameter is mandatory when type is set to dots. The array of time points when a snapshot is captured is used.

cover_position

No

Integer

The value indicates which snapshot is specified as the thumbnail.

The default value is 1.

format

No

Integer

Snapshot file format

Possible values are:

  • 1: jpg

The default value is 1.

aspect_ratio

No

Integer

Aspect ratio

Possible values are:

  • 0: adaptive (the original aspect ratio is retained)

  • 1: 16:9

Default value: 0

max_length

No

Integer

The longest side of a snapshot.

Unit: pixel

The width of the snapshot is scaled proportionally with the longest side and input video pixel.

Default value: 480

Table 6 Review

Parameter

Mandatory

Type

Description

template_id

No

String

Review template ID. You can obtain the value after configuring the review template on the VOD console. For details, see Review Settings in VOD User Guide.

NOTE:

[Only VOD in CN North-Beijing1 and CN North-Beijing4 supports this function.] (tag:hws)

[Only VOD in AP-Singapore supports this function.] (tag:hws_hk)

interval

No

Integer

Snapshot check interval. The value range is (0,100]. This parameter is ignored in request parameters.

politics

No

Integer

Confidence of politically sensitive content moderation. The value can be –1 or range from 0 to 100. This parameter is ignored in request parameters.

A higher confidence level indicates a more reliable moderation result. If this function is disabled or the value is set to 0, this check is not performed. politics, terrorism, and porn cannot be set to 0 simultaneously.

terrorism

No

Integer

Confidence of terrorism-related content moderation. The value can be –1 or range from 0 to 100. This parameter is ignored in request parameters.

A higher confidence level indicates a more reliable moderation result. If this function is disabled or the value is set to 0, this check is not performed. politics, terrorism, and porn cannot be set to 0 simultaneously.

porn

No

Integer

Confidence of pornographic content moderation. The value can be –1 or range from 0 to 100. This parameter is ignored in request parameters.

A higher confidence level indicates a more reliable moderation result. If this function is disabled or the value is set to 0, this check is not performed. politics, terrorism, and porn cannot be set to 0 simultaneously.

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

upload_assets

Array of UploadAsset objects

Metadata of a media asset to be created

Table 8 UploadAsset

Parameter

Type

Description

url

String

URL of the audio or video file to be pulled

asset_id

String

ID of the new media asset

error_code

String

Error code

error_msg

String

Error description

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Example Requests

Creates a media file and uses the URL pull mode to pull a media file offline from its URL and upload it to VOD.

POST https://{endpoint}/v1.0/{project_id}/asset/upload_by_url

Content-Type: application/json
{
  "upload_metadatas": [
    {
      "url": "https://mpc-test.obs.cn-north-4.myhuaweicloud.com/Avatar_480P.mp4",
      "title": "Avatar test test",
      "video_type": "MP4",
      "description": "Avatar, test",
      "category_id": 1,
      "tags": "mytags",
      "auto_publish": 1
    },
    {
      "url": "https://mpc-test.obs.cn-north-4.myhuaweicloud.com/Avatar_720.mp4",
      "title": "Avatar test test",
      "video_type": "MP4",
      "description": "Avatar, test",
      "category_id": 1,
      "tags": "mytags",
      "auto_publish": 1
    }
  ]
}

Example Responses

Status code: 200

The information is returned when the request succeeds.

{
  "upload_assets" : [ {
    "url" : "https://mpc-test.obs.cn-north-4.myhuaweicloud.com/Avatar_480P.mp4",
    "asset_id" : "f488337c31c8e4622f1590735b134c65",
    "error_code" : null,
    "error_msg" : null
  }, {
    "url" : "https://mpc-test.obs.cn-north-4.myhuaweicloud.com/Avatar_720.mp4",
    "asset_id" : "f488337c31c8e4622f1590525b134c65",
    "error_code" : null,
    "error_msg" : null
  } ]
}

Status code: 400

The information is returned when the request fails.

{
  "error_code" : "VOD.10003",
  "error_msg" : "The specified key does not exist."
}

Status Codes

Status Code

Description

200

The information is returned when the request succeeds.

400

The information is returned when the request fails.

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback