Polyv Help Center

Help Center

Query Channel Card Push

Updated: 2023-10-11 15:57:19

API Description

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

API URL

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

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls have frequency 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 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

Example

http://api.polyv.net/live/v4/channel/card-push/list?appId=frlr1zazn3&sign=56C7EFE6CFA7A76CA3AAB272CABAC22F&channelId=2523307&timestamp=1632994650498

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 Card information returned on successful response [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.

data Parameter Description

Parameter Type Description
element ChannelCardPushVO [See element Field Description]

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

element Parameter Description

Parameter Type Description
id Long Card push ID
channelId Integer Channel ID
title String Card title, maximum 16 characters
imageType String Card style type
giftbox: Gift claim style
redpack: Red packet style
custom: Custom
duration Integer Card countdown duration, values: 0, 5, 10, 20, 30, unit: seconds, 0 means no countdown display
link String Card redirect link, includes http://等协议头
pushEndTime Long Push end time, 13-digit timestamp
createdTime Long Creation time, 13-digit timestamp
lastModified Long Modification time, 13-digit timestamp
pushStatus String Push status
Y: Pushing
N: Not pushed
L: Last push
pushTime Long Push time, 13-digit timestamp
enterEnabled String Card entry
Y: Enabled
N: Disabled
showCondition String Display method
PUSH: Display immediately after push
WATCH: Display after watching
conditionValue Integer Watch duration
conditionUnit String Watch duration unit
SECONDS: Seconds
MINUTES: Minutes
countdownMsg String Countdown message, effective when showCondition is WATCH, maximum 8 characters
linkEnabled String Card redirect toggle
Y: Enabled
N: Disabled
redirectType String Redirect method
iframe: Display within page
tab: Open new page
enterImage String Card entry image
cardImage String Card image

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download 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 for 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(getClass());
/**
 * 测试查询频道卡片推送
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void getChannelCardPush() 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/list";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", "2523307");
    
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    
    String response = HttpUtil.get(url,requestMap);
    
    log.info("测试查询频道卡片推送,返回值:{}", response);
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "f36c6ee6-354a-4a45-b7db-ffd002490604",
    "data": [
        {
            "id": 1141,
            "channelId": 2523307,
            "title": "aaa",
            "imageType": "redpack",
            "duration": 0,
            "link": "http://www.polyv.net",
            "pushEndTime": 1631095525000,
            "createdTime": 1631092742000,
            "lastModified": 1631095536000,
            "pushStatus": "N",
            "pushTime": 1631095525000,
            "enterEnabled": "Y",
            "showCondition": "PUSH",
            "conditionValue": 10,
            "conditionUnit": "MINUTES",
            "countdownMsg": ""
        },
        {
            "id": 1187,
            "channelId": 2523307,
            "title": "卡片推送",
            "imageType": "redpack",
            "duration": 10,
            "link": "http://www.polyv.net",
            "pushEndTime": 1632882522000,
            "createdTime": 1632882522000,
            "lastModified": null,
            "pushStatus": "N",
            "pushTime": null,
            "enterEnabled": "Y",
            "showCondition": "PUSH",
            "conditionValue": 20,
            "conditionUnit": "SECONDS",
            "countdownMsg": "测试8个字符"
        }
    ],
    "success": true
}

Error Example

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