Query Basic Information of All Channels
Updated: 2022-09-02 18:08:07
API Description
1、查询账号下所有的频道基础信息列表
2、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/basic/list
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls have frequency limits. Click here for details
Request Parameter Description
| 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 stored or used directly on the client side. All APIs must be called from the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules |
| categoryIds | false | String | Category IDs, multiple IDs separated by commas |
| page | false | Integer | Page number for query, default is 1 |
| pageSize | false | Integer | Number of items per page, default is 20, maximum is 20 |
Example
https://api.polyv.net/live/v3/channel/basic/list?categoryIds=340019%2C345134&appId=frlr1zazn3&sign=4A994A9B856E5728F43629AE0F52BDB7&pageSize=2&page=2×tamp=1621841218218
Response Parameter Description
| 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, provides error details when code is 400 or 500 |
| data | Object | Returns basic channel information for the entire account on success See Data Field Description |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| pageSize | Integer | Number of items per page, default is 20, maximum is 20 |
| pageNumber | Integer | Current page number |
| totalItems | Integer | Total number of items |
| contents | Array | Query result list 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, default is false |
| lastPage | Boolean | Whether it is the last page, values: true/false, default is 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 |
| publisher | String | Host name |
| startTime | Long | Live broadcast start time, 0 when closed, 13-digit millisecond timestamp when active |
| pageView | Integer | Cumulative page views |
| likes | Integer | Number of likes on the viewing page |
| coverImg | String | Channel icon URL |
| splashImg | String | Channel splash screen URL |
| splashEnabled | String | Splash screen toggle, values: Y: Enabled, N: Disabled |
| desc | String | Live broadcast description |
| maxViewer | Integer | Maximum concurrent viewers |
| watchStatus | String | Channel viewing page status, values: live: Live, end: Ended, playback: Playback, waiting: Waiting |
| watchStatusText | String | Viewing page status description: Live, Playback, Ended, Not Started |
| onlineNum | Integer | Number of online users |
| bgImg | String | Warm-up image URL |
| videoList | Array | List of playback videos, sorted in reverse chronological order when multiple exist See videoList Parameter Description |
| categoryId | Integer | Category ID |
videoList Parameter Description
| Parameter | Type | Description |
|---|---|---|
| videoId | String | ID generated by the live streaming system (playback video in the video library) |
| videoPoolId | String | VOD video vid (playback video in the video library) |
Java Request Example
For quick integration, please download the relevant dependency source code. Click here to download the 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 testUserChannelBasicList() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/live/v3/channel/basic/list";
String categoryIds="340019,345134";
String page = String.valueOf(2);
String pageSize=String.valueOf(2);
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("categoryIds", categoryIds);
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":2,
"pageNumber":2,
"totalItems":28,
"contents":[
{
"channelId":2191532,
"name":"Spring 知识精讲1111",
"publisher":"主持人",
"startTime":0,
"pageView":3,
"likes":0,
"coverImg":"https://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"splashImg":"https://liveimages.videocc.net/uploaded/images/2020/11/ftezpn7cup.jpg",
"splashEnabled":"N",
"desc":"",
"maxViewer":300,
"watchStatus":"playback",
"watchStatusText":"回放中",
"onlineNum":0,
"bgImg":null,
"videoList":[
{
"videoId":"1b96d90bf5",
"videoPoolId":"1b448be323e68e4404332113a57353b2_1"
}
],
"categoryId":340019
},
{
"channelId":2190410,
"name":"入职培训",
"publisher":"主持人",
"startTime":0,
"pageView":6,
"likes":23,
"coverImg":"https://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"splashImg":"https://liveimages.videocc.net/uploaded/images/2020/11/ftezpn7cup.jpg",
"splashEnabled":"N",
"desc":"",
"maxViewer":-1,
"watchStatus":"playback",
"watchStatusText":"回放中",
"onlineNum":0,
"bgImg":null,
"videoList":null,
"categoryId":340019
}
],
"startRow":3,
"firstPage":false,
"lastPage":false,
"prePageNumber":1,
"limit":2,
"nextPageNumber":3,
"endRow":4,
"totalPages":14,
"offset":2
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
