Query Session Information List
Updated: 2022-09-02 18:08:07
Interface URL
http://api.polyv.net/live/v3/channel/session/simple-list
Interface Description
Retrieve the list of session information for live broadcasts.
The interface supports HTTPS.
Request Method
GET
Request Parameters
| Parameter | Required | Type and Range | Description |
|---|---|---|---|
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security and 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 and obtain response data. For details, see Signature Generation Rules |
| appId | true | string | appId under the developer account |
| timestamp | true | string | Current timestamp in 13-digit format |
| channelId | false | int | Channel ID. If not provided, sessions under all channels of the user are queried |
| start | false | long | Start time, format: 13-digit timestamp |
| end | false | long | End time, format: 13-digit timestamp |
Example of Successful JSON Response
{
"code":200,
"status":"success",
"message":"",
"data":[
{
"sessionId":"fmwuubgojd",
"channelId":1362350,
"channelAccount":null,
"liveType":"alone",
"streamName":"4d57ea01de1587722394602020e",
"createdTime":1588038557000,
"lastModified":1588038557000,
"pushClient":"mac"
},
{
"sessionId":"fmsv7rte20",
"channelId":1362350,
"channelAccount":null,
"liveType":"alone",
"streamName":"4d57ea01de1587722394602020e",
"createdTime":1587725914000,
"lastModified":1587725914000,
"pushClient":"mac"
},
{
"sessionId":"fmsutw2fn5",
"channelId":1362350,
"channelAccount":null,
"liveType":"alone",
"streamName":"4d57ea01de1587722394602020e",
"createdTime":1587725075000,
"lastModified":1587725075000,
"pushClient":"mac"
}
]
}
Example of Failed JSON Response:
appId not provided
{
"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
| Field | Type and Range | Description |
|---|---|---|
| code | int | Interface request status code, 200 indicates success |
| status | string | Interface request status, "success" indicates success |
| message | string | Error message returned when the request fails |
| data | list | Query results |
| data.sessionId | string | Session ID |
| data.channelId | int | Channel ID |
| data.channelAccount | string | Sub-account ID |
| data.liveType | string | Scene corresponding to the channel |
| data.streamName | string | Live stream name |
| data.createdTime | long | Creation time, 13-digit timestamp |
| data.lastModified | long | Last modification time, 13-digit timestamp |
| data.pushClient | string | Push client |
PHP Request Example
<?php
//引用config.php
include 'config.php';
$type = "mic";
$params = array(
'appId'=>$appId,
'channelId'=>$channelId,
'start'=>$start,
'end'=>$end,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件
$params['sign'] = $sign;
$url="http://api.polyv.net/live/v3/channel/session/simple-list?".http_build_query($params);
echo "<script>window.location.href='$url'</script>";
?>
