保利威文档中心

幫助中心

刪除頻道聊天記錄介面

更新時間:2023-11-14 14:07:19

介面URL

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

介面說明

1、介面用於刪除頻道所有聊天記錄
2、介面URL中的{channelId}為 頻道ID
3、介面支援https

支援格式

JSON

請求方式

POST

請求數限制

TRUE

請求參數

參數名 必選 類型 說明
appId string 從API設定中取得,在直播系統登記的appId
timestamp string 當前13位毫秒級時間戳,3分鐘內有效
sign String 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在客戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則

回應成功JSON範例:

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

回應失敗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": 500, 
    "status": "fail", 
    "message": "api error.", 
    "data": ""
}

欄位說明

參數名 說明
code 請求結果代碼,成功為200 錯誤為400,簽名錯誤為403,介面錯誤為500
status 請求結果,成功時為"success"錯誤時為"error"
message 錯誤資訊,請求成功時為空字串,錯誤時錯誤資訊
data 請求成功為true,錯誤為空字串

php請求範例

<?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);
?>

簽名規則(config.php檔案程式碼檢視)

联系客服,在线咨询