Polyv Help Center

Help Center

Batch Modify Channel Playback Subtitles

Updated: 2023-11-10 15:55:59

API Description

1、批量修改频道回放字幕
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议

API URL

https://api.polyv.net/live/v4/channel/subtitle/update-batch

Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details: Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored on the client side for direct use. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See details: Signature Generation Rules
channelId true Integer Channel ID

Request Body Parameter Description

Parameter Required Type Description
body true Array Subtitle information list See details: body parameter field description

body Parameter Field Description

Parameter Required Type Description
id true Long Subtitle ID
name false String Subtitle name
status false String Subtitle status, publish - display, finish - hide

Example

https://api.polyv.net/live/v4/channel/subtitle/update-batch?appId=frlr1zazn3&sign=4424EF1F6C767FC0E2FB4A912E566879&timestamp=1653879013148&channelId=100033

Request body JSON parameters:

[{
  "name":"实时字幕-1",
  "status":"publish",
  "id": 1
},
  {
    "name":"实时字幕-2",
    "status":"finish",
    "id":2
  }
]

Response Parameter Description

Parameter Type Description
code Integer Status code, same as HTTP status code, used to determine basic response status
status String Response result, determined by business logic. Returns success on success, error on failure
success Boolean Whether the response was successful
requestId String Request ID, a unique UUID generated for each request. Only for troubleshooting and debugging, not for business logic
error Object Error information when status code is not 200 See details: Error field description
data Object Returned content

Error Parameter Description

Parameter Type Description
code Integer Error code, used to identify the specific error cause
desc String Error description, corresponding to error.code

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. The HttpUtil.java and LiveSignUtil.java in the test cases are included in the downloaded file.

It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

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
    
}

Response Example

For global system error descriptions, see Global Error Description

Success example (test example channel ID is hidden)

{
    "code": 200,
    "status": "success",
    "requestId": "14138a5004b1412fbe109f854fec0b52.59.16538790171742883",
    "data": "",
    "success": true
}

Error example

{
    "code": 400,
    "status": "error",
    "requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
    "error": {
        "code": 20001,
        "desc": "application not found."
    },
    "success": false
}
联系客服,在线咨询