Polyv Help Center

Help Center

Modify Channel Decoration Settings

Updated: 2024-04-22 19:18:32

API Description

1、修改频道的页面装修设置,建议将 查询频道的页面装修设置 接口的返回值进行修改作为入参调用该接口
2、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议

API URL

http://api.polyv.net/live/v4/channel/decorate/update

Online API Call

Request Method

POST

API Constraints

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

  2. Image resource domains for this API currently only support Polyv image domains. Images must be converted via the Upload All Channel Decoration Image Materials API.

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, 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never be 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

Request Body Parameter Description

Parameter Required Type Description
chat false Object Template decoration chat object See TemplateDecorateChat
desc false Object Template decoration Chinese live stream description page object See TemplateDecorateDesc
descEn false Object Template decoration English live stream description page object See TemplateDecorateDescEn
englishSettingEnabled false String Bilingual live room switch, Y: Enable, N: Disable
lang false String Language, EN: English, zh_CN: Chinese
menus false Array Chinese menu list object. A value of null or length 0 will not update Chinese menus See TemplateDecorateMenu. Note: The chat menu must be set, otherwise chat will not be supported.
enMenus false Array English menu list object. A value of null or length 0 will not update English menus See TemplateDecorateMenu. Note: The chat menu must be set, otherwise chat will not be supported.
player false Object Template decoration player object See TemplateDecoratePlayer
skin false String Skin, black: Fashion Black, red: Festive Red, blue: Tech Blue, white: Classic White, green: Mint Green, golden: Rich Gold
splash false Object Template decoration splash page object See TemplateDecorateSplash
splashEnabled false String Template decoration splash page switch, Y: Enable, N: Disable

TemplateDecorateChat Parameter Description

Parameter Required Type Description
chatBackgroundImage false String Chat room background image URL. Leave empty to keep unchanged, pass empty string to clear. (For best display, upload an image of 1125 * 1416 px)
chatBackgroundImageOpacity false Integer Chat room background image blur level, 0-50. Higher value means more blur. Leave empty or null to keep unchanged.
portraitChatBgImg false String Portrait video chat room background image URL. Leave empty to keep unchanged, pass empty string to clear. (For best display, upload an image of 1125 * 2436 px)
portraitChatBgImgOpacity false Integer Portrait video chat room background image blur level, 0-50. Higher value means more blur. Leave empty or null to keep unchanged.
baseLikes false Integer Cumulative like count (like base)
chatOnlineNumberEnable false String Online user count switch, Y: Enable, N: Disable
emotionEnabled false String Emotion live room switch. Only one of emotion switch and like switch can be enabled at a time.
redPackEnabled false String Red envelope switch, Y: Enable, N: Disable
sendFlowersEnabled false String Like switch, Y: Enable, N: Disable
viewerSendImgEnabled false String Send image switch, Y: Enable, N: Disable
welcomeEnabled false String Welcome message switch, Y: Enable, N: Disable
withdrawEnabled false String Withdrawal switch, Y: Enable, N: Disable

TemplateDecorateDesc Parameter Description

Parameter Required Type Description
iconUrl false String Icon URL
publisher false String Host name, max length 50
title false String Title -> Live stream name, max length 100

TemplateDecorateDescEn Parameter Description

Parameter Required Type Description
publisher false String Host English name, max length 50
title false String Live stream English name, max length 100

TemplateDecorateMenu Parameter Description

Parameter Required Type Description
menuId false String Menu ID
name true String Menu name
type true String Menu type
desc: Live stream description
chat: Interactive chat
quiz: Quiz
qa: Q&A
invite: Invitation poster
text: Text menu
iframe: Promotional external link
tuwen: Text & image live stream
previous: Previous sessions
buy: Watch & buy
members: Member list
seat: Seat
multiMeeting: Multi-session
content false String Menu content

TemplateDecoratePlayer Parameter Description

Parameter Required Type Description
actualPV false Integer Actual cumulative view count (real count)
backgroundUrl false String PC background image
basePV false Integer Base view count
coverJumpUrl false String Cover (warm-up) jump link
iconLink false String Watermark link
watermarkEnabled false String Watermark switch, Y: Enable, N: Disable
iconPosition false String Watermark position, tl: Top left, tr: Top right, bl: Bottom left, br: Bottom right
iconUrl false String Watermark image URL
logoOpacity false Float Watermark opacity, 0: Fully transparent, 1: Fully opaque
warmUpEnabled false String Warm-up switch
warmUpImageUrl false String Warm-up image URL (live stream cover image)

TemplateDecorateSplash Parameter Description

Parameter Required Type Description
splashImageUrl false String Splash page image

Example

http://api.polyv.net/live/v4/channel/decorate/update?appId=frlr1zazn3&sign=45DD8012F5392F24018CAAD344DAF090&channelId=2523307&timestamp=1630984838533

Request body JSON parameters:

