Polyv Help Center

Help Center

Query Distribution Address Information

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

API Description

1、查询分发地址信息
2、接口支持https协议

API URL

http://api.polyv.net/live/v4/channel/distribute/list

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have frequency limits. Click for details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId [See Get Secret Key]
timestamp true Long Current 13-digit millisecond timestamp, valid within 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 not be stored 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 for response data. [See Signature Generation Rules]
channelId true String Channel ID
distributeIds false String Distribution IDs, separated by commas. If not provided, all distribution addresses under the channel are queried by default.

Example

http://api.polyv.net/live/v4/channel/distribute/list?appId=frlr1zazn3&sign=39744576F6CECA12533CD8C73EF166D2&channelId=2272655&timestamp=1639730848124

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure
status String Response result, determined by business logic. Returns success on success, error on failure
success Boolean Response result, determined by business logic. Returns true on success, false on failure
data Object Distribution list information returned on success [See data field description]
error Object Error information when status code is non-200 [See Error field description]
requestId String Request ID, a unique UUID generated for each request. Only used for troubleshooting and debugging, not related to business logic

Error Parameter Description

Parameter Type Description
code Integer Error code, used to identify the specific error reason
desc String Error description, corresponding to error.code

data Parameter Description

Parameter Type Description
distributeEnable String Channel distribution live streaming master switch
Y: Enabled
N: Disabled
result Array Distribution address response object list [See result field description]

result Parameter Description

Parameter Type Description
id Integer Cloud distribution ID
channelId Integer Channel ID
name String Distribution address name
distributeUrl String Push stream address
distributeLiveCode String Live stream code
status String Distribution live streaming switch
Y: On
N: Off
connectionStatus String Connection status
completed: Ended
processing: Relaying
waiting: Waiting for connection
error: Relay failed

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source code project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.

It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

private static final Logger log = LoggerFactory.getLogger(getClass());
/**
 * 查询分发地址及开关状态
 * @throws IOException
 */
@Test
public void list() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String userId = super.userId;
    String timestamp = String.valueOf(System.currentTimeMillis());
    
    //业务参数
    String url = "http://api.polyv.net/live/v4/channel/distribute/list";
    String channelId = "2272655";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", channelId);
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询分发地址及开关状态,返回值:{}", response);
    //do somethings
    
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "e2e23029f14a46098842dde4d8f097b4.1885.16397300550491283",
    "data": {
        "distributeEnable": "Y",
        "result": [
            {
                "id": 3146,
                "channelId": 2272655,
                "name": "xx测试推流",
                "distributeUrl": "rtmp://xxx.polyv.net/xxx/57867407750",
                "distributeLiveCode": "",
                "status": "N",
                "connectionStatus": "completed"
            }
        ]
    },
    "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "requestId": "366c4df40d814803a6ee3b04ceec437e.680953.16397317894687813",
    "error": {
        "code": 30004,
        "desc": "找不到频道"
    },
    "success": false
}
联系客服,在线咨询