webMenu
Updated: 2025-09-11 15:18:09
1. Set Custom Menu Live Introduction
Description
设置自定义菜单中用户设置菜单的直播介绍
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelSetting/%s/%s/set-menu
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, click here.
Unit Test
@Test
public void testUpdateChannelMenu() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelMenuRequest liveUpdateChannelMenuRequest = new LiveUpdateChannelMenuRequest();
Boolean liveUpdateChannelMenuResponse;
try {
liveUpdateChannelMenuRequest.setChannelId(createChannel())
.setMenuType("desc")
.setContent("<html><body><h1>hello world</h1></body></html>");
liveUpdateChannelMenuResponse = new LiveWebMenuServiceImpl().updateChannelMenu(
liveUpdateChannelMenuRequest);
Assert.assertNotNull(liveUpdateChannelMenuResponse);
if (liveUpdateChannelMenuResponse) {
//to do something ......
log.debug("测试设置自定义菜单直播介绍成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
- On a successful request, a Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]]. - If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.].
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| userId | false | String | POLYV user ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
| channelId | true | String | Channel ID |
| content | true | String | Content of the live introduction (HTML page content can be filled here, such as adding images, text styles, etc.) |
| menuType | true | String | Menu type. Currently, only desc is supported. |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
Return Object Description
true indicates successful setting, false indicates failure.
2. Query Channel Menu Information
Description
获取频道的菜单信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/menu/list
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, click here.
Unit Test
@Test
public void testListChannelMenu() throws Exception, NoSuchAlgorithmException {
LiveListChannelMenuRequest liveListChannelMenuRequest = new LiveListChannelMenuRequest();
LiveListChannelMenuResponse liveListChannelMenuResponse;
try {
liveListChannelMenuRequest.setChannelId(createChannel());
liveListChannelMenuResponse = new LiveWebMenuServiceImpl().listChannelMenu(liveListChannelMenuRequest);
Assert.assertNotNull(liveListChannelMenuResponse);
if (liveListChannelMenuResponse != null) {
//to do something ......
log.debug("测试查询频道的菜单信息成功,{}", JSON.toJSONString(liveListChannelMenuResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
- On a successful request, a
LiveListChannelMenuResponseobject is returned. The B-end processes business logic based on this object. - If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]]. - If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.].
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID. If not provided, global settings are retrieved. |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| channelMenus | Array | Channel menu information [See ChannelMenu Parameter Description for details] |
ChannelMenu Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| menuId | String | Menu ID |
| menuType | String | Menu type. desc for live introduction, chat for chat room, quiz for consultation questions, iframe for promotional external links, text for custom text/image menu. |
| name | String | Menu name |
| ordered | Integer | Sort order |
| content | String | Content |
3. Add Channel Menu
Description
添加一个频道菜单
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/menu/add
Call Constraints
API calls are rate-limited. Click here for details. For common call exceptions, click here.
If a
desctype menu already exists, a "menu already exist" exception will be thrown.
Unit Test
@Test
public void testAddChannelMenu() throws Exception, NoSuchAlgorithmException {
LiveAddChannelMenuRequest liveAddChannelMenuRequest = new LiveAddChannelMenuRequest();
LiveAddChannelMenuResponse liveAddChannelMenuResponse;
try {
liveAddChannelMenuRequest.setChannelId(createChannel())
.setName("推广2")
.setType("iframe")
.setContent("http://live.polyv.net")
.setLang("zh_CN");
liveAddChannelMenuResponse = new LiveWebMenuServiceImpl().addChannelMenu(liveAddChannelMenuRequest);
Assert.assertNotNull(liveAddChannelMenuResponse);
if (liveAddChannelMenuResponse != null) {
//to do something ......
log.debug("测试添加频道菜单成功,{}", JSON.toJSONString(liveAddChannelMenuResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
- On a successful request, a
LiveAddChannelMenuResponseobject is returned. The B-end processes business logic based on this object. - If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]]. - If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.].
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| name | true | String | Menu name |
| type | true | String | Menu type. desc: Live introduction; chat: Interactive chat; quiz: Consultation questions; text: Text/image menu; iframe: Promotional external link; qa: Q&A; buy: Product list; invite: Invitation ranking. |
| content | true | String | Menu content. When the menu type is live introduction or text/image menu, this value is the menu content. When the menu type is external link promotion, this value is the external link URL. |
| lang | false | String | Menu language type. Default is zh_CN.zh_CN: ChineseEN: English |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| menuId | String | Menu ID |
| menuType | String | Menu type. desc: Live introduction; chat: Interactive chat; quiz: Consultation questions; text: Text/image menu; iframe: Promotional external link; qa: Q&A; buy: Product list; invite: Invitation ranking. |
| name | String | Menu name |
| ordered | String | Menu order. The smaller the value, the more front it is. Newly added menus are placed at the end by default. |
| content | String | Menu content. When the menu type is live introduction or text/image menu, this value is the menu content. When the menu type is external link promotion, this value is the external link URL. |
| lang | String | Menu language typezh_CN: ChineseEN: English |
4. Set Channel Menu Sort Order
Description
设置直播频道的菜单的顺序
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/menu/update-rank
Call Constraints
API calls are rate-limited. Click here for details. For common call exceptions, click here.
The list of channel menu IDs must be complete (cannot have extra or missing IDs).
Unit Test
@Test
public void testUpdateChannelMenuSort() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelMenuSortRequest liveUpdateChannelMenuSortRequest = new LiveUpdateChannelMenuSortRequest();
Boolean liveUpdateChannelMenuSortResponse;
try {
String channelId = super.createChannel();
List<String> menuIds = listChannelMenuIds(channelId);
Collections.shuffle(menuIds);
String menuIdsStr = StringUtils.join(menuIds.toArray(), ",");
liveUpdateChannelMenuSortRequest.setChannelId(channelId)
.setMenuIds(menuIdsStr)
.setLang("zh_CN");
liveUpdateChannelMenuSortResponse = new LiveWebMenuServiceImpl().updateChannelMenuSort(
liveUpdateChannelMenuSortRequest);
Assert.assertNotNull(liveUpdateChannelMenuSortResponse);
if (liveUpdateChannelMenuSortResponse != null) {
//to do something ......
log.debug("测试设置频道菜单排序成功,{}", JSON.toJSONString(liveUpdateChannelMenuSortResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
- On a successful request, a Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]]. - If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.].
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| menuIds | true | String | List of channel menu IDs. Must be a complete list (cannot have extra or missing IDs). Indicates the order in which menus should be arranged. |
| lang | false | String | Menu language type. Default is zh_CN (Chinese), EN (English). |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
Return Object Description
null
5. Set Channel Menu Information for a Specified Menu ID
Description
设置指定菜单id的频道菜单信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/menu/update
Call Constraints
API calls are rate-limited. Click here for details. For common call exceptions, click here.
Menu IDs for interactive chat or consultation questions cannot be set.
Unit Test
@Test
public void testUpdateChannelMenuInfo() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelMenuInfoRequest liveUpdateChannelMenuInfoRequest = new LiveUpdateChannelMenuInfoRequest();
Boolean liveUpdateChannelMenuInfoResponse;
try {
//可自行通过 查询频道的菜单信息 获取菜单id
String menuId = super.getDescMenuId();
liveUpdateChannelMenuInfoRequest.setMenuId(menuId)
.setContent("Mysql 知识精讲(Junit勿删)")
.setLang("zh_CN");
liveUpdateChannelMenuInfoResponse = new LiveWebMenuServiceImpl().updateChannelMenuInfo(
liveUpdateChannelMenuInfoRequest);
Assert.assertNotNull(liveUpdateChannelMenuInfoResponse);
if (liveUpdateChannelMenuInfoResponse != null) {
//to do something ......
log.debug("测试设置指定菜单id的频道菜单信息成功,{}", JSON.toJSONString(liveUpdateChannelMenuInfoResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
- On a successful request, a Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]]. - If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.].
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| menuId | true | String | Menu ID (Menu IDs for interactive chat or consultation questions cannot be set). |
| content | true | String | Menu content |
| lang | false | String | Menu language type. Default is zh_CN (Chinese), EN (English). |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
Return Object Description
null
6. Delete Channel Menu
Description
删除指定的频道菜单,支持批量
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/menu/delete
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, click here.
Unit Test
@Test
public void testDeleteChannelMenu() throws Exception, NoSuchAlgorithmException {
LiveDeleteChannelMenuRequest liveDeleteChannelMenuRequest = new LiveDeleteChannelMenuRequest();
Boolean liveDeleteChannelMenuResponse;
try {
liveDeleteChannelMenuRequest.setMenuIds("db1663823d,d9ba333cdc");
liveDeleteChannelMenuResponse = new LiveWebMenuServiceImpl().deleteChannelMenu(
liveDeleteChannelMenuRequest);
Assert.assertTrue(liveDeleteChannelMenuResponse);
if (liveDeleteChannelMenuResponse) {
//to do something ......
log.debug("测试删除频道菜单成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
- On a successful request, a Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]]. - If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.].
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| menuIds | true | String | Menu IDs. Specify multiple IDs separated by commas. |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
Return Object Description
true indicates successful deletion, false indicates failure.
7. Set Question Function Display Switch
Description
可以开启或关闭咨询提问功能菜单
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channel/menu/%s/update-consulting-enabled
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, click here.
Unit Test
@Test
public void testSetConsultingEnabled() throws Exception, NoSuchAlgorithmException {
LiveSetConsultingEnabledRequest liveSetConsultingEnabledRequest = new LiveSetConsultingEnabledRequest();
Boolean liveSetConsultingEnabledResponse;
try {
liveSetConsultingEnabledRequest.setChannelId(createChannel())
.setEnabled("N");
liveSetConsultingEnabledResponse = new LiveWebMenuServiceImpl().setConsultingEnabled(
liveSetConsultingEnabledRequest);
Assert.assertTrue(liveSetConsultingEnabledResponse);
if (liveSetConsultingEnabledResponse) {
//to do something ......
log.debug("测试设置提问功能显示开关成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
- On a successful request, a Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]]. - If the server encounters an error, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), e.g.,[Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.].
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| enabled | true | String | Consultation question switch. Y: Enable, N: Disable. |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the Polyv official website. Path: Official Website -> Login -> Live (Development Settings). |
Return Object Description
null
8. Query Channel Image/Text Content List
Description
获取频道图文内容列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/watch/tuwen/list
Call Constraints
- API calls are rate-limited. Click here for details. For common call exceptions, [
