Batch Query Channel Information API
Updated: 2022-09-13 11:51:28
API URL
https://api.polyv.net/live/v3/channel/basic/get-channels
API Description
1、接口用于批量查询频道信息接口息
2、接口支持https
Supported Format
JSON
Request Method
GET
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | Yes | string | Obtained from API settings, the appId registered in the live streaming system |
| timestamp | Yes | long | Current 13-digit Unix timestamp in milliseconds |
| sign | Yes | 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 side. All APIs must be called through the customer's own server to relay requests to the POLYV server and obtain response data. For details, see Signature Generation Rules |
| channelIds | Yes | string | Channel IDs, separated by commas if multiple |
Successful Response JSON Example:
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"channelId": 1976099,
"name": "金山cdn",
"scene": "ppt",
"channelPasswd": "4bb763",
"publisher": "易方信息科技股份有限公司",
"startTime": 0,
"pageView": 9,
"likes": 0,
"coverImg": "//liveimages.videocc.net/uploaded/images/2020/12/fu7jh8cifb.jpg",
"splashImg": "//liveimages.videocc.net/uploaded/images/2020/12/fu7jl4dfwc.png",
"splashEnabled": "N",
"desc": "",
"consultingMenuEnabled": "Y",
"maxViewerRestrict": "N",
"maxViewer": -1,
"watchStatus": "playback",
"watchStatusText": "回放中",
"creatorChildId": null,
"creatorName": "主账号",
"userCategory": {
"categoryId": 177474,
"categoryName": "默认分类",
"userId": "ee7fe7fbda",
"rank": 0
},
"authSettings": [
{
"channelId": 1976099,
"rank": 1,
"userId": "ee7fe7fbda",
"globalSettingEnabled": "Y",
"enabled": "N",
"authType": "phone",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 0.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "92daed0df9",
"customUri": null,
"externalKey": "432fdf9889",
"externalUri": null,
"externalRedirectUri": null,
"directKey": "e87d4de349",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": "",
"whiteListEntryText": "会员入口",
"infoDesc": ""
},
{
"channelId": 1976099,
"rank": 2,
"userId": "ee7fe7fbda",
"globalSettingEnabled": "Y",
"enabled": "N",
"authType": "none",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 0.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "0c97e07670",
"customUri": null,
"externalKey": "33004355bd",
"externalUri": null,
"externalRedirectUri": null,
"directKey": "a4951d801f",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": null,
"whiteListEntryText": "",
"infoDesc": null
}
],
"bgImg": "//liveimages.videocc.net/uploaded/images/2020/12/fu7jmmi8qw.jpg",
"videoList": [
{
"videoId": "f72f1ae298",
"videoPoolId": "ee7fe7fbda102f4d74a264c1b559f6d9_e"
}
]
}
]
}
Response Field Description
| Parameter | Type | Description |
|---|---|---|
| code | int | Status code, 200 on success |
| status | string | Status value |
| message | string | Error message on failure |
| data | Array of channel info objects | Empty on failure, detailed channel settings on success |
Returned Channel Information Fields
| Parameter | Type | Description |
|---|---|---|
| channelId | int | Channel ID |
| name | string | Channel name |
| channelPasswd | string | Channel password |
| publisher | string | Host name |
| startTime | long | Live start time, 0 when disabled, 13-digit millisecond timestamp when enabled |
| pageView | int | Cumulative page views |
| likes | int | Number of likes on the watch page |
| coverImg | string | Channel icon URL |
| splashImg | string | Channel splash screen URL |
| splashEnabled | string (Y/N) | Splash screen toggle |
| desc | string | Live stream description |
| consultingMenuEnabled | string (Y/N) | Consultation/QA toggle |
| maxViewerRestrict | string (Y/N) | Toggle to limit maximum concurrent viewers |
| maxViewer | int | Maximum concurrent viewers |
| watchStatus | string | Channel watch page status: live (streaming), end (ended), playback (replaying), waiting (waiting to start) |
| watchStatusText | string | Watch page status description: Live, Replaying, Ended, Not Started |
| userCategory | object | Channel category information |
| userCategory.categoryId | int | Category ID |
| userCategory.categoryName | string | Category name |
| userCategory.rank | int | Category sort order |
| authSettings | List< ChannelAuthSetting > | List of live stream viewing conditions |
| scene | string | Live stream scene: alone (event live), topclass (large class), ppt (three-screen) |
| bgImg | string | Pre-show background image |
| videoList | array | Playback video list |
| videoList[0].videoId | string | Video videoId |
| videoList[0].videoPoolId | string | Video vid |
| creatorChildId | string | Sub-account user ID of the creator (empty if created by the main account) |
| creatorName | string | Sub-account name of the channel creator (displays "Main Account" if created by the main account) |
For parameter descriptions of ChannelAuthSetting, refer to the successful response of this API: Query Live Channel Viewing Conditions
Failed Response JSON Example:
Parameter error
{
"code": 400,
"status": "error",
"message": "param validate error",
"data": 400
}
Missing appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
Incorrect appId
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
Timestamp error
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
Signature error
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Java Request Example
public void test() {
String url = "https://api.polyv.net/live/v3/channel/basic/get-channels";
// 用户对应的appId和加密串
String appId = "xxxxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
Map<String, String> params = new HashMap<>();
params.put("channelIds", "100,1000,30003");
PolyvTool.setLiveSign(params, appId, appSecret);
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance()
.sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
System.out.println(content);
}
