?
1688API接口是阿里巴巴集團推出的一種開放平臺,提供了豐富的數(shù)據(jù)接口、轉(zhuǎn)換工具以及開發(fā)資源,為開發(fā)者提供了通用的應(yīng)用接口及大量數(shù)據(jù)資源,支持開發(fā)者在1688上進行商品搜索、訂單管理、交易報表及物流等方面的操作。
1688API接口主要包含以下幾類:
商品API:提供商品搜索、商品詳情、商品發(fā)布等接口。
訂單API:提供訂單查詢、訂單狀態(tài)更新、訂單創(chuàng)建等接口。
物流API:提供物流信息查詢、物流訂單查詢等接口。
用戶API:提供用戶信息查詢、用戶認(rèn)證等接口。
數(shù)據(jù)API:提供交易報表、商品統(tǒng)計等接口。
開發(fā)者可基于1688API接口打造自己的在線商城、批發(fā)平臺及電商應(yīng)用等,實現(xiàn)企業(yè)信息化、資源共享、創(chuàng)新發(fā)展等目標(biāo)。
item_get-獲得1688商品詳情
公共參數(shù)
名稱 | 類型 | 必須 | 描述 |
---|---|---|---|
key | String | 是 | 調(diào)用key(必須以GET方式拼接在URL中) |
secret | String | 是 | 調(diào)用密鑰 |
api_name | String | 是 | API接口名稱(包括在請求地址中)[item_search,item_get,item_search_shop等] |
cache | String | 否 | [yes,no]默認(rèn)yes,將調(diào)用緩存的數(shù)據(jù),速度比較快 |
result_type | String | 否 | [json,jsonu,xml,serialize,var_export]返回數(shù)據(jù)格式,默認(rèn)為json,jsonu輸出的內(nèi)容中文可以直接閱讀 |
lang | String | 否 | [cn,en,ru]翻譯語言,默認(rèn)cn簡體中文 |
version | String | 否 | API版本 |
請求參數(shù)
請求參數(shù):num_iid=610947572360
參數(shù)說明:num_iid:1688商品ID
sales_data:&sales_data=1 獲取近30天成交數(shù)據(jù)
agent:&agent=1 獲取1688分銷代發(fā)價格數(shù)據(jù)
請求示例(Curl PHP PHPsdk JAVA C# Python Golang javascript JS-SDK Ruby Swift Objective-C C C++ Node.JS Kotlin Rust R MATLAB ??)
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.PrintWriter;
import java.net.URLConnection;
public class Example {
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.print(body);
out.flush();
InputStream instream = conn.getInputStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
instream.close();
}
}
public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
InputStream instream = conn.getInputStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
instream.close();
}
}
public static void main(String[] args) throws IOException, JSONException {
// 請求示例 url 默認(rèn)請求參數(shù)已經(jīng)URL編碼處理
String url = "https://api-gw.onebound.cn/1688/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=610947572360";
JSONObject json = getRequestFromUrl(url);
System.out.println(json.toString());
}
}
響應(yīng)參數(shù)
Version: Date:
名稱 | 類型 | 必須 | 示例值 | 描述 |
---|---|---|---|---|
item |
item[] | 0 | 寶貝詳情數(shù)據(jù) | |
num_iid |
String | 0 | 610947572360 | 寶貝ID |
title |
String | 0 | 廠家直銷小米有品Qin2 Pro智能手機學(xué)生機老人機備用機小愛同學(xué)4G | 商品標(biāo)題 |
desc_short |
String | 0 | 商品簡介 | |
price |
Float | 0 | 799.00 | 價格 |
total_price |
Float | 0 | 0 | |
suggestive_price |
Float | 0 | 0 | |
orginal_price |
Float | 0 | 799.00 | 原價 |
nick |
String | 0 | qin多親科技 | 賣家昵稱 |
num |
Int | 0 | 2191 | |
detail_url |
String | 0 | https://detail.1688.com/offer/610947572360.html | 寶貝鏈接 |
pic_url |
String | 0 | https://cbu01.alicdn.com/img/ibank/2020/063/830/13235038360_979836901.jpg | 寶貝圖片 |
brand |
String | 0 | MAJE | 品牌 |
brandId |
Int | 0 | 8879363 | 品牌id |
rootCatId |
Int | 0 | 0 | 頂級分類ID |
cid |
Int | 0 | 124264005 | |
desc |
String | 0 | ||
item_imgs |
Mix | 0 | item_imgs[] | 商品圖片 |
item_weight |
String | 0 | ||
post_fee |
Float | 0 | 9.00 | 郵費 |
express_fee |
Float | 0 | 9.00 | EMS費用 |
ems_fee |
Float | 0 | 9.00 | 物流費用 |
shipping_to |
String | 0 | 廣東廣州白云區(qū) | 發(fā)貨至 |
video |
video[] | 0 | 商品視頻 | |
sample_id |
String | 0 | ||
props_name |
String | 0 | 0:0:機身內(nèi)存:64GB;1:0:顏色:鐵灰色;1:1:顏色:瓷白色 | 商品屬性名 |
prop_imgs |
prop_imgs[] | 0 | 商品屬性圖片列表 | |
property_alias |
String | 0 | 0:0:64GB;1:0:鐵灰色;1:1:瓷白色 | 屬性別名 |
props |
Mix | 0 | [{"name": "品牌", "value": "other"}] | 商品詳情 |
total_sold |
Int | 0 | 1 | |
scale |
Int | 0 | ||
sellUnit |
Int | 0 | ||
skus |
skus[] | 0 | 商品規(guī)格信息列表 | |
seller_id |
Int | 0 | 2206619673102 | 賣家ID |
sales |
Int | 0 | 100 | 銷售額 |
shop_id |
Int | 0 | 151372205 | 店鋪ID |
props_list |
Mix | 0 | {"0:0": "機身內(nèi)存:64GB"} | 商品屬性 |
seller_info |
seller_info[] | 0 | 賣家信息 | |
tmall |
Boolean | 0 | false | 是否天貓 |
data_from |
String | 0 | 1688app | 錯誤信息 |
error |
String | 0 | 錯誤信息 | |
unit |
String | 0 | 部; | 單位 |
is_support_mix |
Boolean | 0 | true | |
mix_amount |
Int | 0 | 30 | |
mix_Begin |
Int | 0 | ||
mix_number |
Int | 0 | ||
sales_data |
Date | 0 | ||
location |
String | 0 | 廣東省 深圳市 | 發(fā)貨地 |
props_img |
Mix | 0 | 屬性圖片 | |
sales_info |
Mix | 0 | ||
desc_img |
Mix | 0 | [{"https://cbu01.alicdn.com/img/ibank/2020/560/807/14112708065_979836901.jpg"}] | 詳情圖片列表 |
shop_item文章來源:http://www.zghlxwxcb.cn/news/detail-590475.html |
Mix | 0 | ||
relate_items文章來源地址http://www.zghlxwxcb.cn/news/detail-590475.html |
Mix | 0 |
到了這里,關(guān)于Python爬蟲學(xué)習(xí)筆記:1688商品詳情API 開發(fā)API接口文檔的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!