保利威文档中心

幫助中心

新增應用程式介面

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

介面URL

https://api.polyv.net/live/v2/app/add

介面說明

1、接口用于创建应用
2、接口支持https

支援格式

JSON

請求方式

POST

請求次數限制

TRUE

請求參數

參數名 必選 類型 說明
appId string 管理員的APPID
timestamp long 13位當前時間戳
sign String 簽名,為32位大寫的MD5值,生成簽名的appSecret密鑰作為通訊資料安全的關鍵資訊,嚴禁保存在客戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名生成規則
name string 應用程式名稱
watchDomain string 自訂觀看頁域名
webappDomain string 自訂管理後台域名
logoImg string 自訂管理後台的圖示位址
coverImg string 自訂管理後台的封面圖片位址
concurrences int 應用程式的並發數
webinarEnabled string 是否開啟研討會開關,Y開,N關閉,預設為N
appEnglishName string 應用程式英文名稱

回應成功JSON範例:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "appId": "fbj0k74n6s",
        "name": "test-ccb-3",
        "appSecret": "9a9c4badcecd42dc82131f229d07fd04",
        "userId": "a6580a9674",
        "appEnglishName": "testEnglish"
    }
}

回應失敗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 回應代碼,成功為200,失敗為400,簽名錯誤為401,異常錯誤500
status 成功為success,失敗為error
message 錯誤時為錯誤提示訊息
data 成功回應時為相關的應用程式資訊
data.appId 應用程式所屬的呼叫POLYV的appId
data.appSecret 應用程式所屬的呼叫POLYV的appSecret
data.name 應用程式名稱
data.userId 應用程式ID,對應於POLYV的使用者ID
data.appEnglishName 應用程式英文名稱

php請求範例

<?php
//引用config.php
include '/srv/http/config.php';
$params = array(
  'appId' => $appId,
  'name' => $name,
  'watchDomain' => $watchDomain,
  'webappDomain' => $webappDomain,
  'logoImg' => $logoImg,
  'coverImg' => $coverImg,
  'concurrences' => $concurrences,  
  'timestamp' => $timestamp
);

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

$url = "https://api.polyv.net/live/v2/app/add?".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;
?>
联系客服,在线咨询