Querying Media Assets
Function
This API is used to query media assets. Each record in the list contains the brief information of a media asset.
Constraints
-
You are not advised to use the query_string parameter for fuzzy query. Instead, use the asset_id, start_time, and end_time parameters for exact query.
When the query_string parameter is carried in a request, the API processing performance deteriorates and the query efficiency is low. The API throttling details are as follows:
-
The restrictions on using the page and size parameters in a request are as follows:
-
The value of (page + 1) x size cannot exceed 20,000. That is, a maximum of 20,000 media asset records can be queried and displayed.
-
The page and size parameters affect the number of results of a single paginated query. Note: If neither of the two parameters is specified, this API will return a maximum of 10 query results.
A maximum of 20,000 search results can be returned. The excess part cannot be queried. If there are too many search results, you are advised to use more refined filter criteria to reduce the number of search results.
-
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
vod:asset:list
List
assets *
-
-
-
URI
GET /v1.0/{project_id}/asset/list
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| asset_id | No | Array of strings | Media asset ID. A maximum of 10 media assets can be queried at a time. |
| status | No | Array of strings | Media asset status. Multiple statuses can be queried at a time. The options include: |
| start_time | No | String | Start time. The format is yyyymmddhhmmss. The value must be a UTC time, without reference to any time zone. |
| end_time | No | String | End time. The format is yyyymmddhhmmss. The value must be a UTC time, without reference to any time zone. |
| category_id | No | Integer | Category ID. |
| tags | No | String | Media asset tags. Each tag contains up to 24 characters and up to 16 tags are allowed. Use commas (,) to separate tags. All tags must be UTF-8 encoded. |
| query_string | No | String | String for fuzzy search in media asset titles and descriptions. For details about the restrictions on the parameters, see "Constraints" in this section. |
| media_type | No | Array of strings | Audio/Video file formats. Up to 20 formats can be queried. The options include: |
| page | No | Integer | Page number. The default value is 0. For details about the restrictions on the parameters, see "Constraints" in this section. |
| size | No | Integer | Number of records on each page. The value ranges from 1 to 100. The default value is 10. For details about the restrictions on the parameters, see "Constraints" in this section. |
Request 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 the user token. |
| Authorization | No | String | Authentication information. This parameter is mandatory for AK/SK authentication. |
| X-Sdk-Date | No | String | Time when a request is sent. This parameter is mandatory for AK/SK authentication. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| total | Integer | Total number of media assets. NOTE: Currently, statistics about up to 20,000 media files can be collected. To query the total number of media files, submit a service ticket. |
| assets | Array of AssetSummary objects | Media asset list. |
| Parameter | Type | Description |
|---|---|---|
| asset_id | String | Media asset ID assigned by VOD. It can only be queried but cannot be modified. |
| title | String | Media asset title. The value is UTF-8 encoded and cannot exceed 128 characters. |
| description | String | Media asset description. The value contains a maximum of 1,024 characters. |
| duration | Integer | Media file duration. Unit: seconds |
| duration_ms | Long | Video duration, in milliseconds. |
| size | Long | Media file size. Unit: bytes |
| original_url | String | Original streaming URL. |
| category | String | Media asset category name. |
| covers | Array of CoverInfo objects | Thumbnail information. |
| create_time | String | Time when the media asset was created. The format is yyyymmddhhmmss. The value must be a UTC time, without reference to any time zone. |
| asset_status | String | Media asset status. The options include: |
| transcode_status | String | Transcoding status. The options include: |
| thumbnail_status | String | Snapshot status. The options include: |
| review_status | String | Content review status. The options include: |
| exec_desc | String | Execution description of media file tasks Example:
|
| media_type | String | Audio/Video file format. The options include: |
| Parameter | Type | Description |
|---|---|---|
| cover_url | String | URL for downloading the thumbnail file. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error description. |
Example Requests
This example queries media assets.
GET https://{endpoint}/v1.0/{project_id}/asset/list Example Responses
Status code: 200
Returned when the request succeeded.
{
"total" : 1,
"assets" : [ {
"asset_id" : "67d1470893419bfcb9663103dd8a66ac",
"title" : "video.mp4",
"duration" : 60,
"duration_ms" : 60000,
"size" : 12881945,
"category" : "Other",
"covers" : [ {
"cover_url" : "https://355.cdn-vod.huaweicloud.com/asset/67d1470893419bfcb9663103dd8a66ac/cover/Cover0.jpg"
} ],
"create_time" : "20190625020756",
"asset_status" : "PUBLISHED",
"transcode_status" : "TRANSCODE_SUCCEED",
"thumbnail_status" : "UN_THUMBNAIL",
"review_status" : "UN_REVIEW",
"exec_desc" : "asset_exec_desc:Asset meta is\npublished;transcode_exec_desc:Transcode success;",
"media_type" : "MP4"
} ]
} Status code: 400
Returned when the request failed.
{
"error_code" : "VOD.10053",
"error_msg" : "The request parameter is illegal, illegal field: {xx}."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Returned when the request succeeded. |
| 400 | Returned when the request failed. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot