Polyv Help Center

Help Center

Paginated Query for All Channels Under a User

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

Interface URL

http://api.polyv.net/live/v3/channel/management/query-list

Interface Description

1. Purpose: Retrieve all channel information under a user in a paginated manner.
2. The interface supports the HTTPS protocol.

Supported Format

JSON

Request Method

GET

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live streaming system.
timestamp Yes string Current 13-digit millisecond timestamp, valid within 3 minutes.
page Yes string Page number.
pageSize No string Number of data items per page, default is 1000 items per page.
startDate No string Start date for creation date query, format: yyyy-MM-dd.
endDate No string End date for creation date query, format: yyyy-MM-dd.
categoryId No int Category directory ID.
channelIds No string Channel IDs, multiple channel IDs separated by commas.
channelName No string Channel name.
status No string Channel status, values: live (streaming), end (streaming ended), playback (in playback), waiting (waiting to stream).
sign Yes 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 through the customer's own server to relay requests to the POLYV server to obtain response data. For details, see Signature Generation Rules.
liveTimeStart No long Start timestamp for querying by live start time.
liveTimeEnd No long End timestamp for querying by live start time.
listOrderBy No string List sorting rule: createTime (channel creation date, default), startTime-desc (live time descending), startTime-asc (live time ascending).
watchInfoEnabled No string Whether to output the number of likes and page views (PV) for the channel. Y means yes, N means no, default is no.

Successful Response JSON Example:

{
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
}
}

Failed Response JSON Example:

No appId entered

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

Incorrect appId

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

Timestamp error

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

Signature error

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Field Description

Parameter Description
code Response status code, e.g., 200.
status Response status.
message Error message.
data Response result set.
pageNumber Current page number.
totalItems Total number of items.
contents Query result list.
channelId Channel ID.
name Channel name.
status Channel status, values: live (streaming), end (streaming ended), playback (in playback), waiting (waiting to stream).
statusDiscription Chinese description of the channel status.
channelPasswd Channel password.
createdTime Long integer, channel creation timestamp (13 digits).
appId String, application ID.
coverImage Channel warm-up image.
startTime Live start time, null if not set.
teacherName Teacher name.
teacherActor Teacher title.
firstPage Whether it is the first page, value: true/false.
lastPage Whether it is the last page, value: true/false.
nextPageNumber Next page number.
prePageNumber Previous page number.
totalPages Total number of pages.
startRow Position of the first record on the current page within the total records.
endRow Position of the last record on the current page within the total records.
limit Number of records on the current page.

PHP Request Example

<?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&timestamp=$timestamp&sign=$sign";

//输出接口请求结果
echo file_get_contents($url);
  
?>
联系客服,在线咨询