private static final Logger log = LoggerFactory.getLogger(getClass());
/**
* 批量创建机器人虚拟昵称
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void robotSaveBatchTest() 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/global/robot/save-batch";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
List<Object> jsonList = new ArrayList<>();
Map<String, String> jsonMap = new HashMap<>();
jsonMap.put("name","虚拟昵称1");
jsonMap.put("avatar","https://liveimages.videocc.net/uploaded/images/2023/03/gj5fk2a06r.png");
jsonList.add(jsonMap);
jsonMap = new HashMap<>();
jsonMap.put("name","虚拟昵称2");
jsonList.add(jsonMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonList),null);
log.info("测试批量创建机器人虚拟昵称成功:{}", response);
//do somethings
}