Modify Channel Chat Room Speech Toggle
Updated: 2025-12-05 17:52:42
Interface Description
1、修改频道聊天室发言开关
2、接口支持https协议
Interface URL
http://api.polyv.net/live/v4/channel/chat/update-chatEnabled
Request Method
POST
Interface Constraints
- The interface supports both HTTP and HTTPS. HTTPS is recommended for security. Interface calls have frequency limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details: 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 details: Signature Generation Rules |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelIds | true | List |
List of channel IDs |
| chatEnabled | true | String | Chat room speech toggle, value is Y or N. Y: Enable speech. N: Mute |
Example
http://api.polyv.net/live/v4/channel/chat/update-chatEnabled?appId=frlr1zazn3&sign=B02AEC5A3EA38F7F0506E07E3DC88DB7×tamp=1670551295592
Request body JSON parameters:
{
"channelIds": [3630700, 3630701],
"chatEnabled": "Y"
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine basic response status |
| status | String | Response result, determined by business logic. 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 used for troubleshooting and debugging, not related to business logic |
| error | Object | Error information when status code is not 200 See details: Error Field Description |
| data | Boolean | Operation result, true indicates success, false indicates failure |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to identify the specific error cause |
| desc | String | Error description, corresponding to error.code |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| - | Boolean | Operation result, true indicates success, false indicates failure |
Java Request Example
For quick integration of basic code, download the related dependency source code. Click to download source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded 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.
private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 修改频道聊天室发言开关
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void updateChatEnabledTest() 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/chat/update-chatEnabled";
List<Integer> channelIds = Arrays.asList(3630700, 3630701);
String chatEnabled = "Y";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("channelIds", channelIds);
jsonMap.put("chatEnabled", chatEnabled);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试修改频道聊天室启用状态成功:{}", response);
//do somethings
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "dc7ae621ef8e4f4a8e4976833f1dbbd4.69.16309852981551185",
"data": true,
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
