http://api.polyv.net/live/v4/channel/status-valid
http://api.polyv.net/live/v4/channel/status-valid?channels=1965681%2C2272665%2C3297504&appId=frlr1zazn3&sign=F8BDEF93ED3CD6EDEEFB399187D97582×tamp=1662083490979
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(GroupTestLive.class);
/**
* 频道状态验证
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetChannelStatusValid() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/status-valid";
String channels = "1965681,2272665,3297504";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channels", channels);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试频道状态验证,返回值:{}", response);
//do somethings
}
{
"code": 200,
"status": "success",
"requestId": "522451e702a4454dbb1a972abd4d4b71.62.16618407903140831",
"data": {
"channels": [
{
"channelId": 1965681,
"delete": 0,
"currentUser": 1
},
{
"channelId": 2272665,
"delete": 1,
"currentUser": 0
},
{
"channelId": 3297504,
"delete": 1,
"currentUser": 1
}
]
},
"success": true
}
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}