Polyv Help Center

Help Center

Batch Modify Channel Cloud Distribution Switch

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

API Description

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

API URL

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

Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have 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 not 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
distributeIds true String Cloud distribution list IDs, separated by commas for multiple IDs
distributeEnabled false String Cloud distribution switch, Y: Enable, N: Disable, default is N

Example

http://api.polyv.net/live/v4/channel/distribute/update-switch?channelId=2272655&appId=frlr1zazn3&timestamp=1639731118000&sign=DE519ADA34BECDD05CB4158C32975162&distributeEnabled=Y&distributeIds=2974

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: success returns "success", failure returns "error"
success Boolean Response result, determined by business logic: success returns true, failure returns false
data Object Returns true on success, 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, used only 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 cause
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 project. The test cases include HttpUtil.java and LiveSignUtil.java, both contained in the download 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
 * @throws NoSuchAlgorithmException
 */
@Test
public void testUpdateSwitch() 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-switch";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", "2272655");
    requestMap.put("distributeIds", "3146,3159");
    requestMap.put("distributeEnabled", "Y");
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    url = HttpUtil.appendUrl(url,requestMap);
    String response = HttpUtil.postFormBody(url,null);
    
    log.info("测试批量修改频道云分发开关,返回值:{}", response);
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

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

Error Example

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