保利威文档中心

幫助中心

修改研討會與會條件

更新時間:2024-11-18 15:58:35

介面描述

1、修改研讨会的登录条件
2、主要参会条件不能关闭,否则返回参数错误
3、相同参会条件(主要参会条件/次要参会条件),不同角色的开关、认证类型必须相同,否则返回参数错误
4、相同参会条件(主要参会条件/次要参会条件),不同角色的密码/独立授权key必须不同,否则返回参数错误
4、当认证类型是密码登录时,密码不能为空;当认证类型是独立授权时,授权key不能为空,否则返回参数错误
5、主要参会条件和次要参会条件的类型为相同时,不能够同时打开,否则返回参数错误
6、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
7、接口支持https协议

介面URL

https://api.polyv.net/live/v3/channel/seminar/setting/auth/set

請求方式

POST

介面約束

1、介面同時支援HTTP 、HTTPS ,建議使用HTTPS 確保介面安全,介面呼叫有頻率限制,詳細請查看

請求參數描述

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

請求體參數描述

參數名 必選 類型 說明
authSettings true Array 觀看條件設定 【詳見authSettings欄位說明

authSettings欄位說明

參數名 必選 類型 說明
rank true Integer 主要觀看條件為1,次要觀看條件為2
enabled true String 是否開啟與會條件 N:關閉 Y:開啟
roleCode true String 角色
host:主持人
attendee:與會人
authType false String 與會條件類型
password:密碼登入
direct:獨立授權
custom:自訂授權
phone:白名單觀看
password false String 當authType為password時,密碼登入的password
directKey false String 當authType為direct時,設定參數,非必填,獨立授權SecretKey
customUri false String 當authType為custom時,為自訂授權自訂URL
customKey false String 當authType為custom時,為自訂授權SecretKey
whiteListInputTips false String 當authType為phone時,白名單輸入提示

範例

https://api.polyv.net/live/v3/channel/seminar/setting/auth/set?appId=frlr1zazn3&sign=E2B692768C6F467B1228B5876625B71E&channelId=2191532&timestamp=1621843761626

請求體參數

{
  "authSettings": [{
      "rank": 1,
      "enabled": "Y",
      "authType": "password",
      "roleCode": "host",
      "password": "464nk4"
    }, {
      "rank": 1,
      "enabled": "Y",
      "authType": "password",
      "roleCode": "attendee",
      "password": "w8u81f"
    }, {
      "rank": 2,
      "enabled": "Y",
      "authType": "direct",
      "roleCode": "host",
      "directKey": "b3z0fy1y3z"
    }, {
      "rank": 2,
      "enabled": "Y",
      "authType": "direct",
      "roleCode": "attendee",
      "directKey": "lv2n30e15i"
    }]
}

回應參數描述

參數名 類型 說明
code Integer 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明
status String 回應狀態文字資訊
message String 回應描述資訊,當code為400或者500的時候,輔助描述錯誤原因
data String 成功時為true,錯誤時為空

Java請求範例

快速接入基礎程式碼請下載相關依賴原始碼點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。

強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK 對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。

private static final Logger log = LoggerFactory.getLogger(SeminarAuthTest.class);
/**
 * 修改频道观看条件
 * @throws IOException
 */
@Test
public void testSetSeminarAuth() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId=super.appId;
    String appSecret=super.appSecret;
    String userId = super.userId;
    String timestamp=String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "https://api.polyv.net/live/v3/channel/seminar/setting/auth/set";
    String channelId = "2191532";
    String body = "{\n" +
        "\t\"authSettings\": [{\n" +
        "      \"rank\": 1,\n" +
        "      \"enabled\": \"Y\",\n" +
        "      \"authType\": \"password\",\n" +
        "      \"roleCode\": \"host\",\n" +
        "      \"password\": \"464nk4\"\n" +
        "    }, {\n" +
        "      \"rank\": 1,\n" +
        "      \"enabled\": \"Y\",\n" +
        "      \"authType\": \"password\",\n" +
        "      \"roleCode\": \"attendee\",\n" +
        "      \"password\": \"w8u81f\"\n" +
        "    }, {\n" +
        "      \"rank\": 2,\n" +
        "      \"enabled\": \"Y\",\n" +
        "      \"authType\": \"direct\",\n" +
        "      \"roleCode\": \"host\",\n" +
        "      \"directKey\": \"b3z0fy1y3z\"\n" +
        "    }, {\n" +
        "      \"rank\": 2,\n" +
        "      \"enabled\": \"Y\",\n" +
        "      \"authType\": \"direct\",\n" +
        "      \"roleCode\": \"attendee\",\n" +
        "      \"directKey\": \"lv2n30e15i\"\n" +
        "    }]\n" +
        "}";

    //http 调用逻辑
    Map<String,String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp",timestamp);
    requestMap.put("channelId",channelId);

    requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
    url = HttpUtil.appendUrl(url, requestMap);
    String response = HttpUtil.postJsonBody(url, body, null);
    log.info("测试修改频道观看条件接口返回值:{}",response);
    //do somethings

}

回應範例

系統全域錯誤說明詳見全域錯誤說明

成功範例

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

異常範例

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
{
    "code": 10620,
    "status": "error",
    "message": "role rank empty",
    "data": ""
}
{
    "code": 10621,
    "status": "error",
    "message": "enabled cannot be different",
    "data": ""
}
{
    "code": 10622,
    "status": "error",
    "message": "auth cannot be different",
    "data": ""
}
{
    "code": 10623,
    "status": "error",
    "message": "password cannot be empty",
    "data": ""
}
{
    "code": 10624,
    "status": "error",
    "message": "secret key cannot be empty",
    "data": ""
}
{
    "code": 10625,
    "status": "error",
    "message": "duplicated seminar role secret key",
    "data": ""
}
{
    "code": 10601,
    "status": "error",
    "message": "duplicated seminar role password",
    "data": ""
}
{
    "code": 10626,
    "status": "error",
    "message": "unknown role",
    "data": ""
}
{
    "code": 10627,
    "status": "error",
    "message": "lack host or attendee",
    "data": ""
}
{
    "code": 10628,
    "status": "error",
    "message": "main auth cannot be disabled",
    "data": ""
}
{
    "code": 10629,
    "status": "error",
    "message": "duplicated auth",
    "data": ""
}
联系客服,在线咨询