private final Logger log = LoggerFactory.getLogger(getClass());
/**
* 新增主播
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void createChannelAnchorTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/live/v4/channel/anchor/create";
String nickname = "1号主播";
String sex = "w";
String avatar = "https://liveimages.videocc.net/uploaded/images/2024/04/gvh9eybcbb.png";
String description = "主播简介,我是一名大主播";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("nickname", nickname);
jsonMap.put("sex", sex);
jsonMap.put("avatar", avatar);
jsonMap.put("description", description);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试新建主播结果:{}", response);
//do somethings
}