Batch Add Watch Whitelist
Updated: 2022-09-02 18:08:07
Interface URL
https://api.polyv.net/live/v3/channel/auth/batch-add-white-list
Interface Description
1. Purpose: Used for batch adding watch whitelist entries
2. The interface supports HTTPS protocol
Supported Format
JSON
Request Method
POST
Request Rate 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 | string | Current time in seconds (13-digit timestamp) |
| sign | Yes | 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 signature generation rules |
| channelId | No | int | Channel ID (if provided, adds to the channel watch whitelist; if omitted, adds to the global watch whitelist) |
| rank | Yes | int | Primary viewing condition is 1, secondary viewing condition is 2 |
| whiteLists | Yes | array | Request body parameter, whitelist list |
| whiteLists.code | Yes | string | Request body parameter, whitelist member code |
| whiteLists.name | Yes | string | Request body parameter, whitelist nickname |
Example of Successful Response
{
"code": 200,
"message": "",
"status": "success",
"data": ""
}
Example of Failed Response
Signature error
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Whitelist list format error
{
"code": 400,
"status": "error"
"message": "whitelist validate error",
"data": ""
}
Response Field Description
| Name | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 400 for failure, 401 for signature error, 500 for unexpected error |
| status | string | "success" for success, "error" for failure |
| message | string | Error message when an error occurs |
| data | string | Success return information |
Java Request Example
private void testBatchAddWhiteList() {
String url = "https://api.polyv.net/live/v3/channel/auth/batch-add-white-list";
// appId和加密串
String appId = "xxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxx";
String channelId = "10001";
String rank = "1";
Map<String, String> params = new HashMap<>();
params.put("channelId", channelId);
params.put("rank", rank);
String body = "{\"whiteLists\": [{\"code\":\"1111\", \"name\":\"2222\"},{\"code\":\"1111eee\", \"name\":\"2222eee\"}]}";
// 调用Polyv的工具类方法设置sign
PolyvTool.setLiveSign(params, appId, appSecret);
String content = HttpClientUtil.getInstance()
.sendHttpPost(url, params, body);
System.out.println(content);
}
