查询频道卡片推送
更新时间:2023-10-11 15:57:19
接口描述
1、查询频道卡片推送,对应新版后台的 营销-卡片
2、接口支持https协议
接口URL
http://api.polyv.net/live/v4/channel/card-push/list
请求方式
GET
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | true | String | 账号appId【详见获取密钥】 |
| timestamp | true | Long | 当前13位毫秒级时间戳,3分钟内有效 |
| sign | true | String | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则】 |
| channelId | true | String | 频道ID |
示例
http://api.polyv.net/live/v4/channel/card-push/list?appId=frlr1zazn3&sign=56C7EFE6CFA7A76CA3AAB272CABAC22F&channelId=2523307×tamp=1632994650498
响应参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | Integer | 响应状态码,200为成功返回,非200为失败 |
| status | String | 响应结果,由业务决定,成功返回success,失败返回error |
| success | Boolean | 响应结果,由业务决定,成功返回true,失败返回false |
| data | Object | 成功响应时返回创建成功的卡片信息【详见Data字段说明】 |
| error | Object | 状态码非200时的错误信息【详见Error字段说明】 |
| requestId | String | 请求ID,每次请求生成的唯一的 UUID,仅可用于排查、调试,不应该和业务挂上钩 |
data参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| element | ChannelCardPushVO | 【详见element字段说明】 |
Error参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | Integer | 错误代码,用于确定具体的错误原因 |
| desc | String | 错误描述,与 error.code 对应 |
element参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| id | Long | 卡片推送ID |
| channelId | Integer | 频道ID |
| title | String | 卡片标题,最多16个字符 |
| imageType | String | 卡片样式类型 giftbox:礼物领取样式 redpack:红包样式 custom:自定义 |
| duration | Integer | 卡片倒计时时长,取值:0,5,10,20,30,单位:秒,0为不显示倒计时时长 |
| link | String | 卡片跳转链接地址,带http://等协议头 |
| pushEndTime | Long | 推送结束时间,13位时间戳 |
| createdTime | Long | 创建时间,13位时间戳 |
| lastModified | Long | 修改时间,13位时间戳 |
| pushStatus | String | 推送状态 Y:推送中 N:未推送 L:上次推送 |
| pushTime | Long | 推送时间,13位时间戳 |
| enterEnabled | String | 卡片入口 Y:开启 N:关闭 |
| showCondition | String | 弹出方式 PUSH:推送后立即弹出 WATCH:观看后弹出 |
| conditionValue | Integer | 观看时长 |
| conditionUnit | String | 观看时长单位 SECONDS:秒 MINUTES:分钟 |
| countdownMsg | String | 倒计时文案,showCondition为WATCH时生效,最多8个字符 |
| linkEnabled | String | 卡片跳转开关 Y:开启 N:关闭 |
| redirectType | String | 跳转方式 iframe:页内显示 tab:新开页面 |
| enterImage | String | 卡片入口图片 |
| cardImage | String | 卡片图片 |
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
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);
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"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
}
异常示例
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360829427963481",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
