SearchMedia

Last updated: 2020-03-27 18:45:43

    1. API Description

    Domain name for API request: vod.tencentcloudapi.com.

    This API is used to search for media information and supports filtering and sorting the returned results in many ways. It can:

    • Fuzzily search by media file name or description.
    • Retrieve media files by category and tag.
      • Specify the ClassIds category set (please see the input parameters) and return the media files in any category in the set. For example, assuming that there are categories of Movies, TV Series, and Variety Shows, and there are subcategories of History, Action, and Romance in the category of Movies, if Movies and TV Series are specified in ClassIds, then all the subcategories under Movies and TV Series will be returned; however, if History and Action are specified in ClassIds, only the media files in those two subcategories will be returned.
      • Specify the Tags tag set (please see the input parameters) and return the media files with any tag in the set. For example, assuming that there are tags of ACG, Drama, and YTPMV, if ACG and YTPMV are specified in Tags, then any media files with either tag will be retrieved.
    • Filter media files from a specified source (Source) (please see the input parameters).
    • Filter LVB recording media files by LVB push code and Vid (please see the input parameters).
    • Filter media files by the creation time range.
    • Mix and match any filters above to retrieve the media files that meet all the specified criteria. For example, you can filter the media files with the tag of "Drama" in the category of "Movies" created between December 1, 2018 and December 8, 2018.
    • Sort the results and return them in multiple pages by specifying Offset and Limit (please see the input parameters).
    Upper limit of returned results:
    - The Offset and Limit parameters determine the number of search results on one single page. Note: if both of them use the default value, this API will return up to 10 results. - Up to 5,000 search results can be returned, and excessive ones will not be displayed. If there are too many search results, you are recommended to use more specified filters to narrow down the search results.

    A maximum of 100 requests can be initiated per second for this API.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common parameter. The value used for this API: SearchMedia.
    Version Yes String Common parameter. The value used for this API: 2018-07-17.
    Region No String Common parameter. This parameter is not required for this API.
    Text No String Search text, which fuzzily matches the media file name or description. The more matching items and the higher the match rate, the higher-ranked the result. It can contain up to 64 characters.
    Tags.N No Array of String Tag set, which matches any element in the set.
  • Tag length limit: 8 characters.
  • Array length limit: 10.
  • ClassIds.N No Array of Integer Category ID set, which matches the categories of the specified IDs and all subcategories. Array length limit: 10.
    StartTime No String Start time in the creation time range.
  • After or at the start time.
  • In ISO 8601 format. For more information, please see Notes on ISO Date Format.
  • EndTime No String End time in the creation time range.
  • Before the end time.
  • In ISO 8601 format. For more information, please see Notes on ISO Date Format.
  • SourceType No String Media file source. For valid values, please see SourceType.
    StreamId No String LVB code of a stream.
    Vid No String Unique ID of LVB recording file.
    Sort No SortBy Sorting order.
  • Valid value of Sort.Field: CreateTime
  • If Text is specified for the search, the results will be sorted by the match rate, and this field will not take effect
  • Offset No Integer
    Start offset of a paged return. Default value: 0. Entries from No. "Offset" to No. "Offset + Limit - 1" will be returned.
  • Value range: "Offset + Limit" cannot be more than 5,000. (For more information, please see Limit on the Number of Results Returned by API)
  • Limit No Integer
    Number of entries returned by a paged query. Default value: 10. Entries from No. "Offset" to No. "Offset + Limit - 1" will be returned.
  • Value range: "Offset + Limit" cannot be more than 5,000. (For more information, please see Limit on the Number of Results Returned by API)
  • SubAppId No Integer Subapplication ID in VOD. If you need to access a resource in a subapplication, enter the subapplication ID in this field; otherwise, leave it empty.

    3. Output Parameters

    Parameter Name Type Description
    TotalCount Integer Number of eligible entries.
  • Maximum value: 5000. If the number of eligible entries is greater than 5,000, this field will return 5,000 instead of the actual number.
  • MediaInfoSet Array of MediaInfo List of media file information, only including the basic information (BasicInfo).
    Note: this field may return null, indicating that no valid values can be obtained.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Searching for media information

    Input Example

    https://vod.tencentcloudapi.com/?Action=SearchMedia
    &Text=Test
    &ClassIds.0=1
    &ClassIds.1=2
    &StartTime=2018-09-20T10:00:00Z
    &EndTime=2018-10-02T10:00:00Z
    &Sort.Field=CreatTime
    &Sort.Order=Desc
    &<Common request parameters>

    Output Example

    {
      "Response": {
        "MediaInfoSet": [
          {
            "FileId": "123",
            "BasicInfo": {
              "ClassId": 1,
              "ClassName": "Test",
              "ClassPath": "Test",
              "CoverUrl": "http://xx.vod2.myqcloud.com/xxxxxxxx/shotup/f0.100_0.jpg",
              "CreateTime": "2018-10-01T10:00:00Z",
              "Description": "",
              "ExpireTime": "2018-12-01T13:00:00Z",
              "Name": "test file",
              "MediaUrl": "http://xx.vod2.myqcloud.com/xx/xx/f0.mp4",
              "Type": "mp4",
              "TagSet": [],
              "StorageRegion": "ap-chongqing",
              "SourceInfo": {
                "SourceType": "Record",
                "SourceContext": "xxxxxxxx"
              },
              "Vid": "200025104_21313e19584d4b2a82af7c826581536c",
              "UpdateTime": "2018-10-01T13:10:03Z"
            }
          },
          {
            "FileId": "256",
            "BasicInfo": {
              "ClassId": 1,
              "ClassName": "Test",
              "ClassPath": "Test - Sports",
              "CoverUrl": "http://xx.vod2.myqcloud.com/xxxxxxxx/shotup/f0.100_0.jpg",
              "CreateTime": "2018-09-21T14:00:03Z",
              "Description": "",
              "ExpireTime": "2018-11-21T14:00:03",
              "Name": "test file2",
              "MediaUrl": "http://xx.vod2.myqcloud.com/xx/xx/f0.mp4",
              "Type": "mp4",
              "TagSet": [],
              "StorageRegion": "ap-chongqing",
              "SourceInfo": {
                "SourceType": "Record",
                "SourceContext": "xxxxxxxxx"
              },
              "Vid": "1251883823_e247f6b09c5c4f168052355ce1e9c343",
              "UpdateTime": "2018-09-22T16:12:16Z"
            }
          }
        ],
        "RequestId": "requestId",
        "TotalCount": 2
      }
    }

    5. Developer Resources

    API Explorer

    This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InternalError Internal error.
    InternalError.GetMediaListError Internal error: an error occurred while getting the media list.
    InvalidParameterValue.ClassIds Incorrect parameter value: invalid ClassIds.
    InvalidParameterValue.EndTime Incorrect parameter value: invalid EndTime.
    InvalidParameterValue.Offset Incorrect parameter value: invalid Offset.
    InvalidParameterValue.Sort Incorrect parameter value: invalid Sort.
    InvalidParameterValue.SourceType Incorrect parameter value: invalid SourceType.
    InvalidParameterValue.StartTime Incorrect parameter value: invalid StartTime.
    InvalidParameterValue.SubAppId Incorrect parameter value: subapplication ID
    InvalidParameterValue.Tags Incorrect parameter value: invalid Tags.
    InvalidParameterValue.Text Incorrect parameter value: search text.
    LimitExceeded Quota limit is exceeded.
    UnauthorizedOperation Unauthorized operation.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help