保利威文档中心

帮助中心

根据自定义场次ID查询频道暂存文件ID

更新时间:2022-09-15 09:50:53

接口描述

1、根据自定义场次ID查询频道暂存文件ID
2、接口支持https协议

接口URL

http://api.polyv.net/live/v3/channel/session/list-file-id-by-external

请求方式

GET

接口约束

1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看

请求参数描述

参数名 必选 类型 说明
appId true String 账号appId【详见获取密钥
timestamp true Long 当前13位毫秒级时间戳,3分钟内有效
sign true String 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则
channelId true String 场次ID
externalSessionId true String 自定义直播场次UUID,该参数设置自【直播场次关联自定义ID

示例

http://api.polyv.net/live/v3/channel/session/list-file-id-by-external?appId=frlr1zazn3&sign=9847BBA541A0BF0CBF5380208CE259AD&externalSessionId=test&channelId=2272655&timestamp=1655780318088

响应参数描述

参数名 类型 说明
code Integer 响应状态码,200为成功返回,非200为失败【详见全局错误说明
status String 响应状态文本信息
message String 响应描述信息,当code为400或者500的时候,辅助描述错误原因
data Array 暂存文件列表 【详见data字段描述

data字段描述

参数名 类型 说明
originSessionId String 原始直播场次ID
fileIds Array 暂存文件ID列表,按生成时间倒序
createdTime Long 最新暂存文件生成时间,13位毫秒级时间戳

Java请求示例

private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
 * 根据自定义场次ID查询频道暂存文件ID
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void getFileIdByExternalTest() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());
    
    //业务参数
    String url = "http://api.polyv.net/live/v3/channel/session/list-file-id-by-external";
    String channelId = "2272655";
    String externalSessionId = "test";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", channelId);
    requestMap.put("externalSessionId", externalSessionId);
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试根据自定义场次ID查询频道暂存文件ID成功:{}", response);
    //do somethings
    
}

响应示例

系统全局错误说明详见全局错误说明

成功示例

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": [
        {
            "originSessionId": "g9uya0mbrq",
            "fileIds": [
                "7c3ad56bb6d4e8e6058d7754e10ee4e8",
                "abfb68494b9dd9b58c5e2b7d0a3ee8ce",
                "1fd2500682429db92c1c67dc99af2ef4"
            ],
            "createdTime": 1652775098000
        },
        {
            "originSessionId": "g9uy303rsu",
            "fileIds": [
                "0f5ccaa11c6edd7fcc1f145a6e21ec82"
            ],
            "createdTime": 1652774575000
        },
        {
            "originSessionId": "g9uy0i6b0y",
            "fileIds": [
                "30dc5aa5e7f9e87fc03d0614cb308c34"
            ],
            "createdTime": 1652774321000
        }
    ]
}

异常示例

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