Create Seminar Channel (New Backend)
Legacy API endpoint Create Single Channel (Legacy)
Notes on Upgrading from Legacy to New API
- The legacy API allowed setting channel basic info and viewing conditions for external seminars directly when creating a channel.
- The new API only allows setting channel basic info when creating a channel. Viewing conditions are sourced from the default template settings. The default template must be configured before creating a channel.
- Modifications to the default template do not affect already created channels. Modifying existing channel info is consistent with the legacy API.
API Description
1、根据直播默认模板创建频道
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
API URL
http://api.polyv.net/live/v4/channel/create
Request Method
POST
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have rate limits. See details
In a seminar scenario, the host password and attendee password cannot be the same.
Request Parameter Description
| 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 used to generate the signature is critical for communication data security. It must not be stored or used directly on the client. 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 |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | true | String | Live stream name, max length 100 |
| newScene | true | String | Live stream scene (seminar - seminar) |
| seminarHostPassword | false | String | Seminar host password, only valid when the live scene is seminar. Length 6-16 characters. If not provided, it will be randomly generated by the system. The host password and attendee password cannot be the same. |
| seminarAttendeePassword | false | String | Seminar attendee password, only valid when the live scene is seminar. Length 6-16 characters. If not provided, it will be randomly generated by the system. The host password and attendee password cannot be the same. |
| recordMode | false | String | Recording mode, only valid when the live scene is seminar. auto - automatic recording (default); manual - manual recording |
| seminarLiveType | false | String | Meeting type, only valid when the live scene is seminar. private - internal seminar (default); public - external live stream |
| splashImg | false | String | Cover image URL. Images not on a Polyv domain need to be uploaded via Upload All Channel Decoration Image Materials |
| categoryId | false | Integer | Category ID, can be obtained via the "Query Live Categories" API |
| startTime | false | Long | Start time, timestamp, e.g., 1629734400000 |
| subAccount | false | String | Sub-account email. If provided, the channel will be created under this sub-account (the sub-account cannot be deleted or disabled). Currently cannot be obtained via API. |
| linkMicLimit | false | Integer | Number of participants 1-47: represents the number of participants |
Example
http://api.polyv.net/live/v4/channel/create?appId=frlr1zazn3&sign=E3F501CFEF5FCCF2DF9BFDCE9C91F48C×tamp=1629445373947
Request body JSON parameters:
{
"name": "polyv研讨会",
"newScene": "seminar",
"recordMode": "auto",
"seminarLiveType": "private",
"seminarHostPassword": "hostpasswd",
"seminarAttendeePassword": "attendeepasswd"
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine the basic response status |
| status | String | Response result, determined by the business. 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, should not be tied to business logic |
| data | Object | Channel response object See data field description |
| error | Object | Error information See data field description |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| channelId | Integer | Channel ID |
| userId | String | POLYV user ID, consistent with the Polyv official website. Path: Official Website -> Login -> Live Stream (Development Settings) |
| channelPasswd | String | Instructor login password. Not null when the live scene is not a seminar. Length 6-16 characters |
| seminarHostPassword | String | Seminar host password. Not null only when the live scene is a seminar. Length 6-16 characters |
| seminarAttendeePassword | String | Seminar attendee password. Not null only when the live scene is a seminar. Length 6-16 characters |
Java Request Example
For quick integration of the base 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. 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.
/**
* 创建研讨会频道
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testBasicCreateV4() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/create";
String name = "polyv研讨会";
String newScene = "seminar";
String recordMode = "auto";
String seminarLiveType = "private";
String seminarHostPassword = "hostpasswd";
String seminarAttendeePassword = "attendeepasswd";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
Map<String, String> bodyMap = new HashMap<>();
bodyMap.put("name", name);
bodyMap.put("newScene", newScene);
bodyMap.put("recordMode", recordMode);
bodyMap.put("seminarLiveType", seminarLiveType);
bodyMap.put("seminarHostPassword", seminarHostPassword);
bodyMap.put("seminarAttendeePassword", seminarAttendeePassword);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String body = JSON.toJSONString(bodyMap);
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url,body,null);
log.info("测试创建研讨会频道,返回值:{}", response);
//do somethings
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "788bc586bbe34965a15a284c511116df.66.16414529932010715",
"data": {
"channelId": 2771673,
"userId": "1b448be323",
"scene": null,
"channelPasswd": null,
"seminarHostPassword": "hostpasswd",
"seminarAttendeePassword": "attendeepasswd"
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
