獲取直播帶貨商品列表資訊接口
更新時間: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);
}
