Polyv Help Center

Help Center

Create Seminar Channel (Legacy Admin Panel)

Updated: 2024-12-16 19:20:19

API Description

1、创建频道并进行相关设置
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议

API URL

http://api.polyv.net/live/v3/channel/basic/create

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 on obtaining keys
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 used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server for response data. See signature generation rules

Request Body Parameter Description

Parameter Required Type Description
basicSetting true Object Basic settings See basicSetting field description
authSettings false Array Viewing condition settings See authSettings field description
basicSetting Parameter Description
Parameter Required Type Description
name true String Channel name
channelPasswd true String Channel password (can be used with channel ID to log in). Max 16 characters, must contain both letters and numbers.
scene false String Live streaming scenario
seminar: Seminar
categoryId false Integer Category ID for the new channel. If not provided, the default category is used. (Category ID can be obtained via the "Query Live Categories" API)
coverImg false String Cover image URL
likes false Long Number of likes
pageView false Long Cumulative views
subAccount false String Sub-account email. If provided, the channel is created under this sub-account (the sub-account cannot be deleted or disabled). Currently cannot be retrieved via API.
authSettings Parameter Description
Parameter Required Type Description
rank true Integer Primary viewing condition is 1, secondary viewing condition is 2
enabled true String Enable conditional viewing
N: Disabled
Y: Enabled
authType false String pay: Paid viewing
code: Verification code viewing
info: Registration viewing
custom: Custom authorization viewing
external: External authorization viewing
direct: Independent authorization viewing
payAuthTips false String Required when authType is pay. Welcome message title
price false Float Required when authType is pay. Price in yuan
watchEndTime false String Optional when authType is pay. Paid validity end date, format: yyyy-MM-dd HH:mm
validTimePeriod false Integer Optional when authType is pay. Paid validity duration in days. If both watchEndTime and validTimePeriod are empty, payment is valid indefinitely.
authCode false String Required when authType is code. Verification code
qcodeTips false String Optional when authType is code. Prompt text
qcodeImg false String Optional when authType is code. Official account QR code URL
infoFields false Array Required when authType is info. Registration viewing information, max 5 items See infoFields field description
externalKey false String Required when authType is external. SecretKey
externalUri false String Required when authType is external. Custom URL
externalRedirectUri false String Optional when authType is external. Redirect URL
customKey false String Required when authType is custom. SecretKey
customUri false String Required when authType is custom. Custom URL
directKey false String Required when authType is direct. Independent authorization SecretKey

Example

http://api.polyv.net/live/v3/channel/basic/create?appId=frlr1zazn3&sign=A4433D6B4C9E5F34415EBACA2F206DDE&timestamp=1636706861620

Request body JSON parameters:

{
    "basicSetting": {
        "name": "创建研讨会频道",
        "channelPasswd": "polyv123"
    },
    "authSettings": [
        {
            "watchEndTime": 1616753886000,
            "rank": 1,
            "enabled": "Y",
            "authType": "external",
            "externalKey": "L0EjokKI4O",
            "externalUri": "http://demo.ipolyv.cn/chenwb/live-validate.php"
        }
    ]
}

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure See global error description
status String Response status text
message String Response description. When code is 400 or 500, provides additional error details.
data Object Channel details on successful response See data field description
Data Parameter Description
Parameter Type Description
channelId String Live channel ID
userId String POLYV user ID, same as on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings)
name String Live channel name
publisher String Host
description String Live channel description
scene String Live streaming scenario
seminar: Seminar
channelPasswd String Channel password
currentTimeMillis Long Current timestamp (milliseconds)

Java Request Example

For quick integration, please download the relevant dependency source code. Click here to download the source code. Add it to your project after downloading. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.

We strongly recommend using the Live Java SDK for API integration. The Live Java SDK provides unified packaging 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 testBasicCreate() 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/v3/channel/basic/create";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    url = HttpUtil.appendUrl(url, requestMap);
    String json = "{\"basicSetting\":{\"name\":\"创建研讨会频道\",\"channelPasswd\":\"polyv123\"}," +
    "\"authSettings\":[{\"watchEndTime\":1616753886000,\"rank\":1,\"enabled\":\"Y\"," +
    "\"authType\":\"external\",\"externalKey\":\"L0EjokKI4O\",\"externalUri\":\"http://demo.polyv" +
    ".net/chenwb/live-validate.php\"}]}";
    String response = HttpUtil.postJsonBody(url, json, null);
    log.info("测试创建单个频道,返回值:{}", response);
    //do somethings
    
}

Response Example

See Global Error Description for system-wide error details.

Success Example

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "channelId": 2671450,
        "userId": "1b448be323",
        "name": "创建研讨会频道",
        "channelPasswd": "polyv123",
        "scene": "seminar",
        "currentTimeMillis": 1636706867876
    }
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询