{
    "player": {
        "backgroundUrl": "http://liveimages.videocc.net/uploadimage/20210312/chat_img_1b448be323_16155164629438.jpeg?x-oss-process=image/resize,mfit,w_1280,h_720,limit_1",
        "basePV": 2000,
        "iconLink": "http://www.polyv.net",
        "iconPosition": "br",
        "warmUpEnabled": "N",
        "iconUrl": "http://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
        "watermarkEnabled": "Y",
        "coverJumpUrl": "",
        "warmUpImageUrl": "",
        "actualPV": 200,
        "logoOpacity": "0.7"
    },
    "englishSettingEnabled": "Y",
    "descEn": {
        "publisher": "Polyv special host",
        "title": "Polyv talk"
    },
    "chat": {
        "emotionEnabled": "N",
        "baseLikes": 800,
        "viewerSendImgEnabled": "N",
        "redPackEnabled": "N",
        "sendFlowersEnabled": "N",
        "welcomeEnabled": "N",
        "chatOnlineNumberEnable": "N",
        "withdrawEnabled": "N"
    },
    "skin": "red",
    "splashEnabled": "Y",
    "menus": [
        {
            "type": "desc"
        },
        {
            "type": "chat"
        }
    ],
    "enMenus": [
        {
            "name": "desc",
            "type": "desc"
        },
        {
            "name": "talk",
            "type": "chat"
        }
    ],
    "lang": "zh_CN",
    "splash": {
        "splashImageUrl": ""
    },
    "desc": {
        "publisher": "polyv专用主持人",
        "iconUrl": "http://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
        "title": "polyv宣讲会"
    }
}

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure
status String Response result, determined by business logic. Returns success on success, error on failure.
success Boolean Response result, determined by business logic. Returns true on success, false on failure.
data Object Channel details returned on successful response
error Object Error information when status code is non-200 See Error Field Description
requestId String Request ID, a unique UUID generated for each request. Only for troubleshooting and debugging, should not be tied to business logic.

Error Parameter Description

Parameter Type Description
code Integer Error code, used to identify the specific error reason
desc String Error description, corresponding to error.code

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. Add it to your own project after downloading. 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 integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

    @Test
    public void updateChannelDecorate() throws IOException, NoSuchAlgorithmException {
        String appId = super.appId;
        String appSecret = super.appSecret;
        String timestamp = String.valueOf(System.currentTimeMillis());
        //业务参数
        String url = "http://api.polyv.net/live/v4/channel/decorate/update";
        
        //http 调用逻辑
        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("channelId", "2523307");
        
        Map<String, Object> chatMap = new HashMap<>();
        chatMap.put("baseLikes",800);
        chatMap.put("chatOnlineNumberEnable","N");
        chatMap.put("emotionEnabled","N");
        chatMap.put("redPackEnabled","N");
        chatMap.put("sendFlowersEnabled","N");
        chatMap.put("viewerSendImgEnabled","N");
        chatMap.put("welcomeEnabled","N");
        chatMap.put("withdrawEnabled","N");
        
        Map<String, Object> descMap = new HashMap<>();
        //图标URL
        descMap.put("iconUrl","http://liveimages.videocc.net/assets/wimages/pc_images/logo.png");
        descMap.put("publisher","polyv专用主持人");
        descMap.put("title","polyv宣讲会");
        
        Map<String, Object> descEnMap = new HashMap<>();
        descEnMap.put("publisher","Polyv special host");
        descEnMap.put("title","Polyv talk");
        
        Map<String, Object> enMenusMap1 = new HashMap<>();
        enMenusMap1.put("name","desc");
        enMenusMap1.put("type","desc");
        Map<String, Object> enMenusMap2 = new HashMap<>();
        enMenusMap2.put("name","talk");
        enMenusMap2.put("type","chat");
        List<Map<String,Object>> enMenusList = new ArrayList<>();
        enMenusList.add(enMenusMap1);enMenusList.add(enMenusMap2);
        
        Map<String, Object> chMenusMap1 = new HashMap<>();
        chMenusMap1.put("name","直播间描述");
        chMenusMap1.put("type","desc");
        Map<String, Object> chMenusMap2 = new HashMap<>();
        chMenusMap2.put("name","聊天");
        chMenusMap2.put("type","chat");
        List<Map<String,Object>> chMenusList = new ArrayList<>();
        chMenusList.add(chMenusMap1);chMenusList.add(chMenusMap2);
        
        Map<String, Object> playMap = new HashMap<>();
        playMap.put("actualPV",200);
        playMap.put("backgroundUrl","http://liveimages.videocc.net/uploadimage/20210312/chat_img_1b448be323_16155164629438.jpeg?x-oss-process=image/resize,mfit,w_1280,h_720,limit_1");
        playMap.put("basePV",2000);
        playMap.put("coverJumpUrl","");
        playMap.put("watermarkEnabled","Y");
        playMap.put("iconLink","http://www.polyv.net");
        playMap.put("iconPosition","br");
        playMap.put("iconUrl","http://liveimages.videocc.net/assets/wimages/pc_images/logo.png");
        playMap.put("logoOpacity","0.7");//水印不透明度
        playMap.put("warmUpEnabled","N");
        playMap.put("warmUpImageUrl","");
        
        Map<String, Object> splashMap = new HashMap<>();
        splashMap.put("splashImageUrl","");
        
        Map<String, Object> bodyMap = new HashMap<>();
        bodyMap.put("chat", chatMap);
        bodyMap.put("desc", descMap);
        bodyMap.put("descEn", descEnMap);
        bodyMap.put("enMenus", enMenusList);
        bodyMap.put("menus", chMenusList);
        bodyMap.put("englishSettingEnabled", "Y");//双语直播间开关
        bodyMap.put("lang", "zh_CN");
        bodyMap.put("player", playMap);
        bodyMap.put("skin", "red");
        bodyMap.put("splash", splashMap);
        bodyMap.put("splashEnabled", "Y");
        
        requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
        
        String body = JSON.toJSONString(bodyMap);
        url = HttpUtil.appendUrl(url, requestMap);
        String response = HttpUtil.postJsonBody(url,body,null);
        
        log.info("测试修改频道装修设置,返回值:{}", response);
    }

Response Example

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "dc7ae621ef8e4f4a8e4976833f1dbbd4.69.16309852981551185",
    "data": null,
    "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "requestId": "4081dbac03e6441e8bdd301d8feee5a2.117.16360829141876029",
    "error": {
        "code": 30004,
        "desc": "找不到频道"
    },
    "success": false
}
联系客服,在线咨询
在线咨询