Polyv Help Center

Help Center

Query Channel Staging File ID by Custom Session ID

Updated: 2022-09-15 09:50:53

API Description

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

API URL

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

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameters

Parameter Required Type Description
appId true String Account appId See Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never be saved or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server and retrieve response data. See Signature Generation Rules
channelId true String Session ID
externalSessionId true String Custom live session UUID. This parameter is set via Associate Custom ID with Live Session

Example

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

Response Parameters

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See Global Error Codes
status String Response status text
message String Response description. When code is 400 or 500, provides additional error details
data Array List of staging files. See data field description

data Field Description

Parameter Type Description
originSessionId String Original live session ID
fileIds Array List of staging file IDs, sorted by generation time in descending order
createdTime Long Timestamp of the latest staging file generation, 13-digit millisecond timestamp

Java Request Example

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
    
}

Response Example

For global system error codes, see Global Error Codes

Success Example

{
    "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
        }
    ]
}

Error Example

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