Polyv Help Center

Help Center

Batch Add Whitelist

Updated: 2023-11-23 18:30:45

API Description

1、批量新增白名单
2、白名单数量上限是1万条
3、单次只允许增加同一频道的记录
4、校验会员码是否重复时,不区分大小写
5、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
6、接口支持https协议

API URL

https://api.polyv.net/meet/v1/channel/auth-whitelist/save-batch

Request Method

POST

API Constraints

  1. The API has a frequency limit. 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 within 3 minutes
sign true String Signature, a 32-character uppercase MD5 value See details: Signature Generation Rules
channelId true Integer Channel ID

Request Body Parameter Description

Parameter Required Type Description
list true Array Batch insert records See details: list field description

list Field Description

Parameter Required Type Description
code true String Member code, length not exceeding 64 characters (must be unique)
name true String Participant nickname, length not exceeding 64 characters
groupNo false Integer Group number, between 1 and 50 (must be passed together with groupRole or omitted together)
groupRole false String Role within the group, no more than one leader per group (must be passed together with groupNo or omitted together)
leader: Group leader
member: Group member

Example

https://api.polyv.net/meet/v1/channel/auth-whitelist/save-batch?appId=fyirmfdak4&timestamp=1657786379352&sign=CEA301164F9BA5076F156C1EB60F22F8&channelId=3220878

Request Body Parameters

{
  "list" : [{
    "code": "code1",
    "name": "name1",
    "groupNo": 1,
    "groupRole": "leader"
  }, {
    "code": "code2",
    "name": "name2"
  }, {

    "code": "code3",
    "name": "name3",
    "groupNo": 2,
    "groupRole": "member"
  }]
}

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 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 for debugging and troubleshooting, not related to business logic
error Object Error information when status code is not 200 See details: Error field description
data Object Failure reason, returned on failure. Empty on success See details: data field description

Error Parameter Description

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

data Field Description

Parameter Required Type Description
infoIncorrectCodeList Array Member codes with invalid information (empty nickname/nickname length > 64 characters/group number not between 1 and 50/incorrect groupRole parameter)
duplicateCodeList Array List of duplicate member codes
duplicateLeaderGroupNoList Array Group numbers with duplicate leaders

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. 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 pooling.

private static final Logger log = LoggerFactory.getLogger(WhitelistSaveBatch.class);
/**
 * 批量新增白名单
 * @throws IOException
 */
@Test
public void testWhitelistSaveBatch() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId=super.appId;
    String appSecret=super.appSecret;
    String userId = super.userId;
    String timestamp=String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "https://api.polyv.net/meet/v1/channel/auth-whitelist/save-batch";
    String channelId = "2191532";
    String body = "{\n" +
        "  \"list\" : [{\n" +
        "    \"code\": \"code1\",\n" +
        "    \"name\": \"name1\",\n" +
        "    \"groupNo\": 1,\n" +
        "    \"groupRole\": \"leader\"\n" +
        "  }, {\n" +
        "\n" +
        "    \"code\": \"code2\",\n" +
        "    \"name\": \"name2\"\n" +
        "  }, {\n" +
        "\n" +
        "    \"code\": \"code3\",\n" +
        "    \"name\": \"name3\",\n" +
        "    \"groupNo\": 2,\n" +
        "    \"groupRole\": \"member\"\n" +
        "  }]\n" +
        "}";

    //http 调用逻辑
    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));
    url = HttpUtil.appendUrl(url, requestMap);
    String response = HttpUtil.postJsonBody(url, body, null);
    log.info("测试批量新增白名单接口返回值:{}",response);
    //do somethings

}

Response Example

For global error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": true
}

Error Example

{
  "code": 400,
  "status": "error",
  "error": {
    "code": 10003,
    "desc": "时间戳过期"
  },
  "success": false
}
{
  "code": 403,
  "status": "error",
  "error": {
    "code": 10002,
    "desc": "签名错误"
  },
  "success": false
}
{
  "code": 400,
  "status": "error",
  "requestId": "991b5a56d10b475d8ac973e8a2b11a5f.62.16655589121330147",
  "error": {
    "code": 50206,
    "desc": "批量插入白名单失败,信息有误"
  },
  "data": {
    "infoIncorrectCodeList": [
      "code3"
    ],
    "duplicateCodeList": [
      "code3",
      "code2",
      "code1"
    ],
    "duplicateLeaderGroupNoList": [
      1
    ],
    "correct": false
  },
  "success": false
}
{
  "code": 400,
  "status": "error",
  "requestId": "f02d8d1c81b94bf3b761efb9b9bc1fd2.58.16577892258410007",
  "error": {
    "code": 50205,
    "desc": "白名单数量超过限制,最多10000条数据"
  },
  "data": {
    "infoIncorrectCodeList": [],
    "duplicateCodeList": [],
    "duplicateLeaderGroupNoList": [],
    "correct": false
  },
  "success": false
}
联系客服,在线咨询
在线咨询