保利威文档中心

幫助中心

編輯系列直播場次

更新時間:2026-07-27 15:03:25

介面描述

1、编辑系列直播场次
2、接口支持https协议

介面URL

http://api.polyv.net/live/v4/channel/session/new/update

線上API呼叫

請求方式

POST

介面限制

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

請求參數描述

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

請求體參數描述

參數名 必選 類型 說明
sessionId true String 場次ID
name true String 場次名稱
planStartTime true String 場次開始時間 (13位時間戳)
planEndTime true Long 場次結束時間 (13位時間戳)
interactionScriptId false Integer 互動腳本ID
playType false String 播放方式(normal普通播放、loop循環播放)
splashImg false String 場次封面圖
splashLargeImg false String 直式引導大圖
splashImgBackgroundId false String 場次封面背景圖ID
streamType false String 串流類型(普通直播:client/偽直播:realDiskVideo)
videoPoolId false String 偽直播對應素材庫影片ID(streamType為realDiskVideo時必傳)

範例

http://api.polyv.net/live/v4/channel/session/new/update?appId=frlr1zazn3&timestamp=1632809855078&channelId=2588188&sign=D02FA683640135D843D485EE84F6632A

請求體json參數:

{
  "sessionId": "e9s2h3jd8f",
  "name": "专题直播-新品发布会-修订版",
  "planStartTime": 1761201943000,
  "planEndTime": 1761201953000,
  "interactionScriptId": 123,
  "playType": "normal",
  "splashImg": "https://example.com/splash-update.jpg",
  "splashLargeImg": "https://example.com/splash-large-update.jpg",
  "splashImgBackgroundId": "2",
  "streamType": "client",
  "videoPoolId": "vid_abc123"
}

回應參數描述

參數名 類型 說明
code Integer 狀態碼,與http狀態碼相同,用於確定基本的回應狀態
status String 回應結果,由業務決定,成功回傳success,失敗回傳error
success Boolean 是否成功回應
requestId String 請求ID,每次請求產生的唯一的UUID,僅可用於排查、除錯,不應該和業務掛鉤
data Object 場次回應物件【詳見data欄位說明
error Object 錯誤資訊

data欄位說明

參數名 類型 說明
channelId Integer 頻道ID
userId String POLYV使用者ID
sessionId String 場次ID
name String 場次名稱
endTime String 場次結束時間
createdTime String 場次開始時間
planStartTime String 計劃開始時間
planEndTime String 計劃結束時間
splashImg String 封面圖
splashLargeImg String 直式、大圖模式的封面圖
splashImgBackgroundId Integer 封面圖的背景模板id
pushClient 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 testSessionNewUpdateV4() throws IOException, NoSuchAlgorithmException {
    String appId = super.appId;
    String appSecret = super.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());
    String url = "http://api.polyv.net/live/v4/channel/session/new/update";

    Map<String, String> query = new HashMap<>();
    query.put("appId", appId);
    query.put("timestamp", timestamp);
    query.put("channelId", "2588188");
    query.put("sign", LiveSignUtil.getSign(query, appSecret));

    Map<String, Object> body = new HashMap<>();
    body.put("sessionId", "e9s2h3jd8f");
    body.put("name", "专题直播-新品发布会-修订版");
    body.put("planStartTime", "1761201943000");
    body.put("planEndTime", "1761201953000");
    body.put("ignoreStartTimeVerify", true);
    body.put("interactionScriptId", 123);
    body.put("playType", "normal");
    body.put("splashImg", "https://example.com/splash-update.jpg");
    body.put("splashLargeImg", "https://example.com/splash-large-update.jpg");
    body.put("splashImgBackgroundId", "2");
    body.put("streamType", "client");
    body.put("videoPoolId", "vid_abc123");

    String fullUrl = HttpUtil.appendUrl(url, query);
    String response = HttpUtil.postJsonBody(fullUrl, JSON.toJSONString(body), null);
    log.info("返回值:{}", response);
}

回應範例

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

成功範例

{
  "code": 200,
  "status": "success",
  "requestId": "847f0716fa76461baf8979aaa4415dc3.67.16342672396023837",
  "data": {
    "channelId": 2588188,
    "userId": "1b448be323",
    "sessionId": "e9s2h3jd8f",
    "name": "专题直播-新品发布会-修订版",
    "endTime": 1761201953000,
    "status": "end",
    "createdTime": 1761201953000,
    "planStartTime": 1761201953000,
    "planEndTime": 1761201953000,
    "splashImg": "https://example.com/splash-update.jpg",
    "splashLargeImg": "https://example.com/splash-large-update.jpg",
    "splashImgBackgroundId": 2,
    "pushClient": "client",
    "type": "manual"
  },
  "success": true
}

異常範例

{
  "code": 400,
  "status": "error",
  "requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
  "error": {
    "code": 20001,
    "desc": "application not found."
  },
  "success": false
}
联系客服,在线咨询