Get Channel Virtual Audience Settings
Updated: 2022-09-02 18:08:07
Interface URL
https://api.polyv.net/live/v3/channel/basic/get-rebot-setting
Interface Description
1、接口用于查询频道虚拟人数设置信息
2、接口支持https
Supported Format
JSON
Request Method
GET、POST
Request Limit
TRUE
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | Yes | string | Obtained from API settings, the appId registered in the live streaming system |
| timestamp | Yes | long | Current millisecond timestamp (13 digits) |
| sign | Yes | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security and must not be stored or used directly on the client. 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 |
| channelIds | Yes | string | Channel IDs, multiple channels separated by "," |
Successful Response JSON Example:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"list": [
{
"channelId": 2180007,
"robotNumber": 6,
"addRobotModel": "timely",
"changeTime": 20000,
"leftTime": 0,
"robotNumberTimes": 1
},
{
"channelId": 2204300,
"robotNumber": 0,
"addRobotModel": "timely",
"changeTime": 20000,
"leftTime": 0,
"robotNumberTimes": 1
}
]
}
}
Response Field Description
| Parameter | Description |
|---|---|
| code | Status code: 200 for success, 403 for signature failure, 400 for parameter error, 500 for server error |
| status | "success" for success, "error" for error |
| message | Empty string for success, error description for failure |
| data | Response data |
| data.list.channelId | Channel ID |
| data.list.robotNumber | Number of virtual audience |
| data.list.robotNumberTimes | Multiplier for virtual audience count |
| data.list.addRobotModel | Display mode for audience count: "timely" for immediate effect, "fixed_time" for time-phased effect |
| data.list.changeTime | Time interval for adding virtual audience in phases, in milliseconds |
| data.list.leftTime | Time remaining until next available setting, in milliseconds |
Failed Response JSON Example:
Parameter error
{
"code": 400,
"status": "error",
"message": "param validate error",
"data": ""
}
appId not provided
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
Incorrect appId
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
Timestamp error
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
Signature error
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Invalid channel ID
{
"code": 403,
"status": "error",
"message": "illegal channel id: %s",
"data": ""
}
Java Request Example
public void testAddRecordTask() {
String url = "https://api.polyv.net/live/v3/channel/basic/get-rebot-setting";
// appId和加密串
String appId = "xxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxx";
Map<String, String> params = new HashMap<>();
params.put("channelIds", "2204300,2180007");
// 调用Polyv的工具类方法设置sign
PolyvTool.setLiveSign(params, appId, appSecret);
String content = HttpClientUtil.getInstance()
.sendHttpPost(url, params);
System.out.println(content);
}
