1、批量修改频道云分发开关,该功能需要超管开通才生效
2、接口支持https协议
http://api.polyv.net/live/v4/channel/distribute/update-switch
http://api.polyv.net/live/v4/channel/distribute/update-switch?channelId=2272655&appId=frlr1zazn3×tamp=1639731118000&sign=DE519ADA34BECDD05CB4158C32975162&distributeEnabled=Y&distributeIds=2974
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 批量修改频道云分发开关
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testUpdateSwitch() throws IOException, NoSuchAlgorithmException {
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/distribute/update-switch";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", "2272655");
requestMap.put("distributeIds", "3146,3159");
requestMap.put("distributeEnabled", "Y");
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url,requestMap);
String response = HttpUtil.postFormBody(url,null);
log.info("测试批量修改频道云分发开关,返回值:{}", response);
}
{
"code": 200,
"status": "success",
"requestId": "192d744e4afe46f69fbbdc5919974664.65.16397312728026519",
"data": true,
"success": true
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}