接口URL
http://api.polyv.net/live/v3/channel/detail/update
接口说明
1、接口用于设置频道的基本详情相关设置
2、接口支持https
支持格式
JSON
请求方式
POST
请求数限制
TRUE
请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | long | 13位当前时间戳 |
sign | 是 | string | 签名值 |
channelId | 是 | int | 频道号 |
field | 是 | string | 要更新的字段名称:password 密码 scene 直播场景 maxViewer 最大同时在线人数 |
value | 是 | string | 新的字段值,除设置无限制最大观看人数时可不提交,其他情况都为必填 |
直播场景的取值分别为:alone(活动拍摄),ppt(PPT三分频直播),topclass(大班课直播),设置前,请确认您的套餐是否包含对应场景
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": true
}
响应失败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": ""
}
频道Id格式错误
{
"code": 400,
"status": "error",
"message": "param is not digit: %s",
"data": ""
}
频道不存在
{
"code": 404,
"status": "error",
"message": "channel not found.",
"data": ""
}
频道Id非法错误
{
"code": 400,
"status": "error",
"message": "illegal channel id: %s",
"data": ""
}
字段说明
参数名 | 说明 |
---|---|
code | 状态码,成功为200,签名失败为403,参数错误为400,服务端错误为500 |
status | 成功为success,错误时为error |
message | 成功为"",错误时为错误描述信息 |
data | 成功时为true,错误时为"" |
php请求示例
<?php
//引用config.php
include 'config.php';
$params = array(
'appId' => "填写获取到的appId",
'timestamp' => "填写13位时间戳",
'channelId' => "填写频道号",
'field' => "password",
'value' => "abcdefg"
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$url="http://api.polyv.net/live/v3/channel/detail/update";
function post($url, $post_data = '', $timeout = 5){
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
if($post_data != ''){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}
$params["sign"] = $sign;
echo post($url, http_build_query($params));
?>