Polyv Help Center

Help Center

Push Channel Card

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

API Description

1、推送频道卡片,对应新版后台的 营销-卡片
2、接口支持https协议

API URL

http://api.polyv.net/live/v4/channel/card-push/push

Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls are subject to rate limits. See 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 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 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
cardPushId true Long Card push primary key ID

Example

http://api.polyv.net/live/v4/channel/card-push/push?appId=frlr1zazn3&sign=CB444E3E2769FC16CA3B5F02CD97FF6B&channelId=2477096&timestamp=1634268622363

Form Parameters:

cardPushId=1282

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 Returns null on successful response
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, should not be tied 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 HttpUtil.java and LiveSignUtil.java are included 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 pooling.

/**
 * 测试推送频道卡片
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testPushChannelCardPush() 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/card-push/push";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", "2477096");
    
    Map<String, String> paramMap = new HashMap<>();
    paramMap.put("cardPushId", "1282");
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    url = HttpUtil.appendUrl(url, requestMap);
    
    String response = HttpUtil.postFormBody(url, paramMap);
    
    log.info("测试推送频道卡片成功,返回值:{}", response);
}

Response Example

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "847f0716fa76461baf8979aaa4415dc3.69.16342686261463481",
    "data": null,
    "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "requestId": "31a6d48f9b8d43bcad2c0963e526cec3.61.16360830356323521",
    "error": {
        "code": 10001,
        "desc": "cardPushId不能为null"
    },
    "data": null,
    "success": false
}
联系客服,在线咨询