Polyv Help Center

Help Center

Delete Channel Chat History API

Updated: 2023-11-14 14:07:19

API URL

http://api.polyv.net/live/v2/chat/{channelId}/cleanChat

API Description

1. This API is used to delete all chat history of a channel.
2. The {channelId} in the API URL is the Channel ID.
3. The API supports HTTPS.

Supported Format

JSON

Request Method

POST

Request Limit

TRUE

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live streaming system.
timestamp Yes string Current 13-digit millisecond timestamp, valid for 3 minutes.
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 not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules

Successful Response JSON Example:

{
    "code": 200, 
    "status": "success", 
    "message": "", 
    "data": true
}

Failed Response JSON Examples:

Missing appId

{
    "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": ""
}

Server error

{
    "code": 500, 
    "status": "fail", 
    "message": "api error.", 
    "data": ""
}

Field Description

Parameter Description
code Request result code: 200 for success, 400 for error, 403 for signature error, 500 for server error.
status Request result: "success" for success, "error" for error.
message Error message: empty string on success, error description on failure.
data "true" on success, empty string on error.

PHP Request Example

<?php
//引用config.php
include 'config.php';

$channelId="123713";

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp
);

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


$url="http://api.polyv.net/live/v2/chat/".$channelId."/cleanChat";

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

$params["sign"] = $sign;
echo post($url, $params);
?>

Signature Rules (See config.php file code)

联系客服,在线咨询