# 查询场次信息列表

### 接口URL

```
http://api.polyv.net/live/v3/channel/session/simple-list
```

### 接口说明

```
获取直播的场次信息列表
接口支持https
```

### 请求方式

```
GET
```

### 请求参数

| 参数名       | 必选    | 类型及范围  | 说明                                                                                                                                                                                                        |
| --------- | ----- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sign      | true  | String | 签名，为32位大写的MD5值,`生成签名的appSecret密钥作为通信数据安全的关键信息，严禁保存在客户端直接使用，所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据`【详见[签名生成规则](https://git.polyv.net/help-center/document-center/-/blob/master/live/api/buildSign/README.md)】 |
| appId     | true  | string | 开发者账号下的appId                                                                                                                                                                                              |
| timestamp | true  | string | 13位当前时间的时间戳                                                                                                                                                                                               |
| channelId | false | int    | 频道ID，当不传频道ID就是查询用户下所有频道的场次                                                                                                                                                                                |
| start     | false | long   | 开始时间，格式： 13位时间戳                                                                                                                                                                                           |
| end       | false | long   | 结束时间，格式：13位时间戳                                                                                                                                                                                            |

### 返回正确结果JSON示例

```json
{
    "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"
        }
    ]
}
```

### 响应失败JSON示例：

未输入appId

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

appId不正确

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

时间戳错误

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

签名错误

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

### 字段说明

| 字段                  | 类型及范围  | 说明                   |
| ------------------- | ------ | -------------------- |
| code                | int    | 接口请求状态码，200表示成功      |
| status              | string | 接口请求状态，"success"表示成功 |
| message             | string | 请求失败时返回的错误信息         |
| data                | 列表     | 查询的结果                |
| data.sessionId      | string | 场次ID                 |
| data.channelId      | int    | 频道ID                 |
| data.channelAccount | string | 子账号ID                |
| data.liveType       | string | 频道对应的场景              |
| data.streamName     | string | 直播的流名称               |
| data.createdTime    | long   | 创建时间，13位的时间戳         |
| data.lastModified   | long   | 最后修改时间，13位的时间戳       |
| data.pushClient     | string | 推流的客户端               |

### PHP请求示例

```php
<?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>";
?>

```
