Polyv Help Center

Help Center

Add Page Menu

Updated: 2025-09-25 23:58:46

API Description

1、添加一个频道菜单
2、接口支持https协议

API URL

http://api.polyv.net/live/v3/channel/menu/add

Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules
channelId true String Channel ID
name true String Menu name
type true String Menu type
desc: Live stream introduction
chat: Interactive chat
quiz: Consultation Q&A
text: Text and image menu
iframe: Promotional external link
qa: Q&A
buy: Product list
invite: Invitation leaderboard
content false String Menu content
When the menu type is live stream introduction or text and image menu, this value is the menu content.
When the menu type is external link promotion, if the link type is a universal link, this value is the external link URL. If the link type is multi-platform link, this value is a JSON object string. The JSON object properties are described in the table below.
When the menu type is interactive chat or consultation Q&A, this parameter does not need to be passed and defaults to null.
lang false String Menu language type. Defaults to Chinese if not passed.
zh_CN: Chinese
EN: English
iframeOpenType false String Opening method (currentPage: current page, menuDisplay: menu display, newPage: new page). This parameter is valid only when the menu type is external link promotion.
linkType false Integer External link promotion menu link type (10: Universal link, 11: Multi-platform link, default 10). This parameter is valid only when the menu type is external link promotion.
Parameter Type Description
jumpWay String Jump method: NEW_WINDOW (new window) / CURRENT_WINDOW (current window) / POP_UP (popup)
link String Universal link
pcLink String PC link
mobileLink String Mobile link
wxMiniprogramOriginalId String WeChat Mini Program original ID
wxMiniprogramAppId String WeChat Mini Program APPID
wxMiniprogramLink String WeChat Mini Program page path
mobileAppLink String Mobile app link
iosLink String iOS link
androidLink String Android link
otherLink String Other link

Example

http://api.polyv.net/live/v3/channel/menu/add

Form parameters:

appId=frlr1zazn3&name=%E6%B5%8B%E8%AF%95%E8%8F%9C%E5%8D%95aa&sign=6032B243196C57BCEFE7C063DCEFEC9F&type=text&channelId=2306525&content=%E8%8F%9C%E5%8D%95%E5%86%85%E5%AE%B9aaaa&timestamp=1621842602123

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See Global Error Description
status String Response status text
message String Response description. When code is 400 or 500, it provides auxiliary error reason description.
data Object Menu detail data on success. See data field description

data Field Description

Parameter Type Description
menuId String Menu ID
menuType String Menu type
desc: Live stream introduction
chat: Interactive chat
quiz: Consultation Q&A
text: Text and image menu
iframe: Promotional external link
qa: Q&A
buy: Product list
invite: Invitation leaderboard
name String Menu name
ordered Integer Menu order. Smaller values appear first. Newly added menus are placed at the end by default.
content String Menu content
lang String Menu language type
zh_CN: Chinese
EN: English

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. HttpUtil.java and LiveSignUtil.java from the test cases are included in the download file.

It is strongly recommended to use the Live Java SDK for API functionality integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

private static final Logger log = LoggerFactory.getLogger(MenuTest.class);
/**
 * 增加页面菜单接口
 * @throws IOException
 */
@Test
public void testAddMenu() 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/menu/add";
    String channelId = "2149813";
    String name = "测试菜单aa";
    String type = "text";
    String content = "菜单内容aaaa";

    //http 调用逻辑
    Map<String,String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp",timestamp);
    requestMap.put("channelId",channelId);
    requestMap.put("name",name);
    requestMap.put("type",type);
    requestMap.put("content",content);

    requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.postFormBody(url, requestMap);
    log.info("测试增加页面菜单接口返回值:{}",response);
    //do somethings

}

Response Example

For system-wide global error descriptions, see Global Error Description

Success Example

{
    "code": 200, 
    "status": "success",
    "message": "", 
    "data": {
        "menuId": "7694a2acd4",
        "menuType": "text",
        "name": "测试菜单aa",
        "ordered": 5,
        "content": "菜单内容aaaa",
        "lang": "zh_CN"
    }
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询
在线咨询