金融保險網(wǎng)站模板網(wǎng)絡(luò)廣告類型
接口概述
義烏購平臺提供RESTful風(fēng)格的店鋪商品查詢接口,支持獲取指定店鋪下的所有商品信息,包括商品基礎(chǔ)信息、價格、庫存等數(shù)據(jù)。
點擊獲取key和secret
接口地址
https://api.yiwugo.com/store/products
請求方法
GET
請求參數(shù)
參數(shù)名類型必填說明store_idstring是店鋪IDpageint否分頁頁碼(默認1)page_sizeint否每頁數(shù)量(默認20,最大100)access_tokenstring是授權(quán)令牌
返回示例
{"code": 200,"data": {"products": [{"product_id": "P10086","name": "創(chuàng)意文具套裝","price": 15.8,"stock": 500,"images": ["https://xxx.com/img1.jpg"],"specs": {"color":["紅","藍"],"size":["S","M"]}}],"total": 1,"current_page": 1}
}
錯誤碼
-
400: 參數(shù)錯誤
-
401: 認證失敗
-
404: 店鋪不存在
-
500: 服務(wù)器錯誤
Java調(diào)用示例
public class YiwuProductApi {private static final String API_URL = "https://api.yiwugo.com/store/products";public static JSONObject getStoreProducts(String storeId, String token) throws IOException {HttpGet request = new HttpGet(API_URL + "?store_id=" + storeId + "&access_token=" + token);try (CloseableHttpResponse response = HttpClients.createDefault().execute(request)) {String json = EntityUtils.toString(response.getEntity());return new JSONObject(json);}}
}
Python調(diào)用示例
import requestsdef get_store_products(store_id, token):params = {'store_id': store_id,'access_token': token}response = requests.get('https://api.yiwugo.com/store/products', params=params)return response.json()
注意事項
-
需要提前申請開發(fā)者賬號獲取access_token
-
高頻調(diào)用需遵守限流規(guī)則(100次/分鐘)
-
商品數(shù)據(jù)緩存建議不超過1小時
-
敏感字段需做脫敏處理