Polyv Help Center

Help Center

Search Videos

Updated: 2022-09-02 18:08:07

API Description

1、通过子账号id,搜索视频
2、接口支持https协议

API URL

http://api.polyv.net/v3/video/list-video

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameters

Parameter Required Type Description
appId true String POLYV VOD sub-account appId. Path: POLYV VOD Console -> Settings -> Account Management
timestamp true Long Current time in milliseconds, valid for 3 minutes
sign true String Signature, 32-character uppercase MD5 value See MD5 Signature Generation Rules
cataId false String Video category ID. Obtain from Get Categories and Subcategories
title false String Search by title
uploader false String Uploader, e.g., main account
status false String Video status. Refer to status field description
containSubCate false String Include subcategories
Y: Yes
N: No
startTime false Long Query by creation time range, start timestamp (13 digits)
e.g., 1617866563834
endTime false Long End timestamp (13 digits), e.g., 1617866563834
page false Integer Page number, default is 1
pageSize false Integer Page size, default is 10
sort false String Sort order
creationTimeDesc: Descending
creationTimeAsc: Ascending

status Field Description

Video Status Code Description
60/61 Published
10 Waiting for encoding
20 Encoding
50 Waiting for review
51 Review failed
-1 Deleted

Example

http://api.polyv.net/v3/video/list-video?sign=13C80EAA5C93D1A62D197AFAF535D63F&pageSize=10&sort=creationTimeDesc&title=hello&uploader=%E4%B8%BB%E8%B4%A6%E5%8F%B7&appId=a0Wmol5EwX&containSubCate=Y&cataId=1617173363572&startTime=&endTime=&page=1&timestamp=1617937287873&status=60

Response Parameters

Parameter Type Description
code Integer Response status code. 200 for success, non-200 for failure See Global Error Description
status String Response status text
requestId String Business request ID for troubleshooting on client/server side
error Object Error details on failure [See error field description](/vod/api/sub_account/sub_search_video.md?id=error字段说明], empty on success
data Object Search results on success [See data field description](/vod/api/sub_account/sub_search_video.md?id=data字段说明], empty on failure

error Field Description

Field Type Description
code Integer Error code
desc String Error description See Global Error Description

data Field Description

Field Type Description
pageNumber Integer Current page number
totalPages Integer Total number of pages
totalItems Integer Total number of items
pageSize Integer Items per page
contents Array List of search results [See contents field description](/vod/api/sub_account/sub_search_video.md?id=contents字段说明]

contents Field Description

Field Type Description
vid String Video ID
basicInfo Object Detailed video information [See basicInfo field description](/vod/api/sub_account/sub_search_video.md?id=basicInfo字段说明]

basicInfo Field Description

Field Type Description
title String Video title
description String Video description
duration Long Source video duration, in seconds
coverURL String Cover image URL, large size
creationTime String Creation time
updateTime String Update time
size Long Source file size, in Bytes
status Integer Video status code
cateId Long Category ID; 1 is the root directory, i.e., "Default Category"
cateName String Category name
tags String Tags
uploader String Uploader

Java Request Example

For quick integration, download the relevant dependency source code. Click to download source code. After downloading, add it to your project. The test cases include HttpUtil.java and VodSignUtil.java in the download file.

It is strongly recommended to use the VOD Java SDK for API integration. The VOD Java SDK unifies and optimizes API call logic, exception handling, data signing, and HTTP request thread pools.

private static final Logger log = LoggerFactory.getLogger(VodSubAccountTest.class);

/**
 * 搜索视频
 * @throws Exception
 * @throws NoSuchAlgorithmException
 */
@Test
public void testSearchSubVideo() throws Exception, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;
        String appSecret = super.appSecret;
        String timestamp = String.valueOf(System.currentTimeMillis());

        //业务参数
        String url = "http://api.polyv.net/v3/video/list-video";
        String cataId = "1617173363572";
        String title = "hello";
        String uploader = "主账号";
        String status = "60";
        String containSubCate = "Y";
        String startTime = "";
        String endTime = "";
        String page = "1";
        String pageSize = "10";
        String sort = "creationTimeDesc";

        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("cataId", cataId);
        requestMap.put("title", title);
        requestMap.put("uploader", uploader);
        requestMap.put("status", status);
        requestMap.put("containSubCate", containSubCate);
        requestMap.put("startTime", startTime);
        requestMap.put("endTime", endTime);
        requestMap.put("page", page);
        requestMap.put("pageSize", pageSize);
        requestMap.put("sort", sort);

        //用md5进行签名,使用子账号的secretKey签名
        requestMap.put("sign", VodSignUtil.getSignMd5(requestMap, appSecret));
        String response = HttpUtil.get(url, requestMap);
        log.debug("测试搜索视频,{}", response);
        //do somethings
}

Response Example

See Global Error Description for system-wide error descriptions.

Success Example

{
  "requestId": "c271194e-c7b7-43e7-a81e-c2edb7d9c2d2",
  "code": 200,
  "status": "success",
  "error": null,
  "data": {
    "pageNumber": 1,
    "totalPages": 1,
    "pageSize": 10,
    "contents": [
      {
        "vid": "1b448be323a6a1a6c0c237856f555e88_1",
        "basicInfo": {
          "title": "hello,word",
          "description": "",
          "duration": 24,
          "coverURL": "https://img.videocc.net/uimage/1/http://img.videocc.net/uimage/1/1b448be323/first_image/7b56e5d7-8aae-4e65-8d43-cd550ccff409_b.png",
          "creationTime": "2021-04-01 10:52:07",
          "updateTime": "2021-04-02 09:31:00",
          "size": 7156046,
          "status": 61,
          "cateId": 1615536384688,
          "cateName": "Junit测试(勿删)_3",
          "tags": "test",
          "uploader": "主账号"
        }
      }
    ],
    "totalItems": 1
  }
}

Error Example

{
    "requestId": "0fefcb4a-1949-4145-a350-3ec941e7daff", 
    "code": 400, 
    "status": "error", 
    "error": {
        "code": 1112, 
        "desc": "param is not number: status"
    }, 
    "data": null
}
联系客服,在线咨询