分页查询用户下所有频道接口
接口URL
http://api.polyv.net/live/v3/channel/management/query-list
接口说明
1、作用:分页获取用户下所有频道信息
2、接口支持https协议
支持格式
JSON
请求方式
GET
请求参数
appId
是
string
从API设置中获取,在直播系统登记的appId
timestamp
是
string
当前13位毫秒级时间戳,3分钟内有效
page
是
string
页数
pageSize
否
string
每页显示的数据条数,默认每页显示1000条数据
startDate
否
string
创建日期查询开始日期,格式:yyyy-MM-dd
endDate
否
string
创建日志查询结束日期,格式:yyyy-MM-dd
categoryId
否
int
分类目录ID
channelIds
否
string
频道ID,多个频道ID 用英文逗号,隔开
channelName
否
string
频道名称
status
否
string
频道状态,取值:live(直播中)、end(直播结束)、playback(回放中)、waiting(等待直播)
sign
是
String
签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据
【详见签名生成规则】
liveTimeStart
否
long
按照直播开始时间查询的开始时间戳
liveTimeEnd
否
long
按照直播开始时间查询的结束时间戳
listOrderBy
否
string
列表排序分类规则:createTime 频道创建日期(默认) ,startTime-desc 直播时间降序 startTime-asc 直播时间升序
watchInfoEnabled
否
string
是否输出频道对应的点赞数和观看页pv数,Y表示需要,N表示不需要,默认不需要
响应成功JSON示例:
{
code: 200,
status: "success",
message: "",
data: {
pageSize: 5,
pageNumber: 1,
totalItems: 67,
contents: [
{
channelId: 306336,
name: "测试弹幕转存",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1554266407000,
appId:"dddd",
coverImage:null
},
{
channelId: 302478,
name: "云课堂的推流测试",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1553582996000,
appId:"dddd",
coverImage:null,
"startTime": null,
"teacherName": "讲师名称",
"teacherActor": "讲师昵称"
},
{
channelId: 302232,
name: "直播助手推流测试",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1553563146000,
appId:"dddd",
coverImage:null,
"startTime": null,
"teacherName": "讲师名称",
"teacherActor": "讲师昵称"
},
{
channelId: 290822,
name: "电动蝶阀",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1551456110000,
appId:"dddd",
coverImage:null,
"startTime": null,
"teacherName": "讲师名称",
"teacherActor": "讲师昵称"
},
{
channelId: 289542,
name: "fdfdf",
channelPasswd: "123",
status: "end",
statusDiscription: "暂无直播",
createdTime: 1551366959000,
appId:"dddd",
coverImage:null,
"startTime": 1552366959000,
"teacherName": "讲师名称",
"teacherActor": "讲师昵称"
}
],
startRow: 1,
firstPage: true,
lastPage: false,
nextPageNumber: 2,
prePageNumber: 1,
limit: 5,
endRow: 5,
totalPages: 14,
offset: 0
}
}
响应失败JSON示例:
未输入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": ""
}
字段说明
code
响应的状态码,例如:200
status
响应状态
message
异常错误信息
data
响应结果集
pageNumber
当前的页数
totalItems
总的条数
contents
查询的结果列表
channelId
频道ID
name
频道名称
status
频道状态,取值:live(直播中)、end(直播结束)、playback(回放中)、waiting(等待直播)
statusDiscription
频道状态中文描述
channelPasswd
频道密码
createdTime
长整型,频道创建时间戳(13位)
appId
字符串,应用ID
coverImage
频道暖场图片
startTime
直播开始时间,为null 表示未设置
teacherName
讲师名称
teacherActor
讲师头衔
firstPage
是否为第一页,值为:true/false
lastPage
是否为最后一页,值为:true/false
nextPageNumber
下一页编号
prePageNumber
上一页编号
totalPages
总页数
startRow
当前页第一条记录在总的记录数中的位置
endRow
当前页最后一条记录在总的记录数中的位置
limit
当前页的记录个数
php请求示例
<?php
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$status = "live";
$startDate = "2019-03-12";
$endDate = "2019-04-12";
$page = "1"; //页数
$pageSize="10";//每页显示的数据
$params = array(
'appId'=>$appId,
'startDate'=>$startDate,
'endDate'=>$endDate,
'status'=>$status,
'page'=>$page,
'pageSize'=>$pageSize,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
//接口请求url
$url = "http://api.polyv.net/live/v3/channel/management/query-list?appId=$appId&startDate=$startDate&endDate=$endDate&status=$status&page=$page&pageSize=$pageSize×tamp=$timestamp&sign=$sign";
//输出接口请求结果
echo file_get_contents($url);
?>
Last updated
Was this helpful?