Modify Channel Live Template
Updated: 2025-09-16 16:19:59
API Description
1、修改频道直播模板信息
2、接口支持https协议
API URL
https://api.polyv.net/live/v4/channel/update-template
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have frequency limits. See details
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See 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 never be saved or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules |
| channelId | true | String | Channel ID |
| template | true | String | Channel live template. Refer to "Channel Live Template Values" for details. |
Channel Live Template Values
| Value | Description |
|---|---|
| alone | Video only + Landscape mode |
| ppt | Document + Video (triple split) + Landscape mode |
| portrait_alone | Video only + Portrait mode |
| portrait_ppt | Document + Video (triple split) + Portrait mode |
| topclass | Video only - Express (formerly large class) + Landscape mode |
| portrait_topclass | Video only - Express (formerly large class) + Portrait mode |
Example
http://api.polyv.net/live/v4/channel/update-template?appId=frlr1zazn3&sign=417802BACAD3375E72CA1A53848E0A53&channelId=2824409×tamp=1648779734640&template=alone
Response Parameters
| 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 request was successful |
| requestId | String | Request ID, a unique UUID generated for each request. Only used for troubleshooting and debugging, not for business logic |
| error | Object | Error information when status code is not 200 See Error Field Description |
| data | Object |
Java Request Example
For quick integration, download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java 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 pooling.
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 修改频道直播模板信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void updateTemplate() 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/channel/update-template";
String channelId = "2824409";
String template = "alone";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("template", template);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.post(url,requestMap);
log.info("测试修改频道直播模板成功:{}", response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "0a57e87d-e2a8-4786-bf1e-1bcfbc96a3e5",
"data": null,
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "66b7b98c-670b-4b50-9b8e-a3b4152e3635",
"error": {
"code": 30029,
"desc": "非法直播模板"
},
"data": null,
"success": false
}
