1、批量修改频道回放字幕
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
https://api.polyv.net/live/v4/channel/subtitle/update-batch
https://api.polyv.net/live/v4/channel/subtitle/update-batch?appId=frlr1zazn3&sign=4424EF1F6C767FC0E2FB4A912E566879×tamp=1653879013148&channelId=100033
[{
"name":"实时字幕-1",
"status":"publish",
"id": 1
},
{
"name":"实时字幕-2",
"status":"finish",
"id":2
}
]
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 批量修改频道回放字幕
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testBatchUpdateSubtitle() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
int channelId = 100033;
//业务参数
String url = "https://api.polyv.net/live/v4/channel/subtitle/update-batch";
//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 json = "[]";
String response = HttpUtil.postJsonBody(url, json, null);
//do somethings
}
{
"code": 200,
"status": "success",
"requestId": "14138a5004b1412fbe109f854fec0b52.59.16538790171742883",
"data": "",
"success": true
}
{
"code": 400,
"status": "error",
"requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}