Polyv Help Center

Help Center

Channel Status Verification

Updated: 2022-09-02 09:54:31

Interface Description

1、查询频道合法状态
2、接口支持https协议

Interface URL

http://api.polyv.net/live/v4/channel/status-valid

Request Method

GET

Interface Constraints

  1. The interface has a frequency limit. Click here 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 [See Signature Generation Rules]
channels true String Channel numbers, separated by commas for multiple entries, up to 100. Example: 100000,100001

Example

http://api.polyv.net/live/v4/channel/status-valid?channels=1965681%2C2272665%2C3297504&appId=frlr1zazn3&sign=F8BDEF93ED3CD6EDEEFB399187D97582&timestamp=1662083490979

Response Parameter Description

Parameter Type Description
code Integer Status code, same as HTTP status code, used to determine the basic response status
status String Response result, determined by the business. Returns success on success, error on failure
success Boolean Whether the response is successful
requestId String Request ID, a unique UUID generated for each request, only for troubleshooting and debugging, should not be tied to business logic
error Object Error information when the status code is not 200 [See Error Field Description]
data Object [See data Field Description]

Error Parameter Description

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

data Parameter Description

Parameter Type Description
channels Array Channel list [See channels Field Description]

channels Parameter Description

Parameter Type Description
channelId Integer Channel number
delete Integer Whether the channel has been deleted
1: Deleted
0: Not deleted
currentUser Integer Whether it belongs to the current user
1: Yes
0: No

Java Request Example

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

It is strongly recommended to use the Live Java SDK to complete the API functionality 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(GroupTestLive.class);
/**
 * 频道状态验证
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetChannelStatusValid() 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/status-valid";
    String channels = "1965681,2272665,3297504";
    
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channels", channels);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试频道状态验证,返回值:{}", response);
    //do somethings
    
}

Response Example

For a global description of system errors, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "522451e702a4454dbb1a972abd4d4b71.62.16618407903140831",
    "data": {
        "channels": [
            {
                "channelId": 1965681,
                "delete": 0,
                "currentUser": 1
            },
            {
                "channelId": 2272665,
                "delete": 1,
                "currentUser": 0
            },
            {
                "channelId": 3297504,
                "delete": 1,
                "currentUser": 1
            }
        ]
    },
    "success": true
}

Error Example

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