Polyv Help Center

Help Center

Create Channel Card Push

Updated: 2025-11-03 18:26:29

API Description

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

API URL

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

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameters Description

Parameter Name Required Type Description
appId true String Account appId See details on obtaining keys
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 for generating the signature is critical for communication data security. It must never be saved 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
cardType false String Card type, common - normal card, qrCode - QR code, default: common
imageType true String Card style type
giftbox: Gift claim style
redpack: Red packet style
custom: Custom
weixinWork: WeCom
title true String Card title, maximum 16 characters
link true String Card redirect link, must include protocol header like http:// (used when hrefType=common)
duration true Integer Card countdown duration, values: 0,5,10,20,30, unit: seconds, 0 means no countdown display
durationPosition false String Card countdown display position, bottom - bottom, top - top right corner
showCondition true String Display method
PUSH: Display immediately after push
WATCH: Display after viewing
conditionValue false Integer Viewing duration for display after viewing, effective when showCondition is WATCH
conditionUnit false String Unit for viewing duration, effective and required when showCondition is WATCH
SECONDS: Seconds
MINUTES: Minutes
countdownMsg false String Countdown text, effective when showCondition is WATCH, maximum 8 characters
enterEnabled false String Card entry switch
Y: Enable
N: Disable
linkEnabled false String Card redirect switch
Y: Enable
N: Disable
redirectType false String Redirect method
iframe: Display within page
tab: Open new page
enterImage false String Card entry image
cardImage false String Card image
weixinWordQrCodeId false String WeCom channel code ID (effective when imageType=weixinWork)
qrCodeImage false String QR code image (effective when cardType=qrCode)
hrefType false String Redirect type, common - normal (uses link field), multiplatform - multi-platform (uses multi-platform link fields)
The following parameters are effective when hrefType=multiplatform
pcLink false String Computer browser link
mobileLink false String Mobile browser link
wxMiniprogramOriginalId false String WeChat Mini Program original ID
wxMiniprogramAppId false String WeChat Mini Program appId
wxMiniprogramLink false String WeChat Mini Program page path
mobileAppLink false String Mobile app link

Example

http://api.polyv.net/live/v4/channel/card-push/create?duration=10&showCondition=PUSH&countdownMsg=%E6%B5%8B%E8%AF%958%E4%B8%AA%E5%AD%97%E7%AC%A6%E6%88%90%E5%8A%9F&appId=frlr1zazn3&link=http%3A%2F%2Fwww.polyv.net&sign=7C51748CDDE6CE707031B3B9F75F8E0D&conditionValue=20&enterEnabled=Y&title=%E5%8D%A1%E7%89%87%E6%8E%A8%E9%80%81&imageType=redpack&channelId=2523307&timestamp=1632882516916

Response Parameters Description

Parameter Name 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 upon successful creation 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, for troubleshooting and debugging only, should not be tied to business logic

Error Parameter Description

Parameter Name Type Description
code Integer Error code, used to identify the specific error
desc String Error description, corresponds to error.code

Data Parameter Description

Parameter Name Type Description
id Long Card push ID
channelId Integer Channel ID
title String Card title, maximum 16 characters
cardType String Card type, common - normal card, qrCode - QR code
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
durationPosition String Card countdown display position, bottom - bottom, top - top right corner
link String Card redirect link, includes http://等协议头
pushEndTime Long Push end time, 13-digit timestamp
createdTime Long Creation time, 13-digit timestamp
lastModified Long Last modified 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: Enable
N: Disable
showCondition String Display method
PUSH: Display immediately after push
WATCH: Display after viewing
conditionValue Integer Viewing duration
conditionUnit String Viewing duration unit
SECONDS: Seconds
MINUTE: Minutes
countdownMsg String Countdown text, effective when showCondition is WATCH, maximum 8 characters
linkEnabled String Card redirect switch
Y: Enable
N: Disable
redirectType String Redirect method
iframe: Display within page
tab: Open new page
enterImage String Card entry image
cardImage String Card image
weixinWordQrCodeId String WeCom channel code ID
weixinwordQrCodeName String WeCom channel code name
qrCodeImage String QR code image
hrefType String Redirect type, common - normal, multiplatform - multi-platform
pcLink String Computer browser link
mobileLink String Mobile browser link
wxMiniprogramOriginalId String WeChat Mini Program original ID
wxMiniprogramAppId String WeChat Mini Program appId
wxMiniprogramLink String WeChat Mini Program page path
mobileAppLink String Mobile app link

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 from the test cases 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 packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

    /**
     * 测试创建频道卡片推送
     * @throws IOException
     * @throws NoSuchAlgorithmException
     */
    @Test
    public void testCreateChannelCardPush() 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/create";
    
        //http 调用逻辑
        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("channelId", "2523307");
        
        requestMap.put("imageType", "redpack");
        requestMap.put("title", "卡片推送");
        requestMap.put("link", "http://www.polyv.net");
        requestMap.put("duration", "10");
        requestMap.put("showCondition", "PUSH");
        requestMap.put("conditionValue", "20");
        requestMap.put("countdownMsg", "测试8个字符成功");
        requestMap.put("enterEnabled", "Y");
    
        requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    
        String response = HttpUtil.get(url,requestMap);
    
        log.info("测试创建频道卡片推送成功,返回值:{}", response);
    }

Response Example

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "3118812d-f657-409b-b149-631f6799f7d1",
    "data": {
        "id": 1187,
        "channelId": 2523307,
        "title": "卡片推送",
        "imageType": "redpack",
        "duration": 10,
        "link": "http://www.polyv.net",
        "pushEndTime": 1632882522413,
        "createdTime": 1632882522416,
        "lastModified": null,
        "pushStatus": "N",
        "pushTime": null,
        "enterEnabled": "Y",
        "showCondition": "PUSH",
        "conditionValue": 20,
        "conditionUnit": null,
        "countdownMsg": "测试8个字符成功",
        "linkEnabled": "Y",
        "cardType": "common",
        "hrefType": "common",
        "pcLink": null,
        "mobileLink": null,
        "wxMiniprogramOriginalId": "xxx",
        "wxMiniprogramAppId": "xxx",
        "wxMiniprogramLink": "xxx",
        "durationPosition": null,
        "mobileAppLink": null
    },
    "success": true
}

Error Example

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