Polyv Help Center

Help Center

Modify Cloud Distribution Channel Master Switch

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

Interface Description

1、修改单个频道云分发总开关,该功能需要超管开通才生效
2、接口支持https协议

Interface URL

http://api.polyv.net/live/v4/channel/distribute/update-master-switch

Online API Call

Request Method

POST

Interface Constraints

  1. The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls are subject to frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details: 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 never be saved or used directly on the client side. All APIs must be relayed through the customer's own server to call the POLYV server for response data. See details: Signature Generation Rules
channelId true String Channel ID
distributeEnabled false String Cloud distribution master switch for the channel. Y: Enable, N: Disable. Default is Y
enforce false String Whether to force disable. Y: Force disable, N: Non-force disable. Default is N. When non-force disable is selected and the channel is actively live streaming, the interface will throw an exception

Example

http://api.polyv.net/live/v4/channel/distribute/update-master-switch?channelId=2272655&distributeEnabled=N&appId=frlr1zazn3&timestamp=1639730255000&sign=F8AEF9DA6944287C31F5668680781642&enforce=N

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates 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 Returns true on successful response, null on failure
error Object Error information when status code is non-200 See details: Error Field Description
requestId String Request ID, a unique UUID generated for each request. Only used for troubleshooting and debugging, should not be tied 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

Java Request Example

For quick integration of 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. 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 functionality integration. The Live Java SDK provides unified packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pooling.

private static final Logger log = LoggerFactory.getLogger(getClass());

/**
 * 修改频道总开关
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testUpdateMasterSwitch() 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/distribute/update-master-switch";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", "2272655");
    requestMap.put("distributeEnabled", "Y");
    requestMap.put("enforce", "N");
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    url = HttpUtil.appendUrl(url,requestMap);
    String response = HttpUtil.postFormBody(url,null);
    
    log.info("测试修改频道总开关,返回值:{}", response);
}

Response Example

For system-wide error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "192d744e4afe46f69fbbdc5919974664.67.16397306000916463",
    "data": true,
    "success": true
}

Error Example

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