1688關鍵字搜尋新品資料API介面(item_search_new-按關鍵字搜尋新品

API測試Cris發表於2023-04-06

1688關鍵字搜尋新品資料API介面(item_search_new-按關鍵字搜尋新品資料)程式碼介面教程如下:

     公共引數

名稱 型別 必須 描述
key String 是 呼叫key(必須以GET方式拼接在URL中)
secret String 是 呼叫金鑰(介面v=PNG_WNMN)
api_name String 是 API介面名稱(包括在請求地址中)[item_search,item_get,item_search_shop等]
cache String 否 [yes,no]預設yes,將呼叫快取的資料,速度比較快
result_type String 否 [json,jsonu,xml,serialize,var_export]返回資料格式,預設為json,jsonu輸出的內容中文可以直接閱讀
lang String 否 [cn,en,ru]翻譯語言,預設cn簡體中文
version String 否 API版本

請求引數

請求引數:q=衣服&page=1&sort=

引數說明:q:搜尋關鍵字
page:翻頁
sort:排序(normal綜合,va_rmdarkgmv30rt成交額,bid價格升序,_bid價格降序)


響應引數

Version: Date:

名稱 型別 必須 示例值 描述
items

items[] 0  按關鍵字搜尋商品
請求示例

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 預設請求引數已經URL編碼處理
 String url = "您自己的apiKey>&secret=<您自己的apiSecret>&q=衣服&page=1&sort=";
 JSONObject json = getRequestFromUrl(url);
 System.out.println(json.toString());
}

}
響應示例

