获取直播带货商品列表信息接口
更新时间:2022-09-02 18:08:07
接口URL
http://api.polyv.net/live/v3/channel/product/getListByRank
接口说明
1、通过频道号和排序号获取排序号之后的上架商品列表
2、不传排序号获取最前面的上架商品列表
2、接口支持https
支持格式
JSON
请求方式
GET
请求数限制
TRUE
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
| timestamp | 是 | long | 当前13位毫秒级时间戳,3分钟内有效 |
| sign | 是 | String | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则】 |
| channelId | 是 | int | 频道号 |
| rank | 否 | int | 排序号 |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"total": 1,
"content": [
{
"productId": 2128,
"userId": "ee7fe7fbda",
"channelId": 1779741,
"name": "goods01",
"price": null,
"cover": "//liveimages.videocc.net/uploadimage/20200707/chat_img_1779741_15941158896246.png?x-oss-process=image/crop,x_142,y_142,w_355,h_355",
"link": "http://www.msuno.cn",
"status": 1,
"createdTime": 1594115895000,
"lastModified": 1597388856000,
"rank": 11,
"realPrice": 12.98,
"type": "live",
"linkType": 10,
"pcLink": "",
"mobileLink": "",
"wxMiniprogramLink": "",
"wxMiniprogramOriginalId": ""
}
]
}
}
响应失败JSON示例:
未输入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正确
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
时间戳错误
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
字段说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | int | 响应代码,成功为200,失败为400,签名错误为401,异常错误500 |
| status | string | 成功为success,失败为error |
| message | string | 错误时为错误提示消息 |
| data | object | 响应结果集 |
| total | int | 总上架商品数量 |
| content | array | 商品列表 |
| productId | int | 商品唯一Id |
| userId | int | 用户userId |
| channelId | int | 频道号 |
| name | int | 商品名称 |
| price | int | 商品价格 |
| cover | int | 商品图片 |
| link | int | 商品通用跳转链接 |
| status | int | 商品状态,上架:1,只返回上架状态 |
| createdTime | int | 创建时间 |
| lastModified | int | 修改时间 |
| rank | int | 商品排序号 |
| realPrice | int | 商品真实价格 |
| type | int | 商品类型,live:直播后台商品 |
| linkType | int | 商品跳转类型,10:通用跳转,11:多平台跳转 |
| pcLink | int | pc端商品跳转链接 |
| mobileLink | int | 手机端商品跳转链接 |
| wxMiniprogramLink | int | wx商品跳转链接 |
| wxMiniprogramOriginalId | int | wx商品跳转链接中的原id |
Java请求示例
public static void main(String[] args) {
String url = "http://api.polyv.net/live/v3/channel/product/getListByRank";
// 用户对应的appId和加密串
String appId = "xxxxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
Map<String, String> params = new HashMap<>();
param.put("channelId", "0000000");
PolyvTool.setLiveSign(params, appId, appSecret);
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance()
.sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
System.out.println(content);
}
