Modify Channel Card Push
API Description
1、修改频道卡片推送,对应新版后台的 营销-卡片
2、接口支持https协议
API URL
http://api.polyv.net/live/v4/channel/card-push/update
Request Method
POST
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
Optional request parameters use default values if not provided, except for related fields (e.g., the conditionUnit field is required when showCondition is WATCH).
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details on obtaining keys |
| 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 never be used directly on the client side. All APIs must be called through your 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 |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| cardType | false | String | Card type: common - normal card, qrCode - QR code. Default: common |
| imageType | false | String | Card style type giftbox: Gift box style redpack: Red packet style custom: Custom weixinWork: WeCom |
| title | false | String | Card title, maximum 16 characters |
| link | false | String | Card redirect link URL, must include protocol header like http: (used when hrefType=common) |
| duration | false | Integer | Card countdown duration. Values: 0, 5, 10, 20, 30. Unit: seconds. 0 means no countdown display |
| durationPosition | false | String | Countdown display position: bottom - bottom, top - top right |
| showCondition | false | String | Display method PUSH: Display immediately after push WATCH: Display after viewing |
| conditionValue | false | Integer | Viewing duration to trigger display. Effective when showCondition is WATCH |
| conditionUnit | false | String | Unit for viewing duration to trigger display SECONDS: Seconds MINUTES: Minutes Required and effective when showCondition is WATCH |
| countdownMsg | false | String | Countdown message. Effective when showCondition is WATCH. Maximum 8 characters |
| enterEnabled | false | String | Card entry toggle Y: Enable N: Disable |
| linkEnabled | false | String | Card redirect toggle 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/update?cardPushId=1282&appId=frlr1zazn3&sign=72F9A8F43AA957F17A8A5CDDB7DC6BA3&channelId=2477096×tamp=1634268781984
Request body parameters:
{
"duration": "10",
"conditionUnit": "SECONDS",
"showCondition": "WATCH",
"countdownMsg": "测试8个字符成功",
"link": "http://www.polyv.net",
"conditionValue": "30",
"enterEnabled": "Y",
"title": "测试卡片推送1015",
"imageType": "giftbox",
"linkEnabled": "Y"
}
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 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. For debugging and troubleshooting only, not for business logic |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code for identifying the specific error cause |
| desc | String | Error description, corresponding to error.code |
Java Request Example
For quick integration of basic code, download the relevant dependency source code. Click to download source code. After downloading, add it to your own source code project. The HttpUtil.java and LiveSignUtil.java in the test cases are included in the download 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 pooling.
/**
* 测试修改频道卡片推送
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testUpdateChannelCardPush() 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/update";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", "2477096");
requestMap.put("cardPushId", "1282");
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("imageType", "giftbox");
jsonMap.put("title", "测试卡片推送1015");
jsonMap.put("link", "http://www.polyv.net");
jsonMap.put("duration", "10");
jsonMap.put("showCondition", "WATCH");
jsonMap.put("conditionValue", "30");
jsonMap.put("conditionUnit", "SECONDS");
jsonMap.put("countdownMsg", "测试8个字符成功");
jsonMap.put("enterEnabled", "Y");
jsonMap.put("linkEnabled", "Y");
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试修改频道卡片推送成功,返回值:{}", response);
}
Response Example
Success example
{
"code": 200,
"status": "success",
"requestId": "847f0716fa76461baf8979aaa4415dc3.65.16342687861804037",
"data": null,
"success": true
}
Error example
{
"code": 400,
"status": "error",
"requestId": "4081dbac03e6441e8bdd301d8feee5a2.117.16360830583026105",
"error": {
"code": 30004,
"desc": "找不到频道"
},
"success": false
}
