保利威文档中心

幫助中心

查詢單個角色資訊

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

介面描述

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

介面URL

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

線上API呼叫

請求方式

GET

介面限制

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

請求參數描述

參數名 必選 類型 說明
appId true String 帳號appId【詳見取得金鑰
timestamp true Long 當前13位毫秒級時間戳,3分鐘內有效
sign true String 簽名,為32位大寫的MD5值,生成簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁保存在客戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名生成規則
account true String 助教/嘉賓帳號(不能以數字類型提交,否則可能去掉角色號前的00)

範例

https://api.polyv.net/live/v2/channelAccount/2191541/account?appId=frlr1zazn3&sign=2D733253D9E982E7AEE33C083A388AC1&account=0052191541&timestamp=1621841869093

回應參數描述

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

data欄位描述

參數名 類型 說明
account String 助教/嘉賓帳號
userId String POLYV使用者ID,與保利威官網一致,取得路徑:官網->登入->直播(開發設定)
channelId String 頻道號
passwd String 角色密碼
nickname String 角色名稱
stream String 角色流名,單獨使用無效
status String 角色狀態
createdTime Long 建立角色時間
lastModified Long 角色最後修改時間
sort Integer 頻道角色序號
avatar 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 testGetAccount() 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/account";
    String channelId="2149710";
    String account = "0062149710";
    
    url = String.format(url, channelId);
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("account", account);
    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":"0062149710",
        "userId":"1b448be323",
        "channelId":2149710,
        "passwd":"xxxxxx",
        "nickname":"杨老师123",
        "stream":"km1bdhf9",
        "status":"Y",
        "createdTime":1615252064000,
        "lastModified":1615254463000,
        "channelSessionId":null,
        "sort":6,
        "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/1b448be32316137918188520c60km1bdhf9?auth_key=1615258732-0-0-52776ade7d496c0bd8c2da61d80cc0e1"
    }
}

異常範例

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