Query Channel Information
Old API endpoint Query Channel Info (Old Version)
Interface Description
1、查询频道基本信息,观看页状态与新版后台一致
2、接口支持https协议
API URL
http://api.polyv.net/live/v4/channel/basic/get
<a href="/req.html?api=http://api.polyv.net/live/v4/channel/basic/get"" target="_blank">Online API Call
Request Method
GET
Interface Constraints
- The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls are subject to frequency limits. For details, please refer to
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details: Obtain 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 stored 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 details: Signature Generation Rules |
| channelId | true | String | Channel ID |
Example
http://api.polyv.net/live/v4/channel/basic/get?appId=frlr1zazn3&sign=AE9DED64FDDC94A0B18DB29E2D9B7DFC&channelId=3151318×tamp=1654828588317
Response Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine the basic response status |
| status | String | Response result, determined by business logic; returns success on success, error on failure |
| success | Boolean | Whether the response is successful |
| requestId | String | Request ID, a unique UUID generated for each request, used only for troubleshooting and debugging, and should not be tied to business logic |
| error | Object | Error information when the status code is not 200 [See Error Field Description for details] |
| data | Object | [See data Field Description for details] |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to determine the specific cause of the error |
| desc | String | Error description, corresponding to error.code |
Description of the data field
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| name | String | Channel name |
| scene | String | Live streaming scene, not used in the new version of live streaming alone: Event live topclass: Large class ppt: Three-screen seminar: Seminar |
| newScene | String | New backend live streaming scene, defaults to scene if undefinedundefined: Undefined topclass: Large class double: Dual-teacher class (requires permission) train: Enterprise training seminar: Seminar alone: Event marketing smallclass: Small class |
| template | String | New backend live streaming template, undefined for legacy channels undefined: Undefined ppt: Three-screen (landscape) alone: Video only (landscape) topclass: Video only - Express (landscape) seminar: Seminar portrait_ppt: Three-screen (portrait) portrait_alone: Video only (portrait) |
| channelPasswd | String | Channel password |
| publisher | String | Host name |
| startTime | Long | Live start time set in the room (countdown appears after setting), 0 if not set or reset; 13-digit millisecond timestamp when set and effective. |
| endTime | Long | Live end time set in the room, 13-digit millisecond timestamp. |
| pureRtcEnabled | String | Channel ultra-low latency live streaming switch, Y: Enabled, N: Disabled |
| newSessionEnabled | String | Series live streaming switch, Y: Series live, N: Normal live |
| pageView | Integer | Cumulative page views |
| likes | Integer | Number of likes on the viewing page |
| coverImg | String | Channel icon |
| splashImg | String | Splash page image URL |
| splashEnabled | String | Splash page switch Y: Enabled N: Disabled |
| bgImg | String | Player cover image URL |
| desc | String | Live streaming description |
| consultingMenuEnabled | String | Consultation and Q&A switch Y: Enabled N: Disabled |
| maxViewerRestrict | String | Maximum online viewers restriction switch Y: Enabled N: Disabled |
| maxViewer | Integer | Maximum online viewers |
| watchUrl | String | Live viewing URL, e.g., https://xxx.live.polyv.cn/watch/xxxx |
| watchStatus | String | Viewing page status live: Live playback: Playback end: Ended waiting: Waiting unStart: Not started banpush: Banned |
| watchStatusText | String | Viewing page status description |
| userCategory | Object | Channel category information See userCategory field description |
| authSettings | Array | List of live viewing conditions See authSettings field description] |
| linkMicLimit | Integer | Channel co-streaming participant limit |
| createdAccountId | String | Creator account ID, returns the main account userId if created by the main account |
| createdAccountEmail | String | Creator account email |
| createdTime | Long | Creation time, 13-digit timestamp |
| labelData | Array | Array of label IDs See labelData field description] |
| clientAloneTemplateBackgroundUrl | String | Client template background image URL |
| liveCdnBackgroundUrl | String | Video mixing background image URL |
| pushUrl | String | Push stream URL (only available for video-only streams) |
| pushSecret | String | Push stream secret (only available for video-only streams) |
| streamType | String | Live streaming method. client: Using the broadcast client or third-party push (normal); disk: Pseudo-live; |
| type | String | Channel type, normal: Normal channel, transmit: Initiate relay, receive: Receive relay, transmit_package: Initiate relay + packaging, receive_package: Receive relay + packaging |
| smallClassSizeLimit | Integer | Small class size, values: 1, 6, 12 |
| isRecord | String | Small class recording switch, only valid when the live scene is small class, Y: Enabled, N: Disabled |
labelData Field Description
| Parameter | Type | Description |
|---|---|---|
| id | String | Label ID |
Description of the userCategory Field
| Parameter Name | Type | Description |
|---|---|---|
| categoryId | String | Category ID |
| categoryName | String | Category name |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| rank | Integer | Sorting value of the category |
Description of the authSettings Field
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| rank | Integer | Channel live streaming viewing condition; 1 for primary condition, 2 for secondary condition |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings) |
| globalSettingEnabled | String | Whether to enable global settings Y: Enabled N: Disabled |
| enabled | String | Whether to enable viewing conditions Y: Enabled N: Disabled |
| authType | String | Viewing condition type none: No restrictions code: Verification code viewing pay: Paid viewing phone: Whitelist viewing info: Registration viewing wxshare: Share viewing custom: Custom authorization viewing external: External authorization viewing direct: Independent authorization |
| authTips | String | Whitelist viewing prompt message |
| payAuthTips | String | Paid viewing prompt message |
| codeAuthTips | String | Verification code viewing condition prompt message |
| infoAuthTips | String | Registration viewing condition prompt message |
| authCode | String | Verification code for verification code viewing |
| qcodeTips | String | QR code prompt for verification code viewing |
| qcodeImg | String | QR code image for verification code viewing |
| price | Float | Price for paid viewing |
| watchEndTime | Long | Deadline for paid viewing, 13-digit millisecond timestamp; null indicates one-time payment with permanent validity |
| validTimePeriod | Integer | Duration for paid viewing validity, in days |
| customKey | String | Key for custom authorization viewing |
| customUri | String | Interface address for custom authorization viewing |
| externalKey | String | Key for external authorization viewing |
| externalUri | String | Interface address for external authorization viewing |
| externalRedirectUri | String | Redirect URL for external authorization viewing when users directly access the viewing page |
| directKey | String | Key for independent authorization |
| trialWatchEnabled | String | Trial watch toggle for paid viewing, disabled by default Y: Enabled N: Disabled |
| trialWatchTime | Integer | Trial watch duration, in minutes |
| trialWatchEndTime | Long | Trial watch deadline, 13-digit millisecond timestamp; null indicates permanent validity for the channel |
| whiteListInputTips | String | Whitelist input prompt |
| whiteListEntryText | String | Whitelist entry text |
| infoDesc | String | Registration viewing description field |
| customTeacherId | String | Custom teacher ID |
| expectedArrivalEnabled | String | Used when authType is phone; attendance list toggle, Y: Enabled, N: Disabled |
Java Request Example
Quick Integration Basic Code Please 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 HttpUtil.java and LiveSignUtil.java are both included in the downloaded file.
It is strongly recommended that you use the Live Java SDK to complete the 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(getClass());
/**
* 查询频道基本信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetChannelDetail() 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/basic/get";
String channelId = "3151318";
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));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道基本信息,返回值:{}", response);
//do somethings
}
Response Example
For a detailed explanation of system-wide errors, please refer to the Global Error Description.
Success Example
{
"code": 200,
"status": "success",
"requestId": "4a11f50ed079498bba8d8886b069c5fa.65.16548285928827809",
"data": {
"channelId": 3151318,
"name": "测试频道",
"scene": "ppt",
"newScene": "undefined",
"template": "undefined",
"channelPasswd": "8YiFH5",
"publisher": "主持人",
"startTime": 0,
"endTime": 1687414806000,
"newSessionEnabled": "Y",
"pageView": 1,
"likes": 0,
"coverImg": "//liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"splashImg": "",
"splashEnabled": "Y",
"desc": "",
"consultingMenuEnabled": "Y",
"maxViewerRestrict": "N",
"maxViewer": -1,
"watchUrl": "https://1b448be323.live.polyv.cn/watch/3151318",
"watchStatus": "unStart",
"watchStatusText": "未开始",
"userCategory": {
"categoryId": 391352,
"categoryName": "测试频道",
"userId": "1b448be323",
"rank": 3619
},
"authSettings": [
{
"channelId": 3151318,
"userId": "1b448be323",
"rank": 1,
"globalSettingEnabled": "N",
"enabled": "N",
"authType": "info",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": "",
"qcodeTips": "",
"qcodeImg": "",
"price": 0.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "ujpTIPloEw",
"customUri": "http://sadboy.cn/polyv.test?a=123&url=ijofdajodfsaoi",
"externalKey": "ujpTIPloEw",
"externalUri": "",
"externalRedirectUri": "",
"externalEntryText": "",
"directKey": "ujpTIPloEw",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": "请输入会员码-1605067278063",
"whiteListEntryText": "会员入口",
"infoDesc": ""
},
{
"channelId": 3151318,
"userId": "1b448be323",
"rank": 2,
"globalSettingEnabled": "N",
"enabled": "N",
"authType": "none",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": "",
"qcodeTips": "",
"qcodeImg": "",
"price": 0.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "ujpTIPloEw",
"customUri": "",
"externalKey": "ujpTIPloEw",
"externalUri": "",
"externalRedirectUri": "",
"externalEntryText": "",
"directKey": "ujpTIPloEw",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": "",
"whiteListEntryText": "会员入口",
"infoDesc": ""
}
],
"bgImg": null,
"onlyOutEnabled": "Y",
"linkMicLimit": 16,
"customTeacherId": "polyv001",
"createdAccountId": "1b448be323",
"createdAccountEmail": "sdk-demo@polyv.net",
"createdTime": 1603155366000,
"labelData":["zpmz3640wkxpj267"]
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"error": {
"code": 10003,
"desc": "时间戳过期"
},
"success": false
}
