淘宝/天猫页面整体数据
taobao.item_get-获得淘宝商品详情
公共参数
名称 | 类型 | 必须 | 描述 |
---|---|---|---|
key | String | 是 | 调用key(必须以GET方式拼接在URL中)注册key和secret接入 |
secret | String | 是 | 调用密钥 |
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版本 |
请求参数
请求参数:num_iid=720950146491&is_promotion=1
参数说明:num_iid:淘宝商品ID
is_promotion:是否获取取促销价
请求示例
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 = "https://taobao/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=652874751412&is_promotion=1";
JSONObject json = getRequestFromUrl(url);
System.out.println(json.toString());
}
}
响应示例
{
"item": {
"num_iid": "720950146491",
"title": "复古撞色设计感牛仔短裤女2023夏季薄款a字高腰宽松显瘦辣妹热裤",
"desc_short": "",
"price": "118",
"total_price": 0,
"suggestive_price": 0,
"orginal_price": "188.00",
"nick": "周洛希旗舰店",
"num": "200",
"min_num": 0,
"detail_url": "https://item.taobao.com/item.htm?id=720950146491",
"pic_url": "//img.alicdn.com/imgextra/i3/2213739840661/O1CN01DvaQa31Gkme0kkn2Z_!!0-item_pic.jpg",
"brand": "周洛希",
"brandId": "19083442311",
"rootCatId": "16",
"cid": "162205",
"crumbs": [],
"created_time": "",
"modified_time": "",
"delist_time": "",
"desc": "",
"desc_img": [],
"item_imgs": [
{
"url": "https://img.alicdn.com/imgextra/i4/2213739840661/O1CN01HVLfEo1GkmdrKozES_!!2213739840661.jpg"
},
{
"url": "https://img.alicdn.com/imgextra/i3/2213739840661/O1CN01g9iknD1GkmdxaJ3H5_!!2213739840661.jpg"
},
{
"url": "https://img.alicdn.com/imgextra/i4/2213739840661/O1CN01QLIKmP1GkmdlONIjd_!!2213739840661.jpg"
},
{
"url": "https://img.alicdn.com/imgextra/i2/2213739840661/O1CN01izYUMZ1Gkme0jcu6t_!!2213739840661.jpg"
},
{
"url": "https://img.alicdn.com/imgextra/i2/2213739840661/O1CN01KFwLue1GkmdvSAIcC_!!2213739840661.jpg"
}
],
"item_weight": "",
"item_size": "",
"location": "广东广州",
"post_fee": 0,
"express_fee": null,
"ems_fee": "",
"shipping_to": "",
"has_discount": "true",
"video": {
"url": "https://cloud.video.taobao.com/play/u/2213739840661/p/2/e/6/t/1/411415856461.mp4?appKey=38829"
},
"is_virtual": "",
"sample_id": "",
"is_promotion": "true",
"props_name": "20518:28313:尺寸:XS 【75-88斤】;20518:28314:尺寸:S 【89-98斤】;20518:28315:尺寸:M 【99-109斤】;20518:28316:尺寸:L 【110-119斤】;20518:28317:尺寸:XL 【120-135斤】;20518:6145171:尺寸:2XL 【136-145斤】;1627207:16639813:颜色分类:复古蓝",
"prop_imgs": {
"prop_img": [
{
"properties": "1627207:16639813",
"url": "//img.alicdn.com/imgextra/i3/2213739840661/O1CN01mlUNth1GkmdvmD5qn_!!2213739840661.jpg"
}
]
},
"property_alias": "",
"props": [
{
"name": "品牌",
"value": "周洛希"
},
{
"name": "尺寸",
"value": "XS S M L XL 2XL"
},
{
"name": "面料分类",
"value": "牛仔布"
},
{
"name": "腰型",
"value": "高腰"
},
{
"name": "颜色分类",
"value": "复古蓝"
},
{
"name": "裤门襟",
"value": "拉链"
},
{
"name": "货号",
"value": "ZLX1270-20230527"
},
{
"name": "成分含量",
"value": "91%(含)-95%(含)"
},
{
"name": "适用季节",
"value": "夏季"
},
{
"name": "年份季节",
"value": "2023年夏季"
},
{
"name": "厚薄",
"value": "薄款"
},
{
"name": "裤长",
"value": "短裤"
},
{
"name": "款式",
"value": "短裤"
},
{
"name": "颜色",
"value": "牛仔蓝"
},
{
"name": "面料功能",
"value": "抗皱"
},
{
"name": "销售渠道类型",
"value": "纯电商(只在线上销售)"
},
{
"name": "材质成分",
"value": "棉91% 聚酯纤维5% 粘胶纤维(粘纤)4%"
}
],
"total_sold": "46",
"skus": {
"sku": [
{
"price": "118",
"total_price": 0,
"orginal_price": "118",
"properties": "20518:28313;1627207:16639813",
"properties_name": "20518:28313:尺寸:XS 【75-88斤】;1627207:16639813:颜色分类:复古蓝",
"quantity": "200",
"sku_id": "5189706502593"
},
{
"price": "118",
"total_price": 0,
"orginal_price": "118",
"properties": "20518:28314;1627207:16639813",
"properties_name": "20518:28314:尺寸:S 【89-98斤】;1627207:16639813:颜色分类:复古蓝",
"quantity": "200",
"sku_id": "5189706502594"
},
{
"price": "118",
"total_price": 0,
"orginal_price": "118",
"properties": "20518:28315;1627207:16639813",
"properties_name": "20518:28315:尺寸:M 【99-109斤】;1627207:16639813:颜色分类:复古蓝",
"quantity": "200",
"sku_id": "5189706502595"
},
{
"price": "118",
"total_price": 0,
"orginal_price": "118",
"properties": "20518:28316;1627207:16639813",
"properties_name": "20518:28316:尺寸:L 【110-119斤】;1627207:16639813:颜色分类:复古蓝",
"quantity": "200",
"sku_id": "5189706502596"
},
{
"price": "118",
"total_price": 0,
"orginal_price": "118",
"properties": "20518:28317;1627207:16639813",
"properties_name": "20518:28317:尺寸:XL 【120-135斤】;1627207:16639813:颜色分类:复古蓝",
"quantity": "200",
"sku_id": "5189706502597"
},
{
"price": "118",
"total_price": 0,
"orginal_price": "118",
"properties": "20518:6145171;1627207:16639813",
"properties_name": "20518:6145171:尺寸:2XL 【136-145斤】;1627207:16639813:颜色分类:复古蓝",
"quantity": "200",
"sku_id": "5189706502598"
}
]
},
"seller_id": "2213739840661",
"sales": 300,
"shop_id": "419823968",
"props_list": {
"20518:28313": "尺寸:XS 【75-88斤】",
"20518:28314": "尺寸:S 【89-98斤】",
"20518:28315": "尺寸:M 【99-109斤】",
"20518:28316": "尺寸:L 【110-119斤】",
"20518:28317": "尺寸:XL 【120-135斤】",
"20518:6145171": "尺寸:2XL 【136-145斤】",
"1627207:16639813": "颜色分类:复古蓝"
},
"seller_info": {
"nick": "周洛希旗舰店",
"item_score": "4.8 ",
"score_p": "4.8 ",
"delivery_score": "4.8 ",
"shop_type": "B",
"user_num_id": "2213739840661",
"sid": "419823968",
"title": "周洛希旗舰店",
"zhuy": "https://shop419823968.taobao.com/",
"shop_name": "周洛希旗舰店"
},
"tmall": true,
"error": "",
"warning": "",
"url_log": [],
"fav_count": "410",
"fans_count": "2.6万",
"freight": "快递: 免运费",
"props_imgs": {
"prop_img": [
{
"properties": "1627207:16639813",
"url": "//img.alicdn.com/imgextra/i3/2213739840661/O1CN01mlUNth1GkmdvmD5qn_!!2213739840661.jpg"
}
]
},
"_ddf": "xdl",
"promo_type": null,
"props_img": {
"1627207:16639813": "//img.alicdn.com/imgextra/i3/2213739840661/O1CN01mlUNth1GkmdvmD5qn_!!2213739840661.jpg"
},
"format_check": "ok",
"shop_item": [],
"relate_items": []
},
"error": "",
"secache": "e93241f6b46f26d1899903381a48f0fe",
"secache_time": 1689237406,
"secache_date": "2023-07-13 16:36:46",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:227 max:10100 all[967=227+47+693];expires:2030-12-31",
"execution_time": "6.899",
"server_time": "Beijing/2023-07-13 16:36:46",
"client_ip": "182.108.169.91",
"call_args": {
"num_iid": "720950146491",
"is_promotion": "1"
},
"api_type": "taobao",
"translate_language": "zh-CN",
"translate_engine": "baidu",
"server_memory": "6.08MB",
"request_id": "gw-1.64afb797af4e6",
"last_id": "1869883289"
}