All Products
Search
Document Center

ApsaraVideo VOD:Query media asset information

Last Updated:Feb 27, 2025

You can query information about media assets such as video, audio, and image files and specify the fields to return. Multiple query modes are supported, such as fuzzy match and multi-value query. You can also query, filter, and sort media asset information based on specific parameters. This topic describes how to query media asset information by using the ApsaraVideo VOD console, API, or SDK.

Methods

You can use the following two methods to query media asset information:

  • By using the ApsaraVideo VOD console

    Log on to the ApsaraVideo VOD console and go to the Audio/Video page. You can filter audio and video files by type, category, status, and source. You can also search for media assets by media name, media ID, or tag name.

    Note

    If a video file is in the Transcoding Failed status, delete the video file and upload the file again. If transcoding for the video file fails for multiple times, view the possible causes and the corresponding solutions in FAQ about transcoding.

    搜索媒资信息1.png

  • By using the API operations or SDKs

    Call the SearchMedia operation and use the search protocol to query media asset information. You can call the SearchMedia operation to query media asset information and specify the fields to return. Multiple query modes are supported, such as exact match, fuzzy match, multi-value query, and range query. You can filter media asset information based on VideoId, CateId, StorageLocation, Title, or Tags. For more information about the search syntax and rules, see Protocol for media asset search.

Limits

Paging limits

When you query media assets by using the API operations or SDKs, the SearchMedia operation returns only part of the data that meets the query conditions to avoid performance problems caused by deep paging. To obtain more data or traverse all data, you must use the ScrollToken and SessionId pagination identifiers.

  • Pagination parameters such as PageNo and PageSize are used to obtain some data without passing ScrollToken or SessionId. You can obtain the first 5,000 data records for one query.

  • To obtain more data or traverse all data, you must use the PageNo and PageSize pagination parameters and the ScrollToken and SessionId pagination identifiers. Make sure that the number of data records on pages between the current page number and the required page number does not exceed 1,200. When you go to the page specified by the required page number, you can obtain the next 1,200 data records. Repeat the preceding operations to obtain all data. You can obtain data in multiple segments based on the pagination identifiers. However, you can obtain a maximum of 1,200 data records in each segment.

API call examples

The sample code in the following section describes the query statements used for querying video information.

Important
  • Before you send a request, you must perform URL encoding on the request parameters.

  • The equal signs (=), double quotation marks ("), single quotation marks ('), and parentheses used in the statement must be single-byte characters.

Item

Description

Return field

By default, the SearchMedia operation returns only basic media asset information. To obtain more media asset information, you must set the Fields field. Obtain the Title and CoverURL parameters:

Fields=Title,CoverURL

Sample request:

http://vod.cn-shanghai.aliyuncs.com?Action=SearchMedia
&Fields=Title,CoverURL

Exact match

Query information about a video whose VideoId is 28ba2b26d540446c94cdd2c4c48090e5:

VideoId='28ba2b26d540446c94cdd2c4c48090e5'

Sample request:

http://vod.cn-shanghai.aliyuncs.com?Action=SearchMedia
&Match=VideoId='28ba2b26d540446c94cdd2c4c48090e5'

Fuzzy match

Query media asset information where Title contains Music:

Title='Music'

or

Title in ('Music')

Sample request:

http://vod.cn-shanghai.aliyuncs.com?Action=SearchMedia
&Match=Title='Music'

Multi-value query

Note: If the fields used for the query only support fuzzy match, the query results are also returned based on fuzzy match.

Query information about a media asset whose Status is Normal or Checking:

Status in ('Normal','Checking')

Sample request:

http://vod.cn-shanghai.aliyuncs.com?Action=SearchMedia
&Match=Status in ('Normal','Checking')

Range query

Use an open or closed interval to indicate a time range. Query information about a media asset whose CreationTime is between 2018-01-01T00:00:00Z and 2018-02-01T00:00:00Z:

CreationTime=('2018-01-01T00:00:00Z','2018-02-01T00:00:00Z')

Sample request:

http://vod.cn-shanghai.aliyuncs.com?Action=SearchMedia
&Match=CreationTime=('2018-01-01T00:00:00Z','2018-02-01T00:00:00Z')

Use a left-open or right-open interval to specify only the end time or start time of a time range. Query information about a media asset whose CreationTime is later than 2018-01-01T00:00:00Z:

CreationTime=('2018-01-01T00:00:00Z',)

Sample request:

http://vod.cn-shanghai.aliyuncs.com?Action=SearchMedia
&Match=CreationTime=('2018-01-01T00:00:00Z',)

Sort field

Sort media asset information in reverse chronological order based on the creation time:

CreationTime:Desc

Sample request:

http://vod.cn-shanghai.aliyuncs.com?Action=SearchMedia
&SortBy=CreationTime:Desc

References