获取单个商品详细信息
获取单个商品的全部信息
1.请求参数:
请求URL:
参数名 | 类型 | 说明 | 示例 |
---|---|---|---|
appid | String | 合作伙伴AppId | uwkahf@jfs92 |
timestamp | String | 当前时间戳 | |
tb_seller_nick | String | 淘宝卖家店铺登录账号,非店铺名称 | kingdo |
sign | String | 接口签名 | 如何计算生成见示例代码 |
fields | String | 必填, 需返回的字段列表。可选值: 需要返回的商品字段列表。可选值:Item商品结构体中所有字段均可返回,多个字段用“,”分隔。 | |
num_iid | number | 必填 , 商品数字ID |
2. 请求示例代码(Java)
@Test
public void getItemDetail() throws Exception {
String tb_seller_nick = Config.TBSellerNick ;
//业务参数
Map<String, String> data = new HashMap<String, String>();
data.put("appid", Config.AppId);
data.put("tb_seller_nick", tb_seller_nick);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
// 需要获取的商品字段,更多字段见第4节返回字段说明。
String defaultFields = "num_iid,title,nick,price,approve_status,sku,num,list_time,delist_time,stuff_status,price,post_fee,express_fee,ems_fee,auction_point,skus,item_img,prop_img," +
"barcode,created,features" ;
data.put("fields", defaultFields);
data.put("num_iid", "544876335798");
// 签名
data.put("sign", Utils.Sign(data,Config.AppSecret));
// 调用服务API
doHttpRequest(Config.TaoBaoItemDetailUrl ,data);
}
3. 返回结果如下:
返回的商品字段取决于请求时的fields字段,下面是部分商品字段。
{
"code": 0,
"message": "ok",
"data": {
"item": {
"approve_status": "onsale",
"auction_point": 0,
"created": "2017-02-09 11:34:20",
"delist_time": "2020-12-26 23:56:13",
"ems_fee": "0.00",
"express_fee": "0.00",
"features": "tags:104514,426754,1797506",
"item_imgs": {},
"list_time": "2020-12-19 23:56:13",
"newprepay": "default",
"nick": "百鞋馆",
"num": 4285,
"num_iid": 544876335798,
"post_fee": "0.00",
"price": "1.50",
"skus": {
"sku": [
{
"created": "2018-09-11 18:28:43",
"modified": "2019-09-20 14:38:55",
"outer_id": "red35",
"price": "0.50",
"properties": "-3:-7;-4:-8",
"properties_name": "-3:-7:尺码:35;-4:-8:颜色:red",
"quantity": 0,
"sku_id": 3977338583164
},
{
"created": "2018-09-11 18:28:43",
"modified": "2019-09-20 14:14:50",
"outer_id": "white35",
"price": "1.50",
"properties": "-3:-7;-4:-9",
"properties_name": "-3:-7:尺码:35;-4:-9:颜色:white",
"quantity": 15,
"sku_id": 3977338583166
},
{
"created": "2018-09-11 18:28:43",
"modified": "2019-07-05 17:12:49",
"outer_id": "red36",
"price": "5.00",
"properties": "-3:-10;-4:-8",
"properties_name": "-3:-10:尺码:36;-4:-8:颜色:red",
"quantity": 40,
"sku_id": 3977338583163
},
{
"created": "2018-09-11 18:28:43",
"modified": "2019-07-05 17:12:49",
"outer_id": "white36",
"price": "5.00",
"properties": "-3:-10;-4:-9",
"properties_name": "-3:-10:尺码:36;-4:-9:颜色:white",
"quantity": 4230,
"sku_id": 3977338583165
}
]
},
"stuff_status": "new",
"title": "联华超市提取货券xx"
},
"request_id": "11gh3rhk0sted"
}
}
说明: code为0表示成功,非0为失败,message会包含失败原因。
4. 返回字段说明
返回的商品字段取决于请求时的fields字段,下面是部分商品字段,详细字段可见淘宝文档
文档更新时间: 2023-04-14 22:19 作者:admin