Update Whitelist
Updated: 2022-10-12 15:25:43
API Description
1、更新白名单
2、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
4、接口更新为局部更新,即不传的字段维持不变
API URL
https://api.polyv.net/meet/v1/channel/auth-whitelist/update
Request Method
POST
API Constraints
- API calls have a frequency limit. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See 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 See Signature Generation Rules |
| channelId | true | Integer | Channel ID |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| oldCode | true | String | Original whitelist record to update, max length 64 characters |
| code | true | String | New whitelist record, max length 64 characters |
| name | false | String | New nickname, max length 64 characters (leave empty to keep unchanged) |
| groupNo | false | Integer | New group number, between 1 and 50 (leave empty to keep unchanged) |
| groupRole | false | String | New role within the group (leave empty to keep unchanged) leader: Group leader member: Group member |
Example
https://api.polyv.net/meet/v1/channel/auth-whitelist/update?appId=fyirmfdak4×tamp=1657786379352&sign=CEA301164F9BA5076F156C1EB60F22F8&channelId=3220878
Request Body Parameters
{
"oldCode" : "oldCode",
"code" : "code",
"name" : "name",
"groupNo" : 1,
"groupRole" :"member"
}
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 request was successful |
| requestId | String | Request ID, a unique UUID generated for each request. Only for troubleshooting and debugging, should not be tied to business logic |
| error | Object | Error information when status code is not 200 See Error Field Description |
| data | String | Returns true on success, empty on error |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to determine the specific error cause |
| desc | String | Error description, corresponds to error.code |
Java Request Example
For quick integration of basic code, download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. HttpUtil.java and LiveSignUtil.java in the test cases are included in the download 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(WhitelistUpdate.class);
/**
* 更新白名单
* @throws IOException
*/
@Test
public void testWhitelistUpdate() 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/update";
String channelId = "2191532";
String body = "{\n" +
" \"oldCode\" : \"oldCode\",\n" +
" \"code\" : \"code\",\n" +
" \"name\" : \"name\",\n" +
" \"groupNo\" : 1,\n" +
" \"groupRole\" :\"member\"\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 system 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": "a7d7886f4a8c4938819b48c1b969ac04.66.16655445009590005",
"error": {
"code": 10001,
"desc": "原始会员码不能为空"
},
"data": null,
"success": false
}
{
"code": 400,
"status": "error",
"requestId": "a7d7886f4a8c4938819b48c1b969ac04.63.16655444886950005",
"error": {
"code": 10001,
"desc": "会员码不能为空"
},
"data": null,
"success": false
}
{
"code": 400,
"status": "error",
"requestId": "a7d7886f4a8c4938819b48c1b969ac04.57.16655448630610035",
"error": {
"code": 10001,
"desc": "会员码长度需要介于1和64之间"
},
"data": null,
"success": false
}
{
"code": 400,
"status": "error",
"requestId": "a7d7886f4a8c4938819b48c1b969ac04.59.16655445255610009",
"error": {
"code": 10001,
"desc": "昵称长度需要介于1和64之间"
},
"data": null,
"success": false
}
{
"code": 400,
"status": "error",
"requestId": "a7d7886f4a8c4938819b48c1b969ac04.58.16655455179100093",
"error": {
"code": 10001,
"desc": "组内身份不正确"
},
"data": null,
"success": false
}
{
"code": 400,
"status": "error",
"requestId": "a7d7886f4a8c4938819b48c1b969ac04.61.16655444651140003",
"error": {
"code": 50202,
"desc": "白名单不存在"
},
"data": null,
"success": false
}
{
"code": 400,
"status": "error",
"requestId": "a7d7886f4a8c4938819b48c1b969ac04.60.16655454803730087",
"error": {
"code": 50203,
"desc": "会员码已存在"
},
"data": null,
"success": false
}
{
"code": 400,
"status": "error",
"requestId": "a7d7886f4a8c4938819b48c1b969ac04.63.16655455046100091",
"error": {
"code": 50204,
"desc": "更新白名单失败,组内已有组长"
},
"data": null,
"success": false
}
