Polyv Help Center

Help Center

Query Thumbnail Information for All Channels

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

API Description

1、查询账号下所有的频道缩略信息列表
2、列表信息仅包含频道缩略信息,如需频道具体信息,请使用【获取频道信息】接口
3、接口支持https协议

API URL

http://api.polyv.net/live/v3/channel/management/list

Request Method

GET

API Constraints

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

Request Parameters

Parameter Required Type Description
appId true String Account appId See Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be saved or used directly on the client. All APIs must be called through your own server to relay requests to the POLYV server and obtain response data. See Signature Generation Rules
page false Integer Page number, defaults to 1
pageSize false Integer Number of items per page, defaults to 20
categoryId false String Category ID
watchStatus false String Watch page status filter
live: Streaming
playback: Playback
end: Ended
waiting: Not started
keyword false String Channel name, fuzzy search

Example

http://api.polyv.net/live/v3/channel/management/list?watchStatus=playback&appId=frlr1zazn3&sign=E02F269E702E0AE2154D94B25FD5390D&pageSize=20&page=1&keyword=%E6%B5%8B%E8%AF%95&categoryId=345134&timestamp=1621841187446

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
message String Response description, when code is 400 or 500, provides additional error details
data Object Returns channel thumbnail information on success See Data Field Description
Data Parameter Description
Parameter Type Description
pageSize Integer Number of items per page, defaults to 20
pageNumber Integer Current page
totalItems Integer Total number of records
contents Array Query result list, channel basic information See Contents Parameter Description
startRow Integer Position of the first record on the current page in the total result set
firstPage Boolean Whether it is the first page, values: true/false, defaults to false
lastPage Boolean Whether it is the last page, values: true/false, defaults to false
prePageNumber Integer Previous page number
limit Integer Number of items per page
nextPageNumber Integer Next page number
endRow Integer Position of the last record on the current page in the total result set
totalPages Integer Total number of pages
offset Integer Pagination starting record
Contents Parameter Description
Parameter Type Description
channelId String Channel ID
name String Channel name
channelPasswd String Channel password
categoryId String Live streaming category ID
scene String Scene
alone: Event live
ppt: Three-screen
topclass: Large class
seminar: Seminar
watchStatus String Watch page status description
Streaming
Playback
Ended
Not started
watchStatusText String Watch page status
live: Streaming
playback: Playback
end: Ended
waiting: Not started
sceneText String Scene description
watchUrl String Watch page URL

Java Request Example

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

It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

private static final Logger log = LoggerFactory.getLogger(AccountTest.class);
/**
 * 查询所有频道的缩略信息
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetSimpleChannelList() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际
    String appId = super.appId;
    String appSecret = super.appSecret;
    String userId = super.userId;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url="http://api.polyv.net/live/v3/channel/management/list";
    String categoryId="345134";
    String watchStatus="playback";
    String keyword="测试";
    String page=String.valueOf(1);
    String pageSize=String.valueOf(20);

    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("categoryId", categoryId);
    requestMap.put("watchStatus", watchStatus);
    requestMap.put("keyword", keyword);
    requestMap.put("page", page);
    requestMap.put("pageSize", pageSize);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询所有频道的缩略信息,返回值:{}", response);
    //do somethings

}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code":200,
    "status":"success",
    "message":"",
    "data":{
        "pageSize":20,
        "pageNumber":1,
        "totalItems":1,
        "contents":[
            {
                "channelId":2191569,
                "name":"测试",
                "channelPasswd":"******",
                "categoryId":"345134",
                "scene":"ppt",
                "watchStatus":"playback",
                "watchStatusText":"回放中",
                "sceneText":"三分屏",
                "watchUrl":"https://live.polyv.cn/watch/2191569"
            }
        ],
        "startRow":1,
        "firstPage":true,
        "lastPage":true,
        "prePageNumber":1,
        "limit":1,
        "offset":0,
        "totalPages":1,
        "endRow":1,
        "nextPageNumber":1
    }
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询