获取频道的积分打赏开关

接口URL

http://api.polyv.net/live/v3/channel/donate/get-point-enabled

接口说明

1、接口用于获取频道的积分打赏开关
2、接口支持https

支持格式

JSON

请求方式

GET

请求参数

参数名必选类型说明

appId

string

从API设置中获取,在直播系统登记的appId

timestamp

long

13位当前时间戳

sign

String

签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则

channelId

int

频道号

响应成功JSON示例:

{
  "code": 200,
  "status": "success",
  "message": "",
  "data": {
  "donatePointEnabled" : "N",
  "globalPointDonateEnabled" : "Y"
  }
}

响应失败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": "param is not digit: dsadasd", 
  "data": ""
}

字段说明

参数名说明

code

响应代码,成功为200,失败为400,签名错误为403,异常错误500

status

成功为success,失败为error

message

错误时为错误提示消息

data

成功响应时返回开关数据

data.donatePointEnabled

频道的积分打赏开关

data.globalPointDonateEnabled

当前账号的积分打赏设置开关

php请求示例

<?php
//引用config.php
include '/srv/http/config.php';
$channelId = '要查询的频道号';
$params = array(
  'appId' => $appId,
  'channelId' => $channelId,
  'timestamp' => $timestamp
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "http://api.polyv.net/live/v3/channel/donate/get-point-enabled?".http_build_query($params);

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>

Last updated