文章目录
接口URL
https://api.polyv.net/live/v2/channelAccount/{channelId}/add
接口说明
(接口调用有频率限制,详细请查看)
1、创建子频道
2、接口支持https协议
3、接口URL中的{channelId}为 频道ID
返回结果支持格式
JSON
请求方式
POST
请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | string | 当前13位毫秒级时间戳,3分钟内有效 |
sign | 是 | string | 签名,32位大写MD5值 |
role | 否 | string | 默认不传为助教,传Guest为嘉宾(只支持三分屏场景的频道) |
nickname | 否 | string | 创建的助教或嘉宾昵称 |
actor | 否 | string | 创建的助教或嘉宾头衔 |
avatar | 否 | string | 创建的助教或嘉宾头像 |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"account": "004104400",
"userId": "edvf2fpec9",
"channelId": 104400,
"passwd": "150751",
"nickname": "张老师",
"stream": "jdci3mre",
"status": "Y",
"createdTime": 1517973284858,
"lastModified": 1517973284858,
"channelSessionId": null,
"sort": 4,
"avatar": null,
"actor": null,
"pageTurnEnabled": "N",
"notifyEnabled": "Y",
"checkinEnabled": null,
"voteEnabled": null,
"lotteryEnabled": null,
"role": null
}
}
响应失败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": 400,
"status": "error",
"message": "account role error",
"data": ""
}
字段说明
参数名 | 说明 |
---|---|
code | 请求状态响应码 |
status | 请求状态 |
message | 错误信息 |
account | 助教ID |
userId | 用户ID |
channelId | 频道ID |
passwd | 助教密码 |
nickname | 助教名称 |
stream | 助教流名(单独使用无效) |
status | 助教状态 |
createdTime | 创建助教时间 |
lastModified | 助教最后修改时间 |
sort | 频道中所有助教序号 |
avatar | 助教头像 |
pageTurnEnabled | 助教翻页权限(只能一个助教有) |
notifyEnabled | 发布公告权限 |
checkinEnabled | 开启签到权限 |
voteEnabled | 发起投票 |
role | 子频道角色 |
php请求示例
<?php
//签名验证必需参数
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$nickname = "助教昵称";
$avatar = "http://livestatic.videocc.net/v_556/assets/wimages/missing_face.png";
$actor = "助教头衔";
$channelId="160256";
$params = array(
'appId'=>$appId,
'timestamp'=>$timestamp,
'avatar'=>$avatar,
'actor'=>$actor,
'nickname'=>$nickname
);
//获取sign函数
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$data = array(
'appId'=>$appId,
'timestamp'=>$timestamp,
'avatar'=>$avatar,
'actor'=>$actor,
'nickname'=>$nickname,
'sign'=>$sign
);
$url = "https://api.polyv.net/live/v2/channelAccount/$channelId/add";
$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $data);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;
?>