当调用小程序创建直播间接口时 接口返回
{
"errmsg": "parameter shareImg must no be null rid: 6141c273-7ebc0b10-090f31f0",
"errcode": 200002
}
但是这个shareImg 参数已经是传入的
最终 发现 raw text和json有区别得 当改为raw json就可以了
使用 restTemplate进行接口调用时
正确操作姿势
String url = formatUrl(createRoomUrl); try { // 注意这里直接传入的createRoomReq 请求参数对象 而不是 //JSON.toJSONString(createRoomReq) ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, createRoomReq, String.class); log.info("创建直播间 responseEntity: " + JSON.toJSONString(responseEntity)); String result = responseEntity.getBody();
}catch (Exception e) {
log.error("创建直播间异常: {} ", e.getLocalizedMessage());
}