All Products
Search
Document Center

ApsaraVideo VOD:SearchMedia

Last Updated:Dec 14, 2022

Queries the information about media assets such as video, audio, and image files, and auxiliary media assets.

Operation Description

The maximum number of data records that you can query is limited based on the method used to query the data. You can use the following methods to query data:

  • Method 1: You must use the PageNo and PageSize parameters for the first 5,000 data records that meet the specified filter criteria. This allows you to traverse data page by page. If the number of data records that meet the specified filter criteria exceeds 5,000, use Method 2.
  • Method 2: This method applies only to the data of video and audio files. To traverse all the data records that meet the specified filter criteria, you must set the PageNo, PageSize, and ScrollToken parameters to traverse data page by page. The total number of data records from the current page to the desired page cannot exceed 1,200. Assume that the PageSize parameter is set to 20:
    • When the PageNo parameter is set to 1, you can scroll forward to traverse data records from page 1 to page 60 at most.
    • When the PageNo parameter is set to 2, you can scroll forward to traverse data records from page 2 to page 61 at most.
    • When the PageNo parameter is set to 61, you can scroll backward to traverse data records from page 61 to page 2 at most or scroll forward to traverse data records from page 61 to page 120 at most.

Authorization information

The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:

  • 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 keyword: refers to the condition keyword defined by the cloud product itself.
  • 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.
