Polyv Help Center

Help Center

Query Channel Information

Updated: 2022-09-02 18:08:07

API Description

1、查询频道基本信息
2、接口支持https协议

API URL

http://api.polyv.net/live/v3/channel/basic/get-channel

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See 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 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
channelId true String Channel ID

Example

http://api.polyv.net/live/v3/channel/basic/get-channel?appId=frlr1zazn3&sign=4049473DAEBBEFF778DABD1A25E3409B&channelId=2779045&timestamp=1642732753732

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 Object Empty on failure, contains detailed channel settings on success See data field description

data Field Description

Parameter Type Description
channelId String Channel ID
name String Channel name
scene String Live streaming scenario. Not used for new version live streaming.
alone: Event live
topclass: Large class
ppt: Three-screen
seminar: Seminar
newScene String New backend live streaming scenario. Uses scene if undefined.
undefined: Undefined
topclass: Large class
double: Dual-teacher class (requires permission)
train: Enterprise training
seminar: Seminar
alone: Event marketing
template String New backend live streaming template. Undefined for older channels.
undefined: Undefined
ppt: Document + Video
alone: Pure video (Professional)
topclass: Pure video (Fast)
seminar: Seminar
portrait_ppt: Document + Video (Portrait)
portrait_alone: Video (Portrait)
channelPasswd String Channel password
publisher String Host name
startTime Long Scheduled live start time (displays countdown if set). 0 if not set or reset. 13-digit millisecond timestamp if set and active.
pageView Integer Cumulative page views
likes Integer Number of likes on the viewing page
coverImg String Player cover image URL
splashImg String Live room cover image URL
splashEnabled String Splash page toggle
Y: Enabled
N: Disabled
desc String Live stream description
consultingMenuEnabled String Consultation/Question toggle
Y: Enabled
N: Disabled
maxViewerRestrict String Maximum concurrent viewers restriction toggle
Y: Enabled
N: Disabled
maxViewer Integer Maximum concurrent viewers
watchStatus String Viewing page status
live: Live
playback: Playback
end: Ended
waiting: Waiting
unStart: Not started
watchStatusText String Viewing page status description
userCategory Object Channel category information See userCategory field description
authSettings Array List of viewing conditions See authSettings field description

userCategory Field Description

Parameter Type Description
categoryId String Category ID
categoryName String Category name
userId String POLYV user ID, same as on the Polyv official website. Path: Official website -> Login -> Live (Development Settings)
rank Integer Category sort order

authSettings Field Description

Parameter Type Description
channelId String Channel ID
rank Integer Channel live viewing condition. Primary condition is 1, secondary is 2.
userId String POLYV user ID, same as on the Polyv official website. Path: Official website -> Login -> Live (Development Settings)
globalSettingEnabled String Global settings toggle
Y: Enabled
N: Disabled
enabled String Viewing condition toggle
Y: Enabled
N: Disabled
authType String Viewing condition type
none: No restriction
code: Verification code
pay: Paid viewing
phone: Whitelist viewing
info: Registration viewing
wxshare: Share viewing
custom: Custom authorization
external: External authorization
direct: Independent authorization
authTips String Whitelist viewing prompt message
payAuthTips String Paid viewing prompt message
codeAuthTips String Verification code viewing prompt message
infoAuthTips String Registration viewing 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 Paid viewing expiration time, 13-digit millisecond timestamp. null means one-time payment, permanently valid.
validTimePeriod Integer Paid viewing duration in days
customKey String Key for custom authorization viewing
customUri String API endpoint for custom authorization viewing
externalKey String Key for external authorization viewing
externalUri String API endpoint for external authorization viewing
externalRedirectUri String Redirect URL for external authorization 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 expiration date, 13-digit millisecond timestamp. null means permanently valid for this channel.
whiteListInputTips String Whitelist input prompt
whiteListEntryText String Whitelist entry text
infoDesc String Registration viewing description field

Java Request Example

For quick integration of basic 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. 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(ChannelOperateTest.class);
/**
 * 查询频道基本信息
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetChannel() 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/get-channel";
    String channelId = "2779045";
    
    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

See Global Error Description for system-wide error descriptions.

Success Example

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "channelId": 2779045,
        "name": "测试",
        "scene": "alone",
        "newScene": "alone",
        "template": "portrait_alone",
        "channelPasswd": "6dMuVz",
        "publisher": "主持人",
        "startTime": 0,
        "pageView": 6,
        "likes": 0,
        "coverImg": "//liveimages.videocc.net/assets/wimages/pc_images/logo.png",
        "splashImg": "//liveimages.videocc.net/uploaded/images/2021/09/g2bta2pjbw.jpg",
        "splashEnabled": "Y",
        "desc": "",
        "consultingMenuEnabled": "Y",
        "maxViewerRestrict": "N",
        "maxViewer": -1,
        "watchStatus": "unStart",
        "watchStatusText": "未开始",
        "userCategory": {
            "categoryId": 340019,
            "categoryName": "默认分类",
            "userId": "1b448be323",
            "rank": 0
        },
        "authSettings": [
            {
                "channelId": 2779045,
                "rank": 1,
                "userId": "1b448be323",
                "globalSettingEnabled": "N",
                "enabled": "N",
                "authType": "external",
                "authTips": "欢迎观看本次直播",
                "payAuthTips": "欢迎观看本次直播",
                "codeAuthTips": "欢迎观看本次直播",
                "infoAuthTips": "欢迎观看本次直播",
                "authCode": "",
                "qcodeTips": null,
                "qcodeImg": null,
                "price": 0.01,
                "watchEndTime": null,
                "validTimePeriod": null,
                "customKey": "ujpTIPloEw",
                "customUri": "",
                "externalKey": "ujpTIPloEw",
                "externalUri": "http://www.polyv.net",
                "externalRedirectUri": "",
                "externalEntryText": "登录观看",
                "directKey": "ujpTIPloEw",
                "trialWatchEnabled": "N",
                "trialWatchTime": 1,
                "trialWatchEndTime": null,
                "whiteListInputTips": "请输入会员码-1605067278063",
                "whiteListEntryText": "会员入口",
                "infoDesc": ""
            },
            {
                "channelId": 2779045,
                "rank": 2,
                "userId": "1b448be323",
                "globalSettingEnabled": "N",
                "enabled": "N",
                "authType": "none",
                "authTips": "欢迎观看本次直播",
                "payAuthTips": "欢迎观看本次直播",
                "codeAuthTips": "欢迎观看本次直播",
                "infoAuthTips": "欢迎观看本次直播",
                "authCode": null,
                "qcodeTips": null,
                "qcodeImg": null,
                "price": 0,
                "watchEndTime": null,
                "validTimePeriod": null,
                "customKey": "ujpTIPloEw",
                "customUri": null,
                "externalKey": "ujpTIPloEw",
                "externalUri": null,
                "externalRedirectUri": null,
                "externalEntryText": "",
                "directKey": "ujpTIPloEw",
                "trialWatchEnabled": "N",
                "trialWatchTime": null,
                "trialWatchEndTime": null,
                "whiteListInputTips": null,
                "whiteListEntryText": "会员入口",
                "infoDesc": null
            }
        ],
        "bgImg": "",
        "creatorChildId": null,
        "creatorName": null,
        "onlyOutEnabled": "Y"
    }
}

Error Example

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