文章目录
接口URL
http://api.polyv.net/live/v3/channel/basic/get
接口说明
(接口调用有频率限制,详细请查看)
1、接口用于查询频道基本信息
2、接口支持https
返回结果支持格式
JSON
请求方式
GET
请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | long | 13位当前时间戳 |
sign | 是 | string | 签名值 |
channelId | 是 | int | 频道号 |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"channelId": 108888,
"name": "test111",
"channelPasswd": "1234",
"publisher": "主持人",
"startTime": 0,
"pageView": 111,
"likes": 66,
"coverImg": "//livestatic.videocc.net/uploaded/images/2019/05/fcowsdnzx8.png",
"splashImg": "//livestatic.videocc.net/uploaded/images/2019/05/fcowsdrak0.png",
"splashEnabled": "Y",
"desc": "你好,这个是直播介绍11111",
"consultingMenuEnabled": "N",
"maxViewerRestrict": "N",
"maxViewer": 123,
"watchStatus": "playback",
"watchStatusText": "回放中",
"userCategory": {
"categoryId": 155224,
"categoryName": "新建分类测试",
"userId": "edvf2fpec9",
"rank": 3
},
"authSettings": [
{
"channelId": 108888,
"rank": 1,
"userId": "edvf2fpec9",
"globalSettingEnabled": "N",
"enabled": "Y",
"authType": "code",
"authTips": "欢迎观看本直播",
"payAuthTips": "欢迎观看本次直播",
"codeAuthTips": "欢迎观看本次直播",
"infoAuthTips": "欢迎观看本次直播",
"authCode": "1",
"qcodeTips": "扫码关注XXX,获得观看码扫码关注XXX",
"qcodeImg": "",
"price": 999999.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "c130221c6b",
"customUri": null,
"externalKey": "94c7e79aff",
"externalUri": null,
"externalRedirectUri": null,
"directKey": null,
"trialWatchEnabled": "Y",
"trialWatchTime": 1,
"trialWatchEndTime": null
},
{
"channelId": 108888,
"rank": 2,
"userId": "edvf2fpec9",
"globalSettingEnabled": "N",
"enabled": "Y",
"authType": "pay",
"authTips": "欢迎观看本次直播",
"payAuthTips": "欢迎观看本直播",
"codeAuthTips": "验证码是1",
"infoAuthTips": null,
"authCode": "1",
"qcodeTips": "",
"qcodeImg": "",
"price": 1.00,
"watchEndTime": null,
"validTimePeriod": null,
"customKey": "17040194f4",
"customUri": null,
"externalKey": "693d8a540c",
"externalUri": null,
"externalRedirectUri": null,
"directKey": null,
"trialWatchEnabled": "N",
"trialWatchTime": 1,
"trialWatchEndTime": null
}
]
}
}
响应字段说明
参数名 | 类型 | 说明 |
---|---|---|
code | int | 状态状态码,请求成功时为200 |
status | string | 状态值 |
message | string | 请求失败时返回的错误值 |
data | ChannelDetailSettingModel | 请求失败时为空,请求成功时为频道的详细设置信息 |
ChannelDetailSettingModel字段说明
参数名 | 类型 | 说明 |
---|---|---|
channelId | int | 频道号 |
name | string | 频道名称 |
channelPasswd | string | 频道密码 |
publisher | string | 主持人名称 |
startTime | long | 直播开始时间,关闭时为0,开启时为13位毫秒级时间戳 |
pageView | int | 页面累计观看数 |
likes | int | 观看页点赞数 |
coverImg | string | 频道图标url |
splashImg | string | 频道引导图url |
splashEnabled | string(取值为Y/N) | 引导页开关 |
desc | string | 直播介绍 |
consultingMenuEnabled | string(取值为Y/N) | 咨询提问开关 |
maxViewerRestrict | string(取值为Y/N) | 限制最大在线观看人数开关 |
maxViewer | int | 最大在线观看人数 |
watchStatus | string | 频道的观看页状态,取值为: 频道状态,取值:live(直播中)、end(直播结束)、playback(回放中)、waiting(等待直播) |
watchStatusText | string | 观看页状态描述,直播中,回放中,已结束,未开始 |
userCategory | object | 频道所属分类的信息 |
userCategory.categoryId | int | 分类ID |
userCategory.categoryName | string | 分类名称 |
userCategory.rank | int | 分类的排序值 |
authSettings | List | 直播观看条件列表 |
关于ChannelAuthSetting 的参数说明请参考该接口的成功返回结果:查询直播频道观看条件
响应失败JSON示例:
参数错误
{
"code": 400,
"status": "error",
"message": "param validate error",
"data": 400
}
未输入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正确
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
时间戳错误
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
php请求示例
<?php
//引用config.php
include 'config.php';
$channelId="183950";
$params = array(
'appId' => $appId,
'channelId' => $channelId,
'timestamp' => $timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$url = "http://api.polyv.net/live/v3/channel/basic/get?appId=".$appId."&channelId=".$channelId."×tamp=".$timestamp."&sign=".$sign;
echo file_get_contents($url);
?>