Polyv Help Center

Help Center

Get Channel Point Donation Toggle

Updated: 2022-09-02 18:08:07

Interface URL

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

Interface Description

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

Supported Format

JSON

Request Method

GET

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live streaming system
timestamp Yes long 13-digit current timestamp
sign Yes String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never be saved or used directly on the client side. All APIs must be called through the customer's own server as an intermediary to obtain response data from the POLYV server. For details, see Signature Generation Rules
channelId Yes int Channel ID

Successful Response JSON Example:

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

Failed Response JSON Examples:

No appId entered

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

Incorrect appId

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

Timestamp error

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

Signature error

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Invalid channel ID format

{
  "code": 400, 
  "status": "error", 
  "message": "param is not digit: dsadasd", 
  "data": ""
}

Field Description

Parameter Description
code Response code: 200 for success, 400 for failure, 403 for signature error, 500 for server error
status "success" for success, "error" for failure
message Error message when an error occurs
data Toggle data returned on successful response
data.donatePointEnabled Channel point donation toggle
data.globalPointDonateEnabled Current account's point donation setting toggle

PHP Request Example

<?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;
?>
联系客服,在线咨询