1、修改轮询监控开关
2、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
https://api.polyv.net/live/v4/seminar/monitor/updateSetting
https://api.polyv.net/live/v4/seminar/monitor/updateSetting?appId=fyirmfdak4×tamp=1657786379352&sign=CEA301164F9BA5076F156C1EB60F22F8&channelId=2191532
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(UpdateSettingPost.class);
/**
* 查询分组记录
* @throws IOException
*/
@Test
public void testUpdateSettingPost() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String url = "api.polyv.net/live/v4/seminar/monitor/updateSetting";
String channelId = "2191532";
String body = "{\n" +
" \"enable\":\"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
}
{
"code": 200,
"status": "success",
"requestId": "faeae397448d4c5f988b278256cbc487.60.16591497134900021",
"data": null,
"success": true
}
{
"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": "faeae397448d4c5f988b278256cbc487.66.16591497085220019",
"error": {
"code": 1081,
"desc": "没有监控轮询权限"
},
"data": null,
"success": false
}