Polyv Help Center

Help Center

Query Channel for Ongoing Interaction

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

Interface URL

https://api.polyv.net/live/v3/chat/inConductInteractive

Interface Description

Query whether a specific channel is currently conducting interactive actions (check-in, questionnaire, lottery, ongoing quiz, etc.)

Supported Format

JSON

Request Method

GET

Request Parameters

Parameter Required Type & Range Description
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security and must not be stored directly on the client. All APIs must be called through the customer's own server to relay request data to the POLYV server and obtain responses. For details, see Signature Generation Rules
appId true string appId
timestamp true string 13-digit timestamp
channelId true string Channel ID

Return Result

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "sign": true,
        "lottery": false,
        "questionnaire": false,
        "testQuestions": false
    }
}

Failure Return JSON (without JSONP)

//时间搓过期
{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}
//签名错误
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Field Description

Field Name Description
code Response code: 200 for success, 400 for failure, 403 for signature error, 500 for server error (HTTP status code matches)
status "success" for success, "error" for failure
message Error message when status is "error"
data On success, returns an object containing the following fields
sign Whether check-in is ongoing
lottery Whether lottery is ongoing
questionnaire Whether questionnaire is ongoing
testQuestions Whether quiz is ongoing

PHP Request Example

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