Operateaccess levelResource typeconditional keywordAssociation operation
vod:SearchMediaList
  • VOD
    acs:vod:*:{#accountId}:*/*
    without
without

Request parameters

ParameterTypeRequiredDescriptionExample
SearchTypestringNo

The type of the media asset that you want to query. Default value: video. Valid values:

  • video
  • audio
  • image
  • attached
NoteIf this parameter is set to video or audio and you want to traverse all data that meets the filter criteria, you must set the ScrollToken parameter.
video
FieldsstringNo

The media asset fields to return in the query results.

By default, only the basic media asset fields are returned. You can specify additional media asset fields that need to be returned in the request. For more information, see the "API examples" section of the Search for media asset information topic.

Title,CoverURL
MatchstringNo

The filter condition. For more information about the syntax, see Protocol for media asset search.

field = value
SortBystringNo

The sort field and order. Separate multiple values with commas (,). Default value: CreationTime:Desc. Valid values:

  • CreationTime:Desc: The results are sorted in reverse chronological order based on the creation time.
  • CreationTime:Asc: The results are sorted in chronological order based on the creation time.
Note
  • For more information about the sort field, see "Sort field" in the Search for media asset information topic.
  • To obtain the first 5,000 data records that meet the specified filter criteria, you can specify a maximum of three sort fields.
  • To obtain all the data records that meet the specified filter criteria, you can specify only one sort field.
  • CreationTime:Desc
    PageNointegerNo

    The number of the page to return. Default value: 1.

    NoteIf the value of this parameter exceeds 200, we recommend that you set the ScrollToken parameter as well.
    1
    PageSizeintegerNo

    The number of entries to return on each page. Default value: 10. Maximum value: 100.

    10
    ScrollTokenstringNo

    The pagination identifier. The identifier can be up to 32 characters in length.

    The first time you call this operation for each new search, you do not need to specify this parameter. The value of this parameter is returned each time data records that meet the specified filter criteria are found. The value is used to record the current position of queried data. Record the returned parameter value and set this parameter according to the following requirements during the next search:

    • If SearchType is set to video or audio and you need to traverse all data that meets the filter criteria, you must set the ScrollToken parameter.
    • If the value of the PageNo parameter exceeds 200, we recommend that you set this parameter to optimize search performance.
    24e0fba7188fae707e146esa54****

    Response parameters

    ParameterTypeDescriptionExample
    object

    The returned data.

    RequestIdstring

    The ID of the request.

    3E0CEF83-FB09-4E34-BA1451814B03****
    Totallong

    The total number of data records that meet the specified filter criteria.

    10
    ScrollTokenstring

    The pagination identifier.

    24e0fba7188fae707e146esa54****
    MediaListarray

    Details about media assets.

    object

    Details about media assets.

    CreationTimestring

    The time when the media asset was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:45:25Z
    MediaTypestring

    The type of the media asset. Valid values:

    • video
    • audio
    • image
    • attached
    video
    MediaIdstring

    The ID of the media asset.

    a82a2cd7d4e147bbed6c1ee372****
    Videoobject
    Statusstring

    The status of the video file. Valid values:

    • Uploading
    • UploadFail
    • UploadSucc
    • Transcoding
    • TranscodeFail
    • Blocked
    • Normal
    UploadSucc
    CreationTimestring

    The time when the video file was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:45:25Z
    StorageLocationstring

    The endpoint of the OSS bucket in which the video file is stored.

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

    The category ID of the video file.

    10000123
    Tagsstring

    The tags of the video file.

    tag1
    ModificationTimestring

    The time when the video file was updated. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:48:25Z
    MediaSourcestring

    The source. Valid values:

    • general: The video file is uploaded by using ApsaraVideo VOD.
    • short_video: The video file is uploaded by using the short video SDK.
    • editing: The video file is produced after online editing.
    • live: The video stream is recorded and uploaded as a file.
    general
    Descriptionstring

    The description of the video file.

    Video test
    AppIdstring

    The ID of the application.

    app-****
    CoverURLstring

    The URL of the thumbnail.

    https://example.aliyundoc.com/image01.png
    VideoIdstring

    The ID of the video file.

    a82a2asdasqadaf3faa0ed6c1ee372****
    DownloadSwitchstring

    The download switch. The video file can be downloaded offline only when the download switch is turned on. Valid values:

    • on
    • off
    on
    CateNamestring

    The name of the category.

    video1
    TranscodeModestring

    The transcoding mode. Default value: FastTranscode. Valid values:

    • FastTranscode: The video file is immediately transcoded after it is uploaded. You cannot play the file before it is transcoded.
    • NoTranscode: The video file can be played without being transcoded. You can immediately play the file after it is uploaded.
    • AsyncTranscode: The video file can be immediately played and asynchronously transcoded after it is uploaded.
    FastTranscode
    PreprocessStatusstring

    The preprocessing status. Valid values:

    • UnPreprocess
    • Preprocessing
    • PreprocessSucceed
    • PreprocessFailed
    Preprocessing
    Sizelong

    The size of the video file.

    123
    Durationnumber

    The duration of the video file. Unit: seconds.

    123
    Titlestring

    The title of the video file.

    ceshi
    SpriteSnapshotsarray

    The list of sprite snapshots.

    string

    The list of sprite snapshots.

    {“http://example.aliyundoc.com/image02.jpg”}
    Snapshotsarray

    The list of automatic snapshots.

    string

    The list of automatic snapshots.

    {“http://example.aliyundoc.com/image03.jpg”}
    Audioobject
    Statusstring

    The status of the audio file. Valid values:

    • Uploading
    • Normal
    • UploadFail
    • Deleted
    Normal
    CreationTimestring

    The time when the audio file was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:45:25Z
    StorageLocationstring

    The endpoint of the OSS bucket in which the audio file is stored.

    outin-aaa*****aa.oss-cn-shanghai.aliyuncs.com
    CateIdlong

    The category ID of the audio file.

    10000123
    Tagsstring

    The tags of the audio file.

    tag1,tag2
    ModificationTimestring

    The time when the audio file was updated. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:48:25Z
    MediaSourcestring

    The source. Valid values:

    • general: The audio file is uploaded by using ApsaraVideo VOD.
    • short_video: The audio file is uploaded to ApsaraVideo VOD by using the short video SDK. For more information, see Introduction.
    • editing: The audio file is uploaded to ApsaraVideo VOD after online editing and production. For more information, see ProduceEditingProjectVideo.
    • live: The audio stream is recorded and uploaded as a file to ApsaraVideo VOD.
    general
    Descriptionstring

    The description of the audio file.

    audio description
    AppIdstring

    The ID of the application.

    app-****
    CoverURLstring

    The URL of the thumbnail.

    http://example.com/image04.jpg
    AudioIdstring

    The ID of the audio file.

    a82a2cd7d4e147bbed6c1ee372****
    DownloadSwitchstring

    The download switch. The audio file can be downloaded offline only when the download switch is turned on. Valid values:

    • on
    • off
    on
    CateNamestring

    The name of the category.

    ceshi
    TranscodeModestring

    The transcoding mode. Default value: FastTranscode. Valid values:

    • FastTranscode: The audio file is immediately transcoded after it is uploaded. You cannot play the file before it is transcoded.
    • NoTranscode: The audio file can be played without being transcoded. You can immediately play the file after it is uploaded.
    • AsyncTranscode: The audio file can be immediately played and asynchronously transcoded after it is uploaded.
    FastTranscode
    PreprocessStatusstring

    The preprocessing status. Only preprocessed videos can be used for live streaming in the production studio. Valid values:

    • UnPreprocess
    • Preprocessing
    • PreprocessSucceed
    • PreprocessFailed
    UnPreprocess
    Sizelong

    The size of the audio file.

    123
    Durationnumber

    The duration of the audio file.

    123
    Titlestring

    The title of the audio file.

    audio
    SpriteSnapshotsarray

    The list of sprite snapshots.

    string

    The list of sprite snapshots.

    {“http://example.aliyundoc.com/image02.jpg”}
    Snapshotsarray

    The list of automatic snapshots.

    string

    The list of automatic snapshots.

    {“http://example.aliyundoc.com/image03.jpg”}
    Imageobject
    StorageLocationstring

    The endpoint of the OSS bucket in which the image file is stored.

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

    The time when the image file was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:45:25Z
    Statusstring

    The status of the image file.

    • Uploading: The image file is being uploaded. This is the initial status.
    • Normal: The image file is uploaded.
    • UploadFail: The image file fails to be uploaded.
    Uploading
    CateIdlong

    The category ID of the image file.

    1000123
    Tagsstring

    The tags of the image file.

    tag1
    ModificationTimestring

    The time when the image file was updated. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:48:25Z
    CateNamestring

    The name of the category.

    beauty
    Descriptionstring

    The description of the image file.

    image test
    AppIdstring

    The ID of the application.

    app-****
    URLstring

    The URL of the image file.

    https://example.com/****.png
    Titlestring

    The title of the image file.

    image1
    ImageIdstring

    The ID of the image file.

    11130843741se99wqmoes****
    AttachedMediaobject
    CreationTimestring

    The time when the auxiliary media asset was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:45:25Z
    Statusstring

    The status of the auxiliary media asset. Valid values:

    • Uploading: The auxiliary media asset is being uploaded. This is the initial status.
    • Normal: The auxiliary media asset is uploaded.
    • UploadFail: The auxiliary media asset fails to be uploaded.
    Normal
    StorageLocationstring

    The endpoint of the OSS bucket in which the auxiliary media asset is stored.

    outin-bfefbb90a47c11*****7426.oss-cn-shanghai.aliyuncs.com
    Tagsstring

    The tags of the auxiliary media asset.

    test2
    ModificationTimestring

    The time when the auxiliary media asset was updated. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

    2018-07-19T03:48:25Z
    MediaIdstring

    The ID of the auxiliary media asset.

    a82a2cd7d4e147ba0ed6c1ee372****
    BusinessTypestring

    The type of the auxiliary media asset. Valid values:

    • watermark
    • subtitle
    • material
    watermark
    Descriptionstring

    The description of the auxiliary media asset.

    test3
    AppIdstring

    The ID of the application.

    app-****
    URLstring

    The URL of the auxiliary media asset.

    https://example.com/****.png
    Titlestring

    The title of the auxiliary media asset.

    test
    Categoriesarray

    The list of category IDs.

    object

    The details of the category.

    ParentIdlong

    The ID of the parent category.

    -1
    CateNamestring

    The name of the category.

    test1
    CateIdlong

    The category ID of the auxiliary media asset.

    10027394
    Levellong

    The level of the category.

    1

    Example

    Normal return example

    JSONFormat

    {
      "RequestId": "3E0CEF83-FB09-4E34-BA1451814B03****",
      "Total": 10,
      "ScrollToken": "24e0fba7188fae707e146esa54****",
      "MediaList": [
        {
          "CreationTime": "2018-07-19T03:45:25Z",
          "MediaType": "video",
          "MediaId": "a82a2cd7d4e147bbed6c1ee372****",
          "Video": {
            "Status": "UploadSucc",
            "CreationTime": "2018-07-19T03:45:25Z",
            "StorageLocation": "outin-bfefbb90a47c******163e1c7426.oss-cn-shanghai.aliyuncs.com",
            "CateId": 10000123,
            "Tags": "tag1",
            "ModificationTime": "2018-07-19T03:48:25Z",
            "MediaSource": "general",
            "Description": "Video test",
            "AppId": "app-****",
            "CoverURL": "https://example.aliyundoc.com/image01.png",
            "VideoId": "a82a2asdasqadaf3faa0ed6c1ee372****",
            "DownloadSwitch": "on",
            "CateName": "video1",
            "TranscodeMode": "FastTranscode",
            "PreprocessStatus": "Preprocessing",
            "Size": 123,
            "Duration": 123,
            "Title": "ceshi",
            "SpriteSnapshots": [
              "{“http://example.aliyundoc.com/image02.jpg”}"
            ],
            "Snapshots": [
              "{“http://example.aliyundoc.com/image03.jpg”}"
            ]
          },
          "Audio": {
            "Status": "Normal",
            "CreationTime": "2018-07-19T03:45:25Z",
            "StorageLocation": "outin-aaa*****aa.oss-cn-shanghai.aliyuncs.com",
            "CateId": 10000123,
            "Tags": "tag1,tag2",
            "ModificationTime": "2018-07-19T03:48:25Z",
            "MediaSource": "general",
            "Description": "audio description",
            "AppId": "app-****",
            "CoverURL": "http://example.com/image04.jpg",
            "AudioId": "a82a2cd7d4e147bbed6c1ee372****",
            "DownloadSwitch": "on",
            "CateName": "ceshi",
            "TranscodeMode": "FastTranscode",
            "PreprocessStatus": "UnPreprocess",
            "Size": 123,
            "Duration": 123,
            "Title": "audio",
            "SpriteSnapshots": [
              "{“http://example.aliyundoc.com/image02.jpg”}"
            ],
            "Snapshots": [
              "{“http://example.aliyundoc.com/image03.jpg”}"
            ]
          },
          "Image": {
            "StorageLocation": "outin-bfefbb90a47c******163e1c7426.oss-cn-shanghai.aliyuncs.com",
            "CreationTime": "2018-07-19T03:45:25Z",
            "Status": "Uploading",
            "CateId": 1000123,
            "Tags": "tag1",
            "ModificationTime": "2018-07-19T03:48:25Z",
            "CateName": "beauty",
            "Description": "image test",
            "AppId": "app-****",
            "URL": "https://example.com/****.png",
            "Title": "image1",
            "ImageId": "11130843741se99wqmoes****"
          },
          "AttachedMedia": {
            "CreationTime": "2018-07-19T03:45:25Z",
            "Status": "Normal",
            "StorageLocation": "outin-bfefbb90a47c11*****7426.oss-cn-shanghai.aliyuncs.com",
            "Tags": "test2",
            "ModificationTime": "2018-07-19T03:48:25Z",
            "MediaId": "a82a2cd7d4e147ba0ed6c1ee372****",
            "BusinessType": "watermark",
            "Description": "test3",
            "AppId": "app-****",
            "URL": "https://example.com/****.png",
            "Title": "test",
            "Categories": [
              {
                "ParentId": -1,
                "CateName": "test1",
                "CateId": 10027394,
                "Level": 1
              }
            ]
          }
        }
      ]
    }

    Error codes

    For a list of error codes, visit the API error center.

    Common errors

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

    Error codeError messageHTTP status codeDescription
    SortByExceededMaxThe SortBy parameter only supports one sort field when traversing all data.400The error message returned because more than one sort field is specified to traverse all data.
    ErrorMatchSyntaxThe parameter Match.%s has an error syntax, please check it.400The error message returned because the syntax of the Match parameter is invalid. Check the syntax and try again.
    InvalidScrollToken.ExpiredThe ScrollToken is expired, please refresh it.400The error message returned because the value of the ScrollToken parameter is invalid. Obtain data again from Page 1.