查询所有频道的详细信息
更新时间:2024-12-16 19:20:19
接口描述
1、查询账号下所有频道详细信息列表
2、接口支持https协议
接口URL
http://api.polyv.net/live/v3/channel/management/list-detail
请求方式
POST
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | true | String | 账号appId【详见获取密钥】 |
| timestamp | true | Long | 当前13位毫秒级时间戳,3分钟内有效 |
| sign | true | String | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则】 |
| page | false | Integer | 页数默认为1 |
| pageSize | false | Integer | 每页显示的数据条数,默认每页显示20条数据 |
| categoryId | false | String | 所属分类id |
| watchStatus | false | String | 观看页状态筛选 live:直播中 playback:回放中 end:已结束 waiting:等待中 |
| keyword | false | String | 频道名称,模糊查询 |
示例
http://api.polyv.net/live/v3/channel/management/list-detail
表单参数:
watchStatus=playback&appId=frlr1zazn3&sign=BDEE4A11F8720DC0FD40E33DE159536B&pageSize=20&page=1&keyword=%E6%B5%8B%E8%AF%95&categoryId=345134×tamp=1621841244430
响应参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | Integer | 响应状态码,200为成功返回,非200为失败【详见全局错误说明】 |
| status | String | 响应状态文本信息 |
| message | String | 响应描述信息,当code为400或者500的时候,辅助描述错误原因 |
| data | Object | 响应成功时返回频道详细信息【详见data字段说明】 |
Data参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| pageSize | Integer | 每页数据大小,默认20条数据 |
| pageNumber | Integer | 当前页数 |
| totalItems | Integer | 总的条数 |
| contents | Array | 频道详细信息列表【详见Contents参数描述】 |
| startRow | Integer | 当前页第一条记录在总结果集中的位置 |
| firstPage | Boolean | 是否为第一页,值为:true/false,默认为false |
| lastPage | Boolean | 是否为最后一页,值为:true/false,默认为false |
| prePageNumber | Integer | 上一页编号 |
| limit | Integer | 每页数量大小 |
| totalPages | Integer | 总页数 |
| endRow | Integer | 当前页最后一条记录在总结果集中的位置 |
| nextPageNumber | Integer | 下一页编号 |
| offset | Integer | 分页起始记录 |
Contents参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| channelId | String | 频道号 |
| name | String | 频道名称 |
| channelPasswd | String | 频道密码 |
| categoryId | String | 分类ID |
| scene | String | 场景 alone:活动直播 ppt:三分屏 topclass:大班课 seminar:研讨会 |
| watchStatus | String | 观看页状态 live:直播中 playback:回放中 end:已结束 waiting:等待中 |
| watchStatusText | String | 观看页状态描述,直播中,回放中,已结束,等待中 |
| sceneText | String | 场景描述 |
| watchUrl | String | 观看页链接 |
| content | String | 直播介绍 |
| startTime | Long | 直播开始时间,13位毫秒级时间戳 |
| channelLogo | String | 频道图标 |
| splashImg | String | 频道引导图 |
| splashEnabled | String | 引导页开关 Y:开启 N:关闭 |
| publisher | String | 主持人名称 |
| authSetting | Array | 观看条件设置【详见authSetting参数描述】 |
authSetting参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| channelId | String | 频道号 |
| rank | Integer | 用于实现一个频道设置两个观看条件,为1或2 1:主要条件 2:次要条件 |
| userId | String | POLYV用户ID,和保利威官网一致,获取路径:官网->登录->直播(开发设置) |
| globalSettingEnabled | String | 是否开启全局设置 Y:开启 N:关闭 |
| enabled | String | 是否开启观看条件 Y:开启 N:关闭 |
| authType | String | 观看条件类型 none:无限制 code:验证码观看 pay:付费观看 phone:白名单观看 info:登记观看 wxshare:分享观看 custom:自定义授权观看 external:外部授权观看 |
| payAuthTips | String | 付费观看提示信息 |
| price | Float | 付费观看的价格 |
| watchEndTime | Long | 付费观看,截止时间,13位毫秒级时间戳,为null表示:一次付费,永久有效 |
| validTimePeriod | Integer | 付费观看的截止时长(天) |
| infoAuthTips | String | 登记观看提示信息 |
| infoDesc | String | 登记观看的描述字段 |
| codeAuthTips | String | 验证码观看提示信息 |
| authCode | String | 验证码观看的验证码 |
| qcodeTips | String | 验证码观看的二维码提示 |
| qcodeImg | String | 验证码观看的二维码图片 |
| 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 表示对该频道永久有效 |
| authTips | String | 白名单观看提示信息 |
| whiteListInputTips | String | 白名单输入提示 |
| whiteListEntryText | String | 白名单入口文案 |
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(AccountTest.class);
/**
* 查询所有频道的详细信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testChannelDetail() 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/management/list-detail";
String categoryId="345134";
String watchStatus="playback";
String keyword="测试";
String page=String.valueOf(2);
String pageSize=String.valueOf(20);
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("categoryId", categoryId);
requestMap.put("watchStatus", watchStatus);
requestMap.put("keyword", keyword);
requestMap.put("page", page);
requestMap.put("pageSize", pageSize);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url, requestMap);
log.info("测试查询所有频道的详细信息,返回值:{}", response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code":200,
"status":"success",
"message":"",
"data":{
"pageSize":20,
"pageNumber":1,
"totalItems":1,
"contents":[
{
"channelId":2191569,
"name":"测试",
"channelPasswd":"******",
"categoryId":"345134",
"scene":"ppt",
"watchStatus":"playback",
"watchStatusText":"回放中",
"sceneText":"三分屏",
"watchUrl":"https://live.polyv.cn/watch/2191569",
"content":"这是直播介绍,可以是html代码",
"startTime":1557888134000,
"channelLogo":"//liveimages.videocc.net/uploaded/images/2021/03/fwzwkziu67.png",
"splashImg":"//liveimages.videocc.net/uploaded/images/2021/03/fwzwkzkn9l.png",
"splashEnabled":"Y",
"publisher":"主持人名称",
"authSetting":[
{
"channelId":2191569,
"rank":1,
"userId":"1b448be323",
"globalSettingEnabled":"N",
"enabled":"Y",
"authType":"external",
"authTips":"欢迎观看本次直播",
"payAuthTips":"欢迎观看本次直播",
"codeAuthTips":"欢迎观看本次直播",
"infoAuthTips":"欢迎观看本次直播",
"authCode":null,
"qcodeTips":null,
"qcodeImg":null,
"price":0,
"watchEndTime":null,
"validTimePeriod":null,
"customKey":"7020hnems4",
"customUri":null,
"externalKey":"L0EjokKI4O",
"externalUri":"http://demo.ipolyv.cn/chenwb/live-validate.php",
"externalRedirectUri":null,
"directKey":"56221g3rv0",
"trialWatchEnabled":"N",
"trialWatchTime":null,
"trialWatchEndTime":null,
"whiteListInputTips":null,
"whiteListEntryText":"会员入口",
"infoDesc":null
},
{
"channelId":2191569,
"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":"7020hnems4",
"customUri":null,
"externalKey":"9oh7qu8656",
"externalUri":null,
"externalRedirectUri":null,
"directKey":"56221g3rv0",
"trialWatchEnabled":"N",
"trialWatchTime":null,
"trialWatchEndTime":null,
"whiteListInputTips":null,
"whiteListEntryText":"会员入口",
"infoDesc":null
}
]
}
],
"startRow":1,
"firstPage":true,
"lastPage":true,
"prePageNumber":1,
"limit":1,
"endRow":1,
"totalPages":1,
"nextPageNumber":1,
"offset":0
}
}
异常示例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
