保利威文档中心

幫助中心

查詢頻道號下所有角色資訊

更新時間:2024-07-22 14:14:15

介面描述

1、查询频道内所有助教和嘉宾的具体信息
2、接口URL中的{channelId}为频道号
3、接口支持https协议

介面URL

http://api.polyv.net/live/v2/channelAccount/{channelId}/accounts

線上API呼叫

請求方式

GET

介面限制

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

請求參數說明

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

範例

https://api.polyv.net/live/v2/channelAccount/2191541/accounts?appId=frlr1zazn3&sign=BE8A0E88376E1B4BB1BBB48BADD5AFBE&timestamp=1621841937679

回應參數說明

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

data欄位說明

參數名 類型 說明
account String 助教/嘉賓帳號
userId String POLYV使用者ID,與保利威官網一致,取得路徑:官網->登入->直播(開發設定)
channelId String 頻道號
passwd String 角色密碼
nickname String 角色名稱
stream String 角色串流名稱,單獨使用無效
status String 角色狀態
createdTime Long 建立角色時間
lastModified Long 角色最後修改時間
sort String 頻道中所有角色序號
avatar String 角色頭像
actor String 角色頭銜
pageTurnEnabled String 是否擁有翻頁權限,只能一個角色有,僅支援三分割畫面場景
Y:是
N:否
notifyEnabled String 是否擁有發布公告權限
Y:是
N:否
checkinEnabled String 是否擁有開啟簽到權限
Y:是
N:否
voteEnabled String 是否擁有發起投票權限
Y:是
N:否
lotteryEnabled String 是否擁有抽獎權限
Y:是
N:否
role String 角色
Assistant:助教
Guest:嘉賓
chatListEnabled String 助教頁線上列表顯示開關
Y:開啟
N:關閉
chatAuditEnabled String 助教聊天審核
Y:開啟
N:關閉
monitorEnabled String 助教監播開關
Y:開啟
N:關閉
roundTourEnabled String 助教輪巡開關
Y:開啟
N:關閉
watchLockEnabled String 鎖定直播間功能開關
Y:開啟
N:關閉
chatInteractionEnabled String 互動發言功能開關
Y:開啟
N:關閉
pushUrl String 角色推流位址,角色推流請參考後台導播台使用

Java請求範例

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

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

private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
 *查询频道号下所有角色信息
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetAccounts() 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/v2/channelAccount/%s/accounts";
    String channelId="2149710";
    
    url = String.format(url, channelId);
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询频道号下所有角色信息,返回值:{}", response);
    //do somethings
    
}

回應範例

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

成功範例

{
    "code":200,
    "status":"success",
    "message":"",
    "data":[
        {
            "account":"0072149710",
            "userId":"1b448be323",
            "channelId":2149710,
            "passwd":"xxxxxx",
            "nickname":"赵老师",
            "stream":"km1fvuo3",
            "status":"Y",
            "createdTime":1615259640000,
            "lastModified":1615259640000,
            "channelSessionId":null,
            "sort":7,
            "avatar":"//s1.videocc.net/default-img/avatar/assistant.png",
            "actor":"助教",
            "pageTurnEnabled":"N",
            "notifyEnabled":"Y",
            "checkinEnabled":"Y",
            "voteEnabled":"Y",
            "lotteryEnabled":"Y",
            "role":"Assistant",
            "chatListEnabled":"Y",
            "chatAuditEnabled":"N",
            "monitorEnabled":"N",
            "roundTourEnabled":"N",
            "watchLockEnabled":"N",
            "pushUrl":"rtmp://push-d1.videocc.net/recordf/1b448be32316137918188520c60km1fvuo3?auth_key=1615341964-0-0-fc732106ae504b75082042014f616f34"
        }
    ]
}

異常範例

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询