查询频道正在进行某个互动
接口URL
https://api.polyv.net/live/v3/chat/inConductInteractive
接口说明
查询某个频道是否正在进行交互动作(签到、问卷、抽奖、正在答题等)
支持格式
JSON
请求方式
GET
请求参数
参数名
必选
类型及范围
说明
sign
true
String
签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据
【详见签名生成规则】
appId
true
string
appId
timestamp
true
string
13位时间搓
channelId
true
string
频道号
返回结果
{
"code": 200,
"status": "success",
"message": "",
"data": {
"sign": true,
"lottery": false,
"questionnaire": false,
"testQuestions": false
}
}
失败返回json(不带jsonp)
//时间搓过期
{
"code": 400,
"status": "error",
"message": "ptime is too old.",
"data": ""
}
//签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
字段描述
字段名称
描述
code
响应代码,成功为200,失败为400,签名错误为403,异常错误500(http状态码也跟code相同)
status
成功为success,失败为error
message
错误时为错误提示消息
data
成功时返回一个对象,内容为下面字段
sign
是否正在签到
lottery
是否正在抽奖
questionnaire
是否正在问卷
testQuestions
是否正在答卷
php请求示例
<?php
//引用config.php
include 'config.php';
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'channelId' => 195770
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "https://api.polyv.net/live/v3/chat/inConductInteractive?".http_build_query($params);
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
$res = curl_exec($curl);
curl_close($curl);
echo $res;
?>
Last updated
Was this helpful?