Query Channel Viewing Conditions
Updated: 2025-05-27 11:08:57
API Description
1、查询频道观看条件
2、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/auth/get
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for 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 within 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 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 | false | String | Channel ID. If not provided, queries globally. |
Example
http://api.polyv.net/live/v3/channel/auth/get?appId=frlr1zazn3&sign=8661982EB3646269F9824A6ACCACE25C×tamp=1621843737789
Response Parameters
| 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 | Array | Data content on success, empty string on error. [See data field description] |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| userId | String | User ID |
| rank | Integer | Used to set two viewing conditions for a channel. Value is 1 or 2 (1 for primary, 2 for secondary). |
| globalSettingEnabled | String | Whether global settings are enabled (only valid for legacy admin panel). Y: Enabled N: Disabled |
| enabled | String | Whether the viewing condition is enabled. Y: Enabled N: Disabled The viewing condition only takes effect when the switch is on. If the primary condition is disabled, the secondary condition is also ineffective. |
| authType | String | Viewing condition type. none: No restriction code: Password viewing pay: Paid viewing phone: Whitelist viewing info: Registration viewing wxshare: WeChat share viewing custom: Custom authorization viewing external: External authorization viewing direct: Independent authorization |
| subAuthType | String | Corresponding value when authType is none. public- public viewing, wx- WeChat authorization. |
| wxAuthExpireValue | String | When subAuthType is wx, the corresponding WeChat authorization validity period. e.g., 3d means 3 days, 3h means 3 hours. |
| codeAuthTips | String | Password viewing condition prompt. |
| authCode | String | Verification code for password viewing. |
| codeEntryText | String | Password viewing entry text. |
| qcodeTips | String | QR code prompt for password viewing. |
| qcodeImg | String | QR code image for password viewing. |
| payAuthTips | String | Paid viewing prompt. |
| price | Float | Price for paid viewing, in CNY. |
| watchEndTime | Long | Paid viewing deadline. null means one-time payment, valid forever. |
| validTimePeriod | Integer | Paid viewing validity period (days). |
| customKey | String | Custom authorization viewing key. |
| customUri | String | Custom authorization viewing API URL. |
| customEntryText | String | Custom authorization entry text. |
| externalKey | String | External authorization viewing key. |
| externalUri | String | External authorization viewing API URL. |
| externalRedirectUri | String | External authorization viewing redirect URL when users directly access the watch page. |
| externalEntryText | String | External authorization viewing entry text. |
| externalButtonEnabled | String | External authorization viewing login button. Y for enabled, N for disabled. When enabled, the guide page will display a login button when users access the link. |
| directKey | String | Independent authorization key. |
| trialWatchEnabled | String | Trial watch switch for paid viewing. Default is N. Y: On N: Off |
| trialWatchTime | Integer | Trial watch duration, in minutes. |
| trialWatchEndTime | Long | Trial watch deadline. null means permanently valid for the channel. |
| payEntryText | String | Paid viewing entry text. |
| whiteListInputTips | String | Whitelist viewing input prompt. |
| whiteListEntryText | String | Whitelist viewing entry text. |
| expectedArrivalEnabled | String | Whitelist viewing attendance list switch. Y- On, N- Off, default N. |
| onceWhitelistEnabled | String | Whitelist viewing does not allow reuse. Default N, Y: Yes, N: No. |
| authTips | String | Whitelist viewing prompt. |
| privacyStatus | String | Whether privacy statement is enabled. Y- On, N- Off, default N. |
| privacyContent | String | Privacy statement content. |
| infoDesc | String | Registration viewing description field. |
| infoAuthTips | String | Registration viewing condition prompt. |
| infoFields | InfoFields | Registration viewing field information. [See InfoFields field description], max 5 fields. |
| infoEntryText | String | Registration viewing entry text. |
| inviteWatchAuditEnabled | String | Invitation watch audit switch. Y- On, N- Off, default N. |
InfoFields Field Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | true | String | Information type: text- text, number- number, option- dropdown, name- name, mobile- phone number. |
| name | true | String | Information title, max length 20. |
| options | false | String | Dropdown options, separated by commas. Max 50 options, each option max length 30. Required when type is option. |
| placeholder | false | String | Information description, max length 50. |
| sms | false | String | SMS verification switch: Y- On, N- Off, default N. |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click to download source code. Add it to your own project after downloading. 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 pools.
private static final Logger log = LoggerFactory.getLogger(WatchConditionTest.class);
/**
* 查询频道观看条件
* @throws IOException
*/
@Test
public void testGetWatchCondition() 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/auth/get";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道观看条件接口返回值:{}",response);
//do somethings
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": [{
"channelId": 2191532,
"rank": 1,
"userId": "1b448be323",
"globalSettingEnabled": "N",
"enabled": "Y",
"authType": "custom",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 0.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "6mu6166v4l",
"customUri": "http://mywebsite.com/myDefinedUrl.php",
"externalKey": "w5885oc72o",
"externalUri": "http://mywebsite.com/myDefinedUrl.php",
"externalRedirectUri": null,
"externalButtonEnabled": "N",
"directKey": "te1d5z8cvv",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": null,
"whiteListEntryText": "会员入口",
"infoDesc": null
}, {
"channelId": 2191532,
"rank": 2,
"userId": "1b448be323",
"globalSettingEnabled": "N",
"enabled": "N",
"authType": "none",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": null,
"qcodeTips": null,
"qcodeImg": null,
"price": 0.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "6mu6166v4l",
"customUri": null,
"externalKey": "w5885oc72o",
"externalUri": null,
"externalRedirectUri": null,
"externalButtonEnabled": "N",
"directKey": "te1d5z8cvv",
"trialWatchEnabled": "N",
"trialWatchTime": null,
"trialWatchEndTime": null,
"whiteListInputTips": null,
"whiteListEntryText": "会员入口",
"infoDesc": null
}]
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
