Query Channel Whitelist
Updated: 2022-09-02 18:08:07
API Description
1、获取全局或频道的观看条件白名单列表
2、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/auth/get-white-list
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have frequency limits. Click for 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. The appSecret key used to generate the signature is critical for communication data security. It must never be saved 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 and obtain response data. See Signature Generation Rules |
| rank | true | Integer | 1 for primary condition, 2 for secondary condition |
| channelId | false | String | Channel ID. Leave empty to get global settings |
| page | false | Integer | Page number to retrieve, defaults to 1 |
| pageSize | false | Integer | Number of items per page, defaults to 10 |
| keyword | false | String | Keyword, can search by member code or name |
Example
https://api.polyv.net/live/v3/channel/auth/get-white-list?appId=frlr1zazn3&sign=5935F7E2423B2AF9E0E8FE59D54D5ACC&rank=1&channelId=1965681×tamp=1621843843501
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure See Global Error Description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides auxiliary error description |
| data | Object | Paginated whitelist data See data field description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| pageNumber | Integer | Current page number |
| totalPages | Integer | Total number of pages |
| pageSize | Integer | Number of items per page |
| contents | Array | Current page content See contents field description |
contents Field Description
| Parameter | Type | Description |
|---|---|---|
| name | String | Nickname (or remark) |
| phone | String | Member code |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download source code. After downloading, add it to your own source code project. The HttpUtil.java and LiveSignUtil.java in the test cases are included 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 pools.
private static final Logger log = LoggerFactory.getLogger(WatchConditionTest.class);
/**
* 查询频道白名单
* @throws IOException
*/
@Test
public void testGetWhiteList() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String channelId = "1965681";
String url = "https://api.polyv.net/live/v3/channel/auth/get-white-list";
String rank = "1";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId",channelId);
requestMap.put("rank",rank);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道白名单接口返回值:{}",response);
//do somethings
}
Response Example
For system-wide global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": {
"pageNumber": 1,
"totalPages": 1,
"pageSize": 10,
"contents": [{
"phone": "123rock",
"name": "rock"
}, {
"phone": "会员码123",
"name": "昵称123"
}, {
"phone": "a1",
"name": "sadboy1"
}, {
"phone": "a2",
"name": "sadboy2"
}, {
"phone": "a3",
"name": "sadboy3"
}, {
"phone": "a4",
"name": "sadboy4"
}, {
"phone": "a5",
"name": "sadboy5"
}, {
"phone": "a6",
"name": "sadboy6"
}, {
"phone": "a7",
"name": "sadboy7"
}]
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
