1、更新单个分组记录
2、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
https://api.polyv.net/live/v4/seminar/group/plan/update
https://api.polyv.net/live/v4/seminar/group/plan/update?appId=fyirmfdak4×tamp=1657786379352&sign=CEA301164F9BA5076F156C1EB60F22F8&channelId=3220878
{
"oldViewerId" : "oldViewerId",
"viewerId" : "newViewerId",
"nickname" : "nickname",
"groupNo" : 1,
"groupRole" :"member"
}
private static final Logger log = LoggerFactory.getLogger(GroupPlanUpdate.class);
/**
* 删除单个分组记录
* @throws IOException
*/
@Test
public void testGroupPlanUpdate() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/live/v4/seminar/group/plan/update";
String channelId = "2191532";
String body = "{\n" +
" \"oldViewerId\" : \"oldViewerId\",\n" +
" \"viewerId\" : \"newViewerId\",\n" +
" \"nickname\" : \"nickname\",\n" +
" \"groupNo\" : 1,\n" +
" \"groupRole\" :\"member\"\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",
"message": "",
"data": 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": "0249c3cfda4b426ba567dcc18ef07531.63.16577880487180263",
"error": {
"code": 50012,
"desc": "更新分组记录失败,原记录不存在"
},
"data": null,
"success": false
}
{
"code": 400,
"status": "error",
"requestId": "0249c3cfda4b426ba567dcc18ef07531.66.16577882689270277",
"error": {
"code": 50013,
"desc": "更新分组记录失败,组内已有组长"
},
"data": null,
"success": false
}