直播

获取直播列表

接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/lives

参数说明:

支持分页参数和排序:(通用说明?

参数 是否必须 默认值 说明
page 1 当前页数
per_page 20 每页返回的数量

SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('lives', [
    'page'=> 1,
    'per_page' => 3,
]);

响应document

200 OK 状态码
{
    "data": [
        {
            "type": "live",
            "id": "34a8a812e28111e9aedd0a58ac130342",
            "attributes": {
                "title": "fesfresg",
                "started_at": "2019-09-29 14:18:00",
                "status": "init",
                "push_method": "pc",
                "created_at": "2019-09-29 14:20:17",
                "updated_at": "2019-09-29 14:20:28",
                "visit_count": 2,
                "video_duration": 0
            },
            "relationships": {
                "owner": {
                    "data": {
                        "type": "staff",
                        "id": "ruiven"
                    }
                },
                "streamer": {
                    "data": {
                        "type": "staff",
                        "id": "ruiven"
                    }
                }
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/lives?per_page=1&page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/lives?per_page=1&page=2",
        "prev": null,
        "next": "https://lxapi.lexiangla.com/cgi-bin/v1/lives?per_page=1&page=3"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 225,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/lives",
        "per_page": 1,
        "to": 1,
        "total": 225
    },
    "included": [
        {
            "type": "staff",
            "id": "ruiven",
            "attributes": {
                "name": "刘测试名学文",
                "english_name": null,
                "organization": "开发组"
            }
        },
        {
            "type": "staff",
            "id": "ruiven",
            "attributes": {
                "name": "测试名",
                "english_name": null,
                "organization": "开发组"
            }
        }
    ]
}

参数说明

参数 说明
live.type 资源对象类型,为lives,表示资源为直播
live.id 直播实体ID
live.title 直播的标题
live.status 直播的状态(init:初始化, waiting:等待, pushing:推流状态, finished:完成, forbidden:无权限访问)
live.push_method 直播类型(wechat, pc)
live.started_at 直播的开始时间
live.created_at 直播的创建时间
live.updated_at 直播的更新时间
live.visit_count 直播的访问量
live.video_duration 直播的时长
relationships.owner 直播的创建人
relationships.streamer 直播讲师

获取单场直播信息

接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/lives/{liveID}

参数说明:

支持分页参数和排序:(通用说明?

参数 是否必须 默认值 说明
liveID 直播ID

SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('lives/6b096940e0f711e9ae480a58ac1302ce');

响应document

200 OK 状态码
{
    "data": {
        "type": "live",
        "id": "6b096940e0f711e9ae480a58ac1302ce",
        "attributes": {
            "title": "测试新推流链接",
            "started_at": "2019-09-27 15:21:00",
            "visit_count": 21,
            "status": "finished",
            "created_at": "2019-09-27 15:21:26",
            "updated_at": "2019-10-06 11:05:00",
            "video_duration": 1680
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "ruiven"
                }
            },
            "streamer": {
                "data": {
                    "type": "staff",
                    "id": "ruiven"
                }
            }
        }
    },
    "included": [
        {
            "type": "staff",
            "id": "ruiven",
            "attributes": {
                "name": "测试名",
                "english_name": null,
                "organization": "开发组"
            }
        },
        {
            "type": "staff",
            "id": "ruiven",
            "attributes": {
                "name": "测试名",
                "english_name": null,
                "organization": "开发组"
            }
        }
    ],
    "links": {
        "self": "https://lxapi.lexiangla.net/cgi-bin/v1/lives/6b096940e0f711e9ae480a58ac1302ce"
    }
}

参数说明:

参数 说明
live.type 资源对象类型,为lives,表示资源为直播
live.id 直播实体ID
live.title 直播的标题
live.status 直播的状态(init:初始化, waiting:等待, pushing:推流状态, finished:完成, forbidden:无权限访问)
live.started_at 直播的开始时间
live.created_at 直播的创建时间
live.updated_at 直播的更新时间
live.visit_count 直播的访问量
live.video_duration 直播的时长
relationships.owner 直播的创建人
relationships.streamer 直播讲师

获取单场直播记录

接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/lives/{liveID}/staffs

参数说明:

支持分页参数和排序:(通用说明?

参数 是否必须 默认值 说明
page 1 当前页数
per_page 20 每页返回的数量
liveID 直播ID

SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('lives/6b096940e0f711e9ae480a58ac1302ce/staffs', [
    'page'=> 1,
    'per_page' => 3,
]);

响应document

200 OK 状态码
{
    "data": [
        {
            "type": "staff",
            "id": "feggre",
            "attributes": {
                "name": "eggrsegr",
                "english_name": null,
                "organization": "开发组",
                "online_duration": 1090
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/6b096940e0f711e9ae480a58ac1302ce/staffs?page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/6b096940e0f711e9ae480a58ac1302ce/staffs?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/6b096940e0f711e9ae480a58ac1302ce/staffs",
        "per_page": 20,
        "to": 1,
        "total": 1
    }
}

参数说明:

参数 说明
name 员工姓名
english_name 员工英文名
organization 员工部门
online_duration 直播观看时长

获取员工观看直播记录

接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/staffs/{staffID}/lives

参数说明:

支持分页参数和排序:(通用说明?

参数 是否必须 默认值 说明
sort -created_at 排序参数,支持按直播的created_at排序
page 1 当前页数
per_page 20 每页返回的数量
staffID 企业微信提供的员工ID

SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('/staffs/fewefwe/lives', [
    'page'=> 1,
    'per_page' => 3,
]);

响应document

200 OK 状态码
{
    "data": [
        {
            "type": "live",
            "id": "5ff26d50dead11e9a0b00a58ac130286",
            "attributes": {
                "title": "测试统计",
                "video_duration": 0,
                "online_duration": 586,
                "started_at": "2019-09-27 15:21:00",
                "created_at": "2019-09-27 15:21:26",
                "updated_at": "2019-10-06 11:05:00"
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ruivenliu/lives?per_page=1&page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ruivenliu/lives?per_page=1&page=24",
        "prev": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ruivenliu/lives?per_page=1&page=1",
        "next": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ruivenliu/lives?per_page=1&page=3"
    },
    "meta": {
        "current_page": 2,
        "from": 2,
        "last_page": 24,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/fewefwe/lives",
        "per_page": 1,
        "to": 2,
        "total": 24
    }
}

参数说明

参数 说明
live.type 资源对象类型,为lives,表示资源为直播
live.id 直播实体ID
live.title 直播的标题
live.video_duration 直播时长
live.started_at 直播开始时间
live.created_at 直播创建时间
live.updated_at 直播的更新时间
live.online_duration 直播观看时长