Polyv Help Center

Help Center

Set the channel's virtual booking count

Updated: 2026-10-26 12:54:05

API Description

1、单独设置频道虚拟预约人数,不影响聊天室显示虚拟人数
2、人数显示模式支持立即生效、分时生效
3、接口支持https协议

API URL

http://api.polyv.net/live/v4/channel/robot/virtual-booking-number/update

Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls are subject to frequency limits. For details, please see

  2. Please set the request header contentType:application/json

Request Parameter Description

Parameter Name Required Type Description
appId true String Account appId [see Get Key for details]
timestamp true Long Current 13-digit millisecond timestamp, valid within 3 minutes
sign true String Signature, a 32-character uppercase MD5 value, The appSecret key used to generate the signature is key information for communication data security. It is strictly prohibited to save it on the client for direct use. All APIs must be called through the customer's own server as an intermediary to obtain response data from the POLYV server. [see Signature Generation Rules for details]
channelId true String Channel ID

Request Body Parameter Description

Parameter Name Required Type Description
channelId true Integer Channel ID
virtualBookingNumber true Integer Virtual booking count
addRobotModel true String Count display mode
timely: takes effect immediately
fixed_time: takes effect at a scheduled time
changeTime false Integer Effective time. Required when addRobotModel is fixed_time. Unit: seconds. Minimum value: 20 (20 seconds). Maximum value: 18000 (300 minutes).

Example

http://api.polyv.net/live/v4/channel/robot/virtual-booking-number/update?appId=xxx&sign=xxx&timestamp=xxx&channelId=3335806
{
    "channelId": 3335806,
    "virtualBookingNumber": 100,
    "addRobotModel": "timely"
}

Response Parameter Description

Parameter Name Type Description
code Integer Status code, same as the HTTP status code, used to determine the basic response status
status String Response result, determined by the business. Returns success on success and error on failure.
success Boolean Whether the response is successful
requestId String Request ID, a unique UUID generated for each request. It can only be used for troubleshooting and debugging and should not be tied to business logic.
error Object Error information when the status code is not 200 [see Error Field Description for details]
data Object Returns null on a successful response

Error Parameter Description

Parameter Name Type Description
code Integer Error code, used to determine the specific cause of the error
desc String Error description, corresponding to error.code

Java Request Example

For quick integration of the basic code, please download the relevant dependency source code, click to download the source code, and add it to your own source project after downloading. The HttpUtil.java and LiveSignUtil.java in the test cases are both included in the downloaded file.

It is strongly recommended that you use the Live Java SDK to complete the API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, signature rules, and the HTTP request thread pool.

private static final Logger log = LoggerFactory.getLogger(getClass());
/**
 * 设置频道虚拟预约人数
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void updateVirtualBookingNumberTest() 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/robot/virtual-booking-number/update";
    String channelId = "3335806";

    //签名参数
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", channelId);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));

    //请求体参数
    Map<String, Object> jsonMap = new HashMap<>();
    jsonMap.put("channelId", Integer.valueOf(channelId));
    jsonMap.put("virtualBookingNumber", 100);
    jsonMap.put("addRobotModel", "timely");

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

    log.info("测试设置频道虚拟预约人数成功:{}", response);
    //do somethings

}

Response Example

For system-wide error descriptions, see Global Error Description

Success example

{
    "code": 200,
    "status": "success",
    "requestId": "61b9319c9e3b42979f8a152dfa6b3f40.73.16626900842179815",
    "data": null,
    "success": true
}

Exception example

{
    "code": 400,
    "status": "error",
    "requestId": "4081dbac03e6441e8bdd301d8feee5a2.117.16360830583026105",
    "error": {
        "code": 10001,
        "desc": "生效时间不能为空"
    },
    "success": false
}
联系客服,在线咨询
在线咨询