查询频道信息
更新时间:2022-09-02 18:08:07
接口描述
1、查询频道基本信息
2、接口支持https协议
接口URL
http://api.polyv.net/live/v3/channel/basic/get-channel
请求方式
GET
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | true | String | 账号appId【详见获取密钥】 |
| timestamp | true | Long | 当前13位毫秒级时间戳,3分钟内有效 |
| sign | true | String | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则】 |
| channelId | true | String | 频道号 |
示例
http://api.polyv.net/live/v3/channel/basic/get-channel?appId=frlr1zazn3&sign=4049473DAEBBEFF778DABD1A25E3409B&channelId=2779045×tamp=1642732753732
响应参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | Integer | 响应状态码,200为成功返回,非200为失败【详见全局错误说明】 |
| status | String | 响应状态文本信息 |
| message | String | 响应描述信息,当code为400或者500的时候,辅助描述错误原因 |
| data | Object | 请求失败时为空,请求成功时为频道的详细设置信息 【详见data字段说明】 |
data字段说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| channelId | String | 频道号 |
| name | String | 频道名称 |
| scene | String | 直播场景,新版直播不使用该字段 alone:活动直播 topclass:大班课 ppt:三分屏 seminar:研讨会 |
| newScene | String | 新版后台直播场景,若未定义则取scene undefined:未定义 topclass:大班课 double:双师课(需开通权限) train:企业培训 seminar:研讨会 alone:活动营销 |
| template | String | 新版后台直播模板,若老版频道,该字段为未定义 undefined:未定义 ppt:文档+视频 alone:纯视频(专业) topclass:纯视频(极速) seminar:研讨会 portrait_ppt:文档+视频(竖屏) portrait_alone:视频(竖屏) |
| channelPasswd | String | 频道密码 |
| publisher | String | 主持人名称 |
| startTime | Long | 直播间设置的直播开始时间(设置后出现倒计时),未设置直播开始时间或重置了直播开始时间时为0;设置并生效时为13位毫秒级时间戳。 |
| pageView | Integer | 页面累计观看数 |
| likes | Integer | 观看页点赞数 |
| coverImg | String | 播放器封面url |
| splashImg | String | 直播间封面url |
| splashEnabled | String | 引导页开关 Y:开启 N:关闭 |
| desc | String | 直播介绍 |
| consultingMenuEnabled | String | 咨询提问开关 Y:开启 N:关闭 |
| maxViewerRestrict | String | 限制最大在线观看人数开关 Y:开启 N:关闭 |
| maxViewer | Integer | 最大在线观看人数 |
| watchStatus | String | 观看页状态 live:直播中 playback:回放中 end:已结束 waiting:等待中 unStart:未开始 |
| watchStatusText | String | 观看页状态描述 |
| userCategory | Object | 频道所属分类的信息【详见userCategory字段说明】 |
| authSettings | Array | 直播观看条件列表 【详见authSettings字段说明】 |
userCategory字段说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| categoryId | String | 分类ID |
| categoryName | String | 分类名称 |
| userId | String | POLYV用户ID,和保利威官网一致,获取路径:官网->登录->直播(开发设置) |
| rank | Integer | 分类的排序值 |
authSettings字段说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| channelId | String | 频道号 |
| rank | Integer | 频道直播观看条件,主要观看条件为1,次要观看条件为2 |
| userId | String | POLYV用户ID,和保利威官网一致,获取路径:官网->登录->直播(开发设置) |
| globalSettingEnabled | String | 是否开启全局设置 Y:开启 N:关闭 |
| enabled | String | 是否开启观看条件 Y:开启 N:关闭 |
| authType | String | 观看条件类型 none:无限制 code:验证码观看 pay:付费观看 phone:白名单观看 info:登记观看 wxshare:分享观看 custom:自定义授权观看 external:外部授权观看 direct:独立授权 |
| authTips | String | 白名单观看提示信息 |
| payAuthTips | String | 付费观看提示信息 |
| codeAuthTips | String | 验证码观看条件提示信息 |
| infoAuthTips | String | 登记观看条件提示信息 |
| authCode | String | 验证码观看的验证码 |
| qcodeTips | String | 验证码观看的二维码提示 |
| qcodeImg | String | 验证码观看的二维码图片 |
| price | Float | 付费观看的价格 |
| watchEndTime | Long | 付费观看截止时间,13位毫秒级时间戳,为 null 表示一次付费,永久有效 |
| validTimePeriod | Integer | 付费观看的截止时长,单位为天 |
| customKey | String | 自定义授权观看的 key |
| customUri | String | 自定义授权观看的接口地址 |
| externalKey | String | 外部授权观看的 key |
| externalUri | String | 外部授权观看的接口地址 |
| externalRedirectUri | String | 外部授权观看,用户直接访问观看页时的跳转地址 |
| directKey | String | 独立授权 key |
| trialWatchEnabled | String | 付费观看的试看开关,默认关闭 Y:开启 N:关闭 |
| trialWatchTime | Integer | 试看时间,单位为分钟 |
| trialWatchEndTime | Long | 试看截止日期,13位毫秒级时间戳,为 null 表示对该频道永久有效 |
| whiteListInputTips | String | 白名单输入提示 |
| whiteListEntryText | String | 白名单入口文案 |
| infoDesc | String | 登记观看描述字段 |
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 查询频道基本信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetChannel() 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/get-channel";
String channelId = "2779045";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道基本信息,返回值:{}", response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code": 200,
"status": "success",
"message": "",
"data": {
"channelId": 2779045,
"name": "测试",
"scene": "alone",
"newScene": "alone",
"template": "portrait_alone",
"channelPasswd": "6dMuVz",
"publisher": "主持人",
"startTime": 0,
"pageView": 6,
"likes": 0,
"coverImg": "//liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"splashImg": "//liveimages.videocc.net/uploaded/images/2021/09/g2bta2pjbw.jpg",
"splashEnabled": "Y",
"desc": "",
"consultingMenuEnabled": "Y",
"maxViewerRestrict": "N",
"maxViewer": -1,
"watchStatus": "unStart",
"watchStatusText": "未开始",
"userCategory": {
"categoryId": 340019,
"categoryName": "默认分类",
"userId": "1b448be323",
"rank": 0
},
"authSettings": [
{
"channelId": 2779045,
"rank": 1,
"userId": "1b448be323",
"globalSettingEnabled": "N",
"enabled": "N",
"authType": "external",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": "",
"qcodeTips": null,
"qcodeImg": null,
"price": 0.01,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "ujpTIPloEw",
"customUri": "",
"externalKey": "ujpTIPloEw",
"externalUri": "http://www.polyv.net",
"externalRedirectUri": "",
"externalEntryText": "登录观看",
"directKey": "ujpTIPloEw",
"trialWatchEnabled": "N",
"trialWatchTime": 1,
"trialWatchEndTime": null,
"whiteListInputTips": "请输入会员码-1605067278063",
"whiteListEntryText": "会员入口",
"infoDesc": ""
},
{
"channelId": 2779045,
"rank": 2,
"userId": "1b448be323",
"globalSettingEnabled": "N",
"enabled": "N",
"authType": "none",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 0,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "ujpTIPloEw",
"customUri": null,
"externalKey": "ujpTIPloEw",
"externalUri": null,
"externalRedirectUri": null,
"externalEntryText": "",
"directKey": "ujpTIPloEw",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": null,
"whiteListEntryText": "会员入口",
"infoDesc": null
}
],
"bgImg": "",
"creatorChildId": null,
"creatorName": null,
"onlyOutEnabled": "Y"
}
}
异常示例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
