接口URL
http://api.polyv.net/live/v2/channelSetting/{channelId}/set-countdown
接口说明
(接口调用有频率限制,详细请查看)
1、通过接口可以修改频道的倒计时设置。
2、预约功能需开启开关且开启倒计时开关以及设置正确的直播时间才生效
3、之前未设置倒计时直播提示和直播时间的频道号,在开启倒计时开关时,必须提交countTips和startTime
4、接口支持https
5、接口URL中的{channelId}为 频道ID
返回结果支持格式
JSON
请求方式
POST
请求数限制
TRUE
请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | string | 当前13位毫秒级时间戳,3分钟内有效 |
bookingEnabled | 否 | Y或 N | 预约观看开关 |
startTime | 否 | string(yyyy-MM-dd HH:mm:ss) | 直播开始时间,如果不传该值,表示不显示直播时间和倒计时 |
sign | 是 | string | 签名,32位大写MD5值 |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": ""
}
响应失败JSON示例:
未输入appId
{
"code": 400,
"status": "error",
"message": "appId not found.",
"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": "channel not found.",
"data": ""
}
倒计时开关错误(不是Y或N)
{
"code": 400,
"status": "error",
"message": "countEnabled is error.",
"data": ""
}
开启开关且之前未设置过直播提示时,未提交countTips
{
"code": 400,
"status": "error",
"message": "countTips is requeired under this condition.",
"data": ""
}
其他情况
{
"code": 400,
"status": "error",
"message": "undefined error.",
"data": ""
}
字段说明
参数名 | 说明 |
---|---|
code | 请求结果代码,成功为200 |
status | 请求结果,成功时为"success"错误时为"error" |
message | 错误信息,请求成功时为空,错误时错误信息 |
php请求示例
<?php
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$channelId = "127075";
$countEnabled = "Y";
$bookingEnabled = "Y";
$startTime = "2018-02-15 10:00:00";
$countTips = "精彩值得等待";
$params = array(
'appId'=>$appId,
'bookingEnabled'=>$bookingEnabled,
'countEnabled'=>$countEnabled,
'countTips'=>$countTips,
'startTime'=>$startTime,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$data = array(
'appId' => $appId,
'countEnabled' => $countEnabled,
'timestamp' => $timestamp,
'sign' => $sign,
'bookingEnabled' => $bookingEnabled,
'countTips' => $countTips,
'startTime' => $startTime
);
$url = "http://api.polyv.net/live/v2/channelSetting/$channelId/set-countdown";
$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);
$reponse = curl_exec ( $ch );
curl_close ( $ch );
print_r($reponse);
?>