保利威文档中心

幫助中心

設定頻道回調接收地址

更新時間:2022-09-02 18:08:07

介面URL

http://api.polyv.net/live/v3/user/set-channel-callback

介面說明

1.設定頻道回調地址;用於頻道新增、刪除、修改(包括基本資訊設定、講師設定、嘉賓設定、直播狀態的修改)的通知回調url設定
2.介面支援https

請求方式

POST

請求參數

參數名 必選 類型及範圍 說明
sign true String 簽名,為32位大寫的MD5值,生成簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器獲取回應資料【詳見簽名生成規則
appId true string 開發者帳號下的appId
timestamp true string 13位當前時間的時間戳
url true string 回調地址,需要帶上協定(http、https);傳空即關閉回調服務;不得超過255個字元

返回錯誤結果JSON範例

签名错误:
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
时间戳错误:
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}
appId错误
{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}
应用找不到
{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}
回调url不合法
{
    "code": 400,
    "status": "error",
    "message": "url is illegal",
    "data": ""
}

返回正確結果JSON範例

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

欄位說明

欄位 類型及範圍 說明
code int 介面請求狀態碼,200表示成功
status string 介面請求狀態,"success"表示成功
message string 請求失敗時返回的錯誤資訊
data string

PHP請求範例

<?php

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

$url = "https://api.polyv.net/live/channelCallbackTest";
$params = array(
        'appId'=>$appId,
        'url'=>$url,
        'timestamp'=>$timestamp
    );

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

$url="http://api.polyv.net/live/v3/channel/bookings-and-likes?".http_build_query($params);

$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;
?>
联系客服,在线咨询