修改频道信息
更新时间:2026-08-05 16:13:23
接口描述
1、修改频道的相关设置
2、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https
接口URL
http://api.polyv.net/live/v3/channel/basic/update
请求方式
POST
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | true | String | 账号appId【详见获取密钥】 |
| timestamp | true | Long | 当前13位毫秒级时间戳,3分钟内有效 |
| sign | true | String | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则】 |
| channelId | true | String | 频道号 |
请求体参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| basicSetting | false | Object | 基础设置【详见basicSetting字段说明】 |
| authSettings | false | Array | 观看条件设置【详见authSettings字段说明】 |
basicSetting参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| name | false | String | 频道名称,长度不能超过100字符 |
| channelPasswd | false | String | 频道密码,长度不能超过16位 |
| publisher | false | String | 主持人名称 |
| startTime | false | Long | 直播开始时间,13位时间戳,设置为0 表示关闭直播开始时间显示 |
| endTime | false | Long | 直播结束时间,13位时间戳【注:仅做未开播时直播状态判断显示,不对讲师开播操作产生影响】 |
| resetEndTime | false | String | 清空直播结束时间开关,Y:清空,N:不清空(当为Y时endTime字段需为空或不传) |
| pageView | false | Integer | 累积观看数 |
| likes | false | Integer | 点赞数 |
| coverImg | false | String | 直播间图标地址,非保利威域名下的图片需先调用上传频道所有装修图片素材上传 |
| splashImg | false | String | 引导页图片地址,非保利威域名下的图片需先调用上传频道所有装修图片素材上传 |
| splashEnabled | false | String | 引导页开关 Y:开启 N:关闭 |
| desc | false | String | 直播介绍 |
| consultingMenuEnabled | false | String | 咨询提问开关 Y:开启 N:关闭 |
| maxViewerRestrict | false | String | 是否限制最大观看人数 Y:是 N:否 |
| maxViewer | false | Integer | 最大在线人数 |
| categoryId | false | String | 频道的所属分类,如果不提交,则不修改(分类ID可通过“查询直播分类”接口得到) |
| linkMicLimit | false | Integer | 连麦人数,最大16人(范围大于等于-1,小于等于全局设置的连麦人数),-1:使用全局设置的连麦人数,0:不使用连麦 |
| operation | false | String | 是否增加转播关联(注:需要开启频道转播功能该参数才生效) Y:表示增加关联 N:表示取消关联 |
| receiveChannelIds | false | String | 接收转播频道号,多个频道号用半角逗号","隔开(注:需要开启频道转播功能该参数才生效,一个频道最多只能关联500个接收转播的频道) |
| closeDanmu | false | String | 是否关闭弹幕功能的开关 N:表示不关闭 Y:表示关闭 |
| showDanmuInfoEnabled | false | String | 默认是否显示弹幕信息开关 Y:表示显示 N:表示不显示 |
| pureRtcEnabled | false | String | 是否开启无延时直播开关,为空时不对字段进行修改,直播中不能对该字段进行修改 Y:表示是 N:表示否 |
| customTeacherId | false | String | 自定义讲师ID,32个以内ASCII码可见字符 |
| labelData | false | Array | 标签id数组 |
authSettings参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| rank | true | Integer | 主要观看条件为1,次要观看条件为2 |
| enabled | true | String | 是否开启条件观看 N:关闭 Y:开启 |
| authType | false | String | pay:付费观看 code:验证码观看 phone:白名单观看 info:登记观看 custom:自定义授权观看 external:外部授权观看 direct:独立授权观看。修改具体观看条件配置时必填;不传时仅修改enabled字段 |
| payAuthTips | false | String | 当authType为pay时,设置参数,非必填。欢迎语标题 |
| price | false | Float | 当authType为pay时,设置参数,必填。价格,单位为元 |
| watchEndTime | false | String | 当authType为pay时,设置参数,非必填。付费有效截止日期,格式为13位时间戳 |
| validTimePeriod | false | Integer | 当authType为pay时,设置参数,非必填。付费有效时长,单位天。当watchEndTime和validTimePeriod都为空时,表示付费永久有效 |
| authCode | false | String | 当authType为code时,设置参数,必填。验证码 |
| qcodeTips | false | String | 当authType为code时,设置参数,非必填。提示文案 |
| qcodeImg | false | String | 当authType为code时,设置参数,非必填。公众号二维码地址 |
| authTips | false | String | 当authType为phone时,设置参数,非必填。提示文案 |
| whiteListEntryText | false | String | 当authType为phone时,设置参数,非必填。白名单入口文案 |
| whiteListInputTips | false | String | 当authType为phone时,设置参数,非必填。白名单输入提示 |
| infoFields | false | Array | 当authType为info时,设置参数,必填。登记观看信息,上限为5个【详见infoFields字段说明】 |
| infoAuthTips | false | String | 当authType为info时,设置参数,非必填。欢迎标题 |
| infoDesc | false | String | 当authType为info时,设置参数,非必填。提示信息 |
| infoEntryText | false | String | 当authType为info时,设置参数,非必填。入口文本 |
| externalKey | false | String | 当authType为external时,设置参数,必填。SecretKey |
| externalUri | false | String | 当authType为external时,设置参数,必填。自定义url |
| externalRedirectUri | false | String | 当authType为external时,设置参数,非必填。跳转地址 |
| extTrialWatchEnabled | false | String | 当authType为external时,设置外部授权试看开关 Y:开启 N:关闭。修改该字段时必须同时传authType=external |
| extTrialWatchTime | false | Integer | 当authType为external且extTrialWatchEnabled为Y时,必填。试看时长,单位为分钟,必须大于0 |
| extTrialWatchEndTime | false | String | 当authType为external且extTrialWatchEnabled为Y时,非必填。试看有效截止时间,格式为yyyy-MM-dd HH:mm;不传表示永久有效 |
| extTrialRedirectUrl | false | String | 当authType为external且extTrialWatchEnabled为Y时,必填。试看耗尽后的跳转地址,必须为有效的HTTP或HTTPS地址,最大长度1024字符 |
| customKey | false | String | 当authType为custom时,设置参数,必填。SecretKey |
| customUri | false | String | 当authType为custom时,设置参数,必填。自定义url |
| directKey | false | String | 当authType为direct时,设置参数,必填。独立授权SecretKey |
| expectedArrivalEnabled | false | String | 当authType为phone时,设置到课名单开关 N:关闭 Y:开启 |
infoFields字段说明
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| name | false | String | 当authType为info时,设置参数,非必填。登记信息名,最多为8字符 |
| type | false | String | 当authType为info时,设置参数,必填。登记类型 name:姓名 text:文本 mobile:手机号码 number:数字 option:下拉选项 |
| options | false | String | 当authType为info时,设置参数,非必填。下拉选项时,下拉的选项值,以英文逗号分割。选项个数上限为8个;选项内容最多为8字符 |
| placeholder | false | String | 当authType为info时,设置参数,非必填。文本框输入提示,最多为8字符 |
| sms | false | String | 当authType为info时,设置参数,非必填。短信验证开关,Y:开启,N:关闭 |
示例
http://api.polyv.net/live/v3/channel/basic/update?appId=frlr1zazn3&sign=2FC2F272EBEEC40CC1833A127BF4F53F&channelId=2191569×tamp=1621840356767
请求体json参数:
{
"basicSetting": {
"name": "测试",
"channelPasswd": "10086",
"publisher": "主持人名称",
"startTime": 1557888134000,
"pageView": 1000,
"likes": 666,
"coverImg": "http://my.polyv.net/v_22/assets/dist/images/navbar/logo.png",
"splashImg": "http://my.polyv.net/v_22/assets/dist/images/navbar/logo.png",
"splashEnabled": "Y",
"desc": "这是直播介绍,可以是html代码",
"consultingMenuEnabled": "N",
"maxViewerRestrict": "Y",
"maxViewer": 100,
"categoryId": 345134,
"closeDanmu": "N",
"showDanmuInfoEnabled": "N",
"labelData":["zpmz3640wkxpj267"]
},
"authSettings": [{
"rank": 1,
"enabled": "Y",
"authType": "external",
"externalKey": "L0EjokKI4O",
"externalUri": "http://demo.ipolyv.cn/chenwb/live-validate.php",
"extTrialWatchEnabled": "Y",
"extTrialWatchTime": 5,
"extTrialWatchEndTime": "2026-08-31 12:00",
"extTrialRedirectUrl": "https://www.baidu.com"
}]
}
响应参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | Integer | 响应状态码,200为成功返回,非200为失败【详见全局错误说明】 |
| status | String | 响应状态文本信息 |
| message | String | 响应描述信息,当code为400或者500的时候,辅助描述错误原因 |
| data | 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 testUpdateChannelDetailSetting() 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/update";
String channelId = "2191569";
//http 调用逻辑
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));
url = HttpUtil.appendUrl(url,requestMap);
String password=getRandomString(6);
String json="{\"basicSetting\":{\"name\":\"测试\",\"channelPasswd\":\"%s\",\"publisher\":\"主持人名称\",\"startTime\":1557888134000,\"pageView\":1000,\"likes\":666,\"coverImg\":\"http://my.polyv.net/v_22/assets/dist/images/navbar/logo.png\",\"splashImg\":\"http://my.polyv.net/v_22/assets/dist/images/navbar/logo.png\",\"splashEnabled\":\"Y\",\"desc\":\"这是直播介绍,可以是html代码\",\"consultingMenuEnabled\":\"N\",\"maxViewerRestrict\":\"Y\",\"maxViewer\":100,\"categoryId\":345134,\"closeDanmu\":\"N\",\"showDanmuInfoEnabled\":\"N\"},\"authSettings\":[{\"rank\":1,\"enabled\":\"Y\",\"authType\":\"external\",\"externalKey\":\"L0EjokKI4O\",\"externalUri\":\"http://demo.ipolyv.cn/chenwb/live-validate.php\",\"extTrialWatchEnabled\":\"Y\",\"extTrialWatchTime\":5,\"extTrialWatchEndTime\":\"2026-08-31 12:00\",\"extTrialRedirectUrl\":\"https://www.baidu.com\"}]}";
json=String.format(json,password);
String response = HttpUtil.postJsonBody(url, json,null);
log.info("测试修改频道信息,返回值:{}", response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code":200,
"status":"success",
"message":"",
"data":""
}
异常示例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
