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/channel-list
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have frequency limits. See details
Request Parameters 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 never be saved or used directly on the client. All APIs must be called through 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 to query, default is 1 |
| pageSize | false | Integer | Number of records per page, default is 20, maximum is 20 |
Example
http://api.polyv.net/live/v3/channel/basic/channel-list?categoryIds=340019%2C391352&appId=frlr1zazn3&sign=6E5E01CBF9D9B7F5216C0A7C93A897A7&pageSize=2&page=2×tamp=1642734203497
Response Parameters 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 | Basic information of all account channels on successful response See Data Field Description |
Data Parameters Description
| Parameter | Type | Description |
|---|---|---|
| pageSize | Integer | Number of records per page, default is 20, maximum is 20 |
| pageNumber | Integer | Current page number |
| totalItems | Integer | Total number of records |
| contents | Array | Query result list See Contents Parameters 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 records 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 Parameters 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 | Total page views |
| likes | Integer | Number of likes on the viewing page |
| coverImg | String | Channel icon URL |
| splashImg | String | Channel splash image URL |
| splashEnabled | String | Splash page toggle, values: Y: Enabled N: Disabled |
| desc | String | Live broadcast description |
| maxViewer | Integer | Maximum concurrent viewers |
| watchStatus | String | Viewing page status, values: live: Live end: Ended playback: Playback waiting: Waiting unStart: Not started |
| watchStatusText | String | Viewing page status description: Live, Playback, Ended, Waiting, Not started |
| onlineNum | Integer | Number of online viewers |
| bgImg | String | Warm-up image URL |
| videoList | Array | Playback video list, sorted in reverse chronological order when multiple exist See VideoList Parameters Description |
| categoryId | Integer | Category ID |
VideoList Parameters Description
| Parameter | Type | Description |
|---|---|---|
| videoId | String | ID generated by the live system (playback video in the video library) |
| videoPoolId | String | VOD video vid (playback video in the video library) |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code 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 packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 查询所有频道的基础信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testChannelBasicList() 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/basic/channel-list";
String categoryIds = "340019,391352";
String page = "2";
String pageSize = "2";
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 error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": {
"pageSize": 2,
"pageNumber": 2,
"totalItems": 59,
"contents": [
{
"channelId": 2791952,
"name": "⌛Emoji⌛⌚⌨",
"publisher": "主持人",
"startTime": 0,
"pageView": 0,
"likes": 0,
"coverImg": "https://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"splashImg": "https://liveimages.videocc.net/uploaded/images/2021/09/g2bta2pjbw.jpg",
"splashEnabled": "Y",
"desc": "",
"maxViewer": 0,
"watchStatus": "unStart",
"watchStatusText": "未开始",
"onlineNum": 0,
"bgImg": null,
"videoList": null,
"categoryId": 340019
},
{
"channelId": 2779196,
"name": "测试",
"publisher": "主持人",
"startTime": 1642453440000,
"pageView": 0,
"likes": 0,
"coverImg": "https://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"splashImg": "https://liveimages.videocc.net/uploaded/images/2021/09/g2bta2pjbw.jpg",
"splashEnabled": "Y",
"desc": "",
"maxViewer": -1,
"watchStatus": "unStart",
"watchStatusText": "未开始",
"onlineNum": 0,
"bgImg": null,
"videoList": null,
"categoryId": 340019
}
],
"limit": 2,
"offset": 2,
"endRow": 4,
"totalPages": 30,
"nextPageNumber": 3,
"startRow": 3,
"firstPage": false,
"lastPage": false,
"prePageNumber": 1
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
