Polyv Help Center

Help Center

Modify Channel Viewing Conditions

Updated: 2025-05-27 11:08:57

API Description

1、修改频道或通用设置的观看条件(旧版直播后台-通用设置-观看条件)
2、主要观看条件为关闭时,次要观看条件不能为打开,否则返回参数错误
3、主要观看条件和次要观看条件为相同时,不能够同时打开,否则返回参数错误
4、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
5、接口支持https协议

API URL

http://api.polyv.net/live/v3/channel/auth/update

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 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 not be stored or used directly on the client side. All APIs must be called from 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, the general setting is used.

Request Body Parameter Description

Parameter Required Type Description
authSettings true Array Viewing condition settings See authSettings Field Description

authSettings Field 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: Disable
Y: Enable
authType false String pay: Paid viewing
code: Verification code viewing
phone: Whitelist viewing Note: Confirm if the whitelist for the corresponding rank exists. If not, call Add Single Whitelist to Channel first to add, then set the viewing condition.
info: Registration viewing
custom: Custom authorization viewing
external: External authorization viewing
direct: Independent authorization viewing
public: Public viewing
wx: WeChat authorization viewing
wxAuthExpireValue false String When authType is wx, the corresponding WeChat authorization value. Supports units d and h, e.g., 3d for 3 days, 3h for 3 hours.
payAuthTips false String When authType is pay, this parameter is required. Welcome message title.
payEntryText false String When authType is pay, the entry text.
price false Float When authType is pay, this parameter is required. Price, in CNY.
watchEndTime false String When authType is pay, this parameter is optional. Paid validity end date, format: yyyy-MM-dd HH:mm.
validTimePeriod false Integer When authType is pay, this parameter is optional. Paid validity duration, in days. If both watchEndTime and validTimePeriod are empty, the payment is valid permanently.
authCode false String When authType is code, this parameter is required. Verification code.
qcodeTips false String When authType is code, this parameter is optional. Prompt text.
qcodeImg false String When authType is code, this parameter is optional. Official account QR code URL.
authTips false String When authType is phone, this parameter is optional. Prompt text.
infoFields false Array When authType is info, this parameter is required. Registration viewing information, maximum 5 items. See infoFields Field Description
infoAuthTips false String When authType is info, this parameter is optional. Welcome title.
infoDesc false String When authType is info, this parameter is optional. Prompt information.
infoEntryText false String When authType is info, this parameter is optional. Entry text.
externalKey false String When authType is external, this parameter is required. SecretKey.
externalUri false String When authType is external, this parameter is required. Custom URL.
externalRedirectUri false String When authType is external, this parameter is optional. Redirect URL.
externalEntryText false String When authType is external, the entry text.
externalButtonEnabled false String When authType is external, this parameter is optional. Login button. Y to enable, N to disable. When enabled, the guide page will display a login button when users access the link.
customKey false String When authType is custom, this parameter is required. SecretKey.
customUri false String When authType is custom, this parameter is required. Custom URL.
directKey false String When authType is direct, this parameter is required. Independent authorization SecretKey.
directKey false String When authType is direct, this parameter is required. Independent authorization SecretKey.
privacyStatus false String Y/N Privacy statement toggle.
privacyContent false String Privacy content, supports rich text.
onceWhitelistEnabled false String Whitelist not allowed for reuse, default is N. Y: Yes, N: No.
expectedArrivalEnabled false String Whitelist viewing attendance list toggle, Y-ON, N-OFF, default is N.
inviteWatchAuditEnabled false String Invite viewing audit toggle, Y-ON, N-OFF, default is N.
codeAuthTips false String Password viewing condition prompt text.
codeEntryText false String Password viewing entry text.
whiteListInputTips false String Whitelist viewing input prompt.
whiteListEntryText false String Whitelist viewing entry text.
false String
false String

infoFields Field Description

Parameter Required Type Description
name false String When authType is info, this parameter is optional. Registration field name, maximum 20 characters.
type false String When authType is info, this parameter is required. Registration type.
name: Name
text: Text
mobile: Phone number
number: Number
option: Dropdown option
options false String When authType is info, this parameter is optional. For dropdown options, the option values separated by commas. Maximum 50 options; each option content maximum 30 characters.
placeholder false String When authType is info, this parameter is optional. Text box input prompt, maximum 50 characters.
sms false String When authType is info, this parameter is optional. SMS verification toggle, Y: Enable, N: Disable.

Example

http://api.polyv.net/live/v3/channel/auth/update?appId=frlr1zazn3&sign=E2B692768C6F467B1228B5876625B71E&channelId=2191532&timestamp=1621843761626

Request Body Parameters

{
    "authSettings": [{
        "rank": 1,
        "enabled": "Y",
        "authType": "pay",
        "payAuthTips": "给钱才能看",
        "price": "0.01",
        "watchEndTime": null,
        "validTimePeriod": null
    }, {
        "rank": 2,
        "enabled": "N"
    }]
}

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See Global Error Description
status String Response status text
message String Response description, provides error details when code is 400 or 500
data String true on success, empty on error

Java Request Example

For quick integration of the base code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source code project. The test cases HttpUtil.java and LiveSignUtil.java are included in the download 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 testSetWatchCondition() 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/update";
    String channelId = "2191532";
    String body = "{\"authSettings\":[{\"rank\":1,\"enabled\":\"N\"},{\"rank\":2,\"enabled\":\"N\"}]}";

    //http 调用逻辑
    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));
    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",
    "message": "",
    "data": true
}

Error Example

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