修改頻道資訊
更新時間: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": ""
}