{
"item": [
 {
  "title": "男裝2022夏季短袖情侶t恤男女同款時尚簡約休閒圓領T恤上衣服批發",
  "pic_url": "!!2213203691423-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "2000+",
  "num_iid": "669093370636",
  "seller_nick": "石獅市領川服裝廠",
  "tag_percent": "12.3%",
  "area": "泉州市",
  "sid": "b2b-221326973628972c61",
  "detail_url": "https://detail.1688.com/offer/669093370636.html"
 },
 {
  "title": "2022夏季新款印花短袖t恤女網紅同款衣服女韓版百搭中長款上衣女",
  "pic_url": "!!2744312196-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "1000+",
  "num_iid": "668773906932",
  "seller_nick": "普寧市洪陽戴紫妮服裝廠",
  "tag_percent": "17.3%",
  "area": "普寧市",
  "sid": "b2b-285040931583cf0",
  "detail_url": "https://detail.1688.com/offer/668773906932.html"
 },
 {
  "title": "抖音質量磨毛雙面德絨短袖t恤女立體卡通夏2022新款上衣大碼女裝",
  "pic_url": "!!2213014272705-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "200+",
  "num_iid": "670585170610",
  "seller_nick": "廣州克里貿易有限公司",
  "tag_percent": "9%",
  "area": "普寧市",
  "sid": "b2b-2213014272705d647f",
  "detail_url": "https://detail.1688.com/offer/670585170610.html"
 },
 {
  "title": "韓路女裝 2022春夏新款卡通印花短袖T恤女ins風純棉寬鬆潮流體恤",
  "pic_url": "!!3910967111-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "6萬+",
  "num_iid": "668912014686",
  "seller_nick": "瑞安市萌越貿易有限公司",
  "tag_percent": "17%",
  "area": "瑞安市",
  "sid": "b2b-391096711196312",
  "detail_url": "https://detail.1688.com/offer/668912014686.html"
 },
 {
  "title": "撞色條紋短袖針織衫女2022夏季新款休閒百搭別緻上衣ins顯瘦薄款",
  "pic_url": "!!2213249306997-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "1000+",
  "num_iid": "671716125800",
  "seller_nick": "廣州小仙妮子服裝廠",
  "tag_percent": "4.7%",
  "area": "廣州市",
  "sid": "b2b-2213249306997da12a",
  "detail_url": "https://detail.1688.com/offer/671716125800.html"
 },
 {
  "title": "夏新款潮流男女重磅250剋落肩半袖t恤供應學生班服寬鬆嘻哈街舞服",
  "pic_url": "!!2209929186043-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "2萬+",
  "num_iid": "670169572856",
  "seller_nick": "廣州旺者歸萊服裝有限公司",
  "tag_percent": "10.8%",
  "area": "廣州市",
  "sid": "b2b-22099291860439e3d0",
  "detail_url": "https://detail.1688.com/offer/670169572856.html"
 },
 {
  "title": "東南亞跨境全滌男士短袖T恤亞馬遜夏季新款短袖上衣時尚潮印花T恤",
  "pic_url": "!!2213760247545-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "1萬+",
  "num_iid": "671850915594",
  "seller_nick": "揭陽市衫少服飾有限公司",
  "tag_percent": "6.9%",
  "area": "揭陽市",
  "sid": "b2b-22137602475451e023",
  "detail_url": "https://detail.1688.com/offer/671850915594.html"
 },
 {
  "title": "韓路女裝 主推款純棉短袖T恤女2022春夏新品寬鬆潮流趣味印花體恤",
  "pic_url": "!!3910967111-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "24萬+",
  "num_iid": "668176444969",
  "seller_nick": "瑞安市萌越貿易有限公司",
  "tag_percent": "17%",
  "area": "瑞安市",
  "sid": "b2b-391096711196312",
  "detail_url": "https://detail.1688.com/offer/668176444969.html"
 },
 {
  "title": "男裝2022夏季短袖情侶t恤男女同款時尚簡約休閒圓領T恤上衣服批發",
  "pic_url": "!!2213203691423-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "3萬+",
  "num_iid": "668987018070",
  "seller_nick": "石獅市艾迪斯頓服裝廠",
  "tag_percent": "15.9%",
  "area": "泉州市",
  "sid": "b2b-22132036914233b9ff",
  "detail_url": "https://detail.1688.com/offer/668987018070.html"
 },
 {
  "title": "當季新品 趨勢熱賣",
  "pic_url": null,
  "promotion_price": null,
  "price": null,
  "sales": null,
  "num_iid": null,
  "seller_nick": null,
  "tag_percent": null,
  "area": null,
  "sid": null,
  "detail_url": "https://detail.1688.com/offer/.html"
 },
 {
  "title": "純棉t恤男2022夏季新款短袖T恤男圓領半袖寬鬆潮流衣服打底衫男",
  "pic_url": "!!2212492580258-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "1000+",
  "num_iid": "671351089756",
  "seller_nick": "汕頭市潮陽區銅盂詩美嘉服裝廠",
  "tag_percent": "8.3%",
  "area": "汕頭市",
  "sid": "b2b-2212492580258e6ac6",
  "detail_url": "https://detail.1688.com/offer/671351089756.html"
 },
 {
  "title": "中袖t恤女2022年新款女裝氣質polo領莫代爾半袖體恤撞色收腰上衣",
  "pic_url": "!!2242696184-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "3000+",
  "num_iid": "670971673377",
  "seller_nick": "廣州聲歌服飾有限公司",
  "tag_percent": "45.4%",
  "area": "廣州市",
  "sid": "b2b-2242696184",
  "detail_url": "https://detail.1688.com/offer/670971673377.html"
 },
 {
  "title": "潮邁克男士短袖T恤衣服潮牌潮流半袖男裝2022新款夏季修身體恤衫",
  "pic_url": "!!2212460019908-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "200+",
  "num_iid": "671819478208",
  "seller_nick": "石獅市祥志日用品商行",
  "tag_percent": "9.7%",
  "area": "",
  "sid": "b2b-22124600199086d3a0",
  "detail_url": "https://detail.1688.com/offer/671819478208.html"
 },
 {
  "title": "100%棉t恤短袖男修身潮流純色280g絲光棉男士半袖圓領上衣中青年",
  "pic_url": "!!2212372513093-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "7000+",
  "num_iid": "669931288096",
  "seller_nick": "桐鄉市梧桐輝諾服飾商行",
  "tag_percent": "16.3%",
  "area": "桐鄉市",
  "sid": "b2b-22123725130939dd36",
  "detail_url": "https://detail.1688.com/offer/669931288096.html"
 },
 {
  "title": "2022新款彈力直筒打底上衣五分袖小衫網紗立領印花T恤女裝夏季潮",
  "pic_url": "!!2260697315-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "400+",
  "num_iid": "671337941177",
  "seller_nick": "潮州市潮安區金石鎮駿龍製衣廠",
  "tag_percent": "39.7%",
  "area": "潮州市",
  "sid": "b2b-2260697315",
  "detail_url": "https://detail.1688.com/offer/671337941177.html"
 },
 {
  "title": "廠家直銷翻領冰絲短袖t恤男式商務休閒條紋寬鬆薄款Polo衫男裝潮",
  "pic_url": "!!2213204496089-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "700+",
  "num_iid": "669987872360",
  "seller_nick": "桐鄉市濮院柏梁服裝廠",
  "tag_percent": "19%",
  "area": "桐鄉市",
  "sid": "b2b-221320449608977b92",
  "detail_url": "https://detail.1688.com/offer/669987872360.html"
 },
 {
  "title": "現貨供應休閒日系短袖T恤男繡潮流日式繡花貼布圓領T恤男外貿衫",
  "pic_url": "!!2209917828085-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "300+",
  "num_iid": "670628937468",
  "seller_nick": "廣州市雲格服飾有限公司",
  "tag_percent": "35.1%",
  "area": "廣州市",
  "sid": "b2b-2209917828085ceab7",
  "detail_url": "https://detail.1688.com/offer/670628937468.html"
 },
 {
  "title": "TKPA高街頭復古美式oldschool做舊水洗徽章i短袖T恤男女ins國潮牌",
  "pic_url": "!!3344093974-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "600+",
  "num_iid": "670665770082",
  "seller_nick": "廣州悅享商貿有限公司",
  "tag_percent": "32.7%",
  "area": "廣州市",
  "sid": "b2b-334409397456d89",
  "detail_url": "https://detail.1688.com/offer/670665770082.html"
 },
 {
  "title": "中年男士T恤寬鬆爸爸夏裝短袖寬條紋夏季上衣服有口袋中",
  "pic_url": "!!2211188044513-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "500+",
  "num_iid": "671263051411",
  "seller_nick": "桐鄉市濮院弘夥服裝廠",
  "tag_percent": "18%",
  "area": "嘉興市",
  "sid": "b2b-2211129648221b6b4d",
  "detail_url": "https://detail.1688.com/offer/671263051411.html"
 },
 {
  "title": "2022夏季新款寬鬆T恤短款溫柔風上衣條紋冰絲針織衫女短袖",
  "pic_url": "!!2213769605033-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "700+",
  "num_iid": "671604715165",
  "seller_nick": "廣州覓婷閣服裝商行",
  "tag_percent": null,
  "area": "廣州市",
  "sid": "b2b-2213769605033305d4",
  "detail_url": "https://detail.1688.com/offer/671604715165.html"
 },
 {
  "title": "2022夏季新款五分袖t恤小清新連帽抽繩百搭休閒青少年套頭衫上衣",
  "pic_url": "!!2212454665249-0-cib.jpg",
  "promotion_price": null,
  "price": null,
  "sales": "1000+",
  "num_iid": "670454273152",
  "seller_nick": "石獅市崛夜雪鋒服裝廠",
  "tag_percent": "16.3%",
  "area": "石獅市",
  "sid": "b2b-2212454665249d3f37",
  "detail_url": "https://detail.1688.com/offer/670454273152.html"
 }
],
"data_from": "1688app",
"error": "",
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:19 max:11000",
"execution_time": "2.566",
"server_time": "Beijing/2022-04-15 15:33:41",
"client_ip": "106.6.33.38",
"call_args": [],
"api_type": "1688",
"translate_language": "zh-CN",
"translate_engine": "google_new",
"server_memory": "4.29MB",
"request_id": "gw-1.62591fd317826",
"last_id": "886371758"}

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70028219/viewspace-2944124/,如需轉載,請註明出處,否則將追究法律責任。

相關文章