Polyv Help Center

Help Center

Modify Channel Role Permission Settings

Updated: 2024-07-22 09:16:03

API Description

1、修改频道角色权限设置
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议

API URL

https://api.polyv.net/live/v4/channel/role-config/update-by-role

<a href="/req.html?api=https://api.polyv.net/live/v4/channel/role-config/update-by-role"" target="_blank">Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure 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 never be saved 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 Integer Channel ID
role true String Role type: Teacher, Guest

Request Body Parameter Description

Parameter Required Type Description
body true Object Subtitle information list See body parameter field description

Body Parameter Field Description

Parameter Required Type Description
webStartCheckInDisplayEnabled false String Check-in function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartLotteryDisplayEnabled false String Lottery function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartQuestionnaireDisplayEnabled false String Questionnaire function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartAnswerDisplayEnabled false String Answer card function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartTimerDisplayEnabled false String Timer function display toggle on the broadcast start page (available when role is Teacher): Y - Enable, N - Disable
webStartRedPackDisplayEnabled false String Red packet function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartCardPushDisplayEnabled false String Card push function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartNotifyDisplayEnabled false String Announcement function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartLinkMicDisplayEnabled false String Link mic function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartMultiMediaDisplayEnabled false String Multimedia function display toggle on the broadcast start page: Y - Enable, N - Disable
webStartMembersDisplayEnabled false String Member list function display toggle on the broadcast start page: Y - Enable, N - Disable
screenShareRetainCameraEnabled false String Keep camera state during screen sharing toggle: Y - Enable, N - Disable
multiplexingDefaultLayout false String Default layout for multiplexing (available when role is Teacher): 1 - Single person mode, 2 - Tiled mode, 3 - Presenter mode
cameraSingleModeEnabled false String Camera single person mode toggle: Y - Enable, N - Disable
aiVirtualBgUrl false String AI virtual background image URL
remixDefaultEnabled false String Default audio mixing toggle: Y - Enable, N - Disable
showSceneTemplateEnabled false String Show scene template toggle: Y - Enable, N - Disable
hideFramesDirectionEnabled false String Hide frame direction switch entry toggle: Y - Enable, N - Disable
defaultOpenMicLinkEnabled false String Default link mic mode (available when role is Teacher): video - Audio and video, audio - Audio only

Example

http://api.polyv.net/live/v4/channel/role-config/update-by-role?channelId=4872391&role=Teacher&timestamp=1721291107000&appId=fso8gzbxlr&sign=D15AFF4476E348FC7F9ECE750B4C96F7

Request body JSON parameters:

{
    "webStartCheckInDisplayEnabled": "N"
}

Response Parameter Description

Parameter Type Description
code Integer Status code, same as HTTP status code, used to determine the basic response status
status String Response result, determined by the business. Returns success on success, error on failure
success Boolean Whether the response was successful
requestId String Request ID, a unique UUID generated for each request. Only for troubleshooting and debugging, should not be tied to business logic
error Object Error information when status code is not 200 See Error field description
data Object Returned content

Error Parameter Description

Parameter Type Description
code Integer Error code, used to determine the specific error reason
desc String Error description, corresponds 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. After downloading, add it to your own source code 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 integration. The Live Java SDK provides unified packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pooling.

private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
 * 修改频道角色权限
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void updateChannelRoleConfigTest() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());
    int channelId = 100033;
    
    //业务参数
    String url = "https://api.polyv.net/live/v4/channel/role-config/update-by-role";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", "4872391");
    requestMap.put("role", "Teacher");
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    url = HttpUtil.appendUrl(url, requestMap);
    

    Map<String, Object> jsonMap = new HashMap<>();
    jsonMap.put("webStartCheckInDisplayEnabled", "N");

    String json = JSON.toJSONString(jsonMap);
    
    String response = HttpUtil.postJsonBody(url, json, null);

    log.info("测试修改频道角色权限设置成功:{}", response);
    //do somethings
    
}

Response Example

For global error descriptions, see Global Error Description

Success example (test example channel ID is hidden)

{
    "code": 200,
    "status": "success",
    "requestId": "14138a5004b1412fbe109f854fec0b52.59.16538790171742883",
    "data": "",
    "success": true
}

Error example

{
    "code": 400,
    "status": "error",
    "requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
    "error": {
        "code": 20001,
        "desc": "application not found."
    },
    "success": false
}
联系客服,在线咨询