批量查询频道信息接口
更新时间:2022-09-13 11:51:28
接口URL
https://api.polyv.net/live/v3/channel/basic/get-channels
接口说明
1、接口用于批量查询频道信息接口息
2、接口支持https
支持格式
JSON
请求方式
GET
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
| timestamp | 是 | long | 13位当前时间戳 |
| sign | 是 | String | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则】 |
| channelIds | 是 | string | 频道号,如果有多个用逗号隔开 |
响应成功JSON示例:
{
"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"
}
]
}
]
}
响应字段说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | int | 状态状态码,请求成功时为200 |
| status | string | 状态值 |
| message | string | 请求失败时返回的错误值 |
| data | 包含频道信息的数组对象 | 请求失败时为空,请求成功时为频道的详细设置信息 |
返回的频道信息字段说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| channelId | int | 频道号 |
| name | string | 频道名称 |
| channelPasswd | string | 频道密码 |
| publisher | string | 主持人名称 |
| startTime | long | 直播开始时间,关闭时为0,开启时为13位毫秒级时间戳 |
| pageView | int | 页面累计观看数 |
| likes | int | 观看页点赞数 |
| coverImg | string | 频道图标url |
| splashImg | string | 频道引导图url |
| splashEnabled | string(取值为Y/N) | 引导页开关 |
| desc | string | 直播介绍 |
| consultingMenuEnabled | string(取值为Y/N) | 咨询提问开关 |
| maxViewerRestrict | string(取值为Y/N) | 限制最大在线观看人数开关 |
| maxViewer | int | 最大在线观看人数 |
| watchStatus | string | 频道的观看页状态,取值为: 频道状态,取值:live(直播中)、end(直播结束)、playback(回放中)、waiting(等待直播) |
| watchStatusText | string | 观看页状态描述,直播中,回放中,已结束,未开始 |
| userCategory | object | 频道所属分类的信息 |
| userCategory.categoryId | int | 分类ID |
| userCategory.categoryName | string | 分类名称 |
| userCategory.rank | int | 分类的排序值 |
| authSettings | List< ChannelAuthSetting > | 直播观看条件列表 |
| scene | string | 直播场景:alone 活动直播, topclass 大班课, ppt 三分屏 |
| bgImg | string | 暖场图片 |
| videoList | array | 回放列表视频 |
| videoList[0].videoId | string | 视频videoId |
| videoList[0].videoPoolId | string | 视频vid |
| creatorChildId | string | 创建账号的子账号用户ID(为空则为主账号创建) |
| creatorName | string | 创建频道的子账号名称(主账号创建的则显示"主账号") |
关于ChannelAuthSetting 的参数说明请参考该接口的成功返回结果:查询直播频道观看条件
响应失败JSON示例:
参数错误
{
"code": 400,
"status": "error",
"message": "param validate error",
"data": 400
}
未输入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正确
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
时间戳错误
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Java请求示例
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);
}
