保利威文档中心

幫助中心

查詢場次資訊列表

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

介面URL

http://api.polyv.net/live/v3/channel/session/simple-list

介面說明

取得直播的場次資訊列表
介面支援https

請求方式

GET

請求參數

參數名 必填 類型及範圍 說明
sign true String 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則
appId true string 開發者帳號下的appId
timestamp true string 13位當前時間的時間戳
channelId false int 頻道ID,當不傳頻道ID就是查詢用戶下所有頻道的場次
start false long 開始時間,格式: 13位時間戳
end false long 結束時間,格式:13位時間戳

回傳正確結果JSON範例

{
    "code":200,
    "status":"success",
    "message":"",
    "data":[
        {
            "sessionId":"fmwuubgojd",
            "channelId":1362350,
            "channelAccount":null,
            "liveType":"alone",
            "streamName":"4d57ea01de1587722394602020e",
            "createdTime":1588038557000,
            "lastModified":1588038557000,
            "pushClient":"mac"
        },
        {
            "sessionId":"fmsv7rte20",
            "channelId":1362350,
            "channelAccount":null,
            "liveType":"alone",
            "streamName":"4d57ea01de1587722394602020e",
            "createdTime":1587725914000,
            "lastModified":1587725914000,
            "pushClient":"mac"
        },
        {
            "sessionId":"fmsutw2fn5",
            "channelId":1362350,
            "channelAccount":null,
            "liveType":"alone",
            "streamName":"4d57ea01de1587722394602020e",
            "createdTime":1587725075000,
            "lastModified":1587725075000,
            "pushClient":"mac"
        }
    ]
}

回應失敗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 int 介面請求狀態碼,200表示成功
status string 介面請求狀態,"success"表示成功
message string 請求失敗時回傳的錯誤資訊
data 列表 查詢的結果
data.sessionId string 場次ID
data.channelId int 頻道ID
data.channelAccount string 子帳號ID
data.liveType string 頻道對應的場景
data.streamName string 直播的流名稱
data.createdTime long 建立時間,13位的時間戳
data.lastModified long 最後修改時間,13位的時間戳
data.pushClient string 推流的用戶端

PHP請求範例

<?php

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

$type = "mic";
$params = array(
        'appId'=>$appId,
        'channelId'=>$channelId,
        'start'=>$start,
        'end'=>$end,		
        'timestamp'=>$timestamp
    );

//生成sign
$sign = getSign($params); //详细查看config.php文件
$params['sign'] = $sign;
$url="http://api.polyv.net/live/v3/channel/session/simple-list?".http_build_query($params);
echo "<script>window.location.href='$url'</script>";
?>
联系客服,在线咨询