要使用虾皮API接口根据商品ID获取商品详情,您需要执行以下步骤:
获取API凭证:在虾皮开放平台或API文档页面获取您的API凭证(访问令牌)。
构建请求:使用您喜欢的编程语言(如Python、Java、PHP等)构建API请求。请求应包括以下信息:
发送请求:使用您选择的编程语言发送API请求。您可以使用内置的网络库或第三方库来发送HTTP请求。
处理响应:一旦您收到API响应,您可以解析响应以获取商品详情。响应通常以JSON格式返回,您可以使用相应编程语言的JSON库进行解析。
请求参数
请求参数:num_iid=264070136/5637247041&country=.com.my
参数说明:num_iid:商品ID-country:网站后缀(.com.my;.vn;.ph)
以下是一个示例Python代码片段,演示如何使用虾皮API接口根据商品ID获取商品详情:
Result Object:
---------------------------------------
{
"item": {
"num_iid": "5637247041",
"title": "Fashionable plus size women's dress 2020 new spring and summer dress was thin and thin and fat sister dress two-piece suit",
"price": 22.18,
"orginal_price": 31.68,
"num": 17906,
"detail_url": "https://shopee.com.my/jewellery-emas-cop-916-gold-bracelet-elet-gold-bracelet-gelang-tangan-bracelets-charms-cute-bracelet-emas-korea-i.264070136.5637247041?",
"pic_url": "https://cf.shopee.com.my/file/f8bc1116ea922e5ed87a492390b1cc1a",
"brand": null,
"desc": "Brand: Other/Other\nStyle: Sweet and Fresh/College\nPopular elements: buttons, gauze, stitching\nStyle: skirt suit\nsleeve length: short sleeve\nFabric/Material: Other/Polyester (Polyester Fiber)\nIngredient content: 71% (inclusive)-80% (inclusive)\nWhether to add cashmere: no cashmere\nTime to market: Spring 2020\nDelivery time:\nShipped on the same day before subscripting at 18:00 every day,\nIt is estimated that it will take 4-10 days for normal goods to arrive at your hands\n\nMasa penghantaran\nDihantar pada hari yang sama sebelum pukul 18:00 setiap hari\nDihantar keesokan harinya selepas jam 18:00.\nDianggarkan memerlukan masa 4-10 hari untuk barang biasa sampai tangan anda\n\nPakaian wanita bersaiz plus bergaya.Pakaian musim bunga dan musim panas dalam 2020 yang baru\nkurus dan gemuk itu berpakaian yg dua keping",
"skus": {
"sku": [
{
"price": 22.18,
"orginal_price": 31.68,
"properties": "2:0",
"properties_name": "2:0:skirt:M 建议【42.5-50KG】",
"quantity": 1000,
"sku_id": 19329148698
},
{
"price": 26.66,
"orginal_price": 38.08,
"properties": "1:1",
"properties_name": "1:1:T-shirt:L 建议 【50-57.5kg】",
"quantity": 999,
"sku_id": 19329148693
},
{
"price": 26.66,
"orginal_price": 38.08,
"properties": "1:2",
"properties_name": "1:2:T-shirt:XL 【建议57.5-65kg】",
"quantity": 1000,
"sku_id": 19329148694
},
{
"price": 44.36,
"orginal_price": 63.36,
"properties": "0:1",
"properties_name": "0:1:T-shirt+skirt:L 建议 【50-57.5kg】",
"quantity": 983,
"sku_id": 19329148687
},
{
"price": 26.66,
"orginal_price": 38.08,
"properties": "1:0",
"properties_name": "1:0:T-shirt:M 建议【42.5-50KG】",
"quantity": 998,
"sku_id": 19329148692
},
{
"price": 22.18,
"orginal_price": 31.68,
"properties": "2:3",
"properties_name": "2:3:skirt:2XL 【建议65-72.5kg】",
"quantity": 998,
"sku_id": 19329148701
},
{
"price": 44.36,
"orginal_price": 63.36,
"properties": "0:0",
"properties_name": "0:0:T-shirt+skirt:M 建议【42.5-50KG】",
"quantity": 982,
"sku_id": 19329148686
},
{
"price": 22.18,
"orginal_price": 31.68,
"properties": "2:2",
"properties_name": "2:2:skirt:XL 【建议57.5-65kg】",
"quantity": 997,
"sku_id": 19329148700
},
{
"price": 44.36,
"orginal_price": 63.36,
"properties": "0:4",
"properties_name": "0:4:T-shirt+skirt:3XL 【建议72.5-82.5kg】",
"quantity": 992,
"sku_id": 19329148690
},
{
"price": 26.66,
"orginal_price": 38.08,
"properties": "1:3",
"properties_name": "1:3:T-shirt:2XL 【建议65-72.5kg】",
"quantity": 999,
"sku_id": 19329148695
},
{
"price": 22.18,
"orginal_price": 31.68,
"properties": "2:1",
"properties_name": "2:1:skirt:L 建议 【50-57.5kg】",
"quantity": 999,
"sku_id": 19329148699
},
{
"price": 22.18,
"orginal_price": 31.68,
"properties": "2:4",
"properties_name": "2:4:skirt:3XL 【建议72.5-82.5kg】",
"quantity": 999,
"sku_id": 19329148702
},
{
"price": 26.66,
"orginal_price": 38.08,
"properties": "1:5",
"properties_name": "1:5:T-shirt:4XL【建议82.5-90kg】",
"quantity": 998,
"sku_id": 19329148697
},
{
"price": 22.18,
"orginal_price": 31.68,
"properties": "2:5",
"properties_name": "2:5:skirt:4XL【建议82.5-90kg】",
"quantity": 997,
"sku_id": 19329148703
},
{
"price": 44.36,
"orginal_price": 63.36,
"properties": "0:5",
"properties_name": "0:5:T-shirt+skirt:4XL【建议82.5-90kg】",
"quantity": 985,
"sku_id": 19329148691
},
{
"price": 44.36,
"orginal_price": 63.36,
"properties": "0:2",
"properties_name": "0:2:T-shirt+skirt:XL 【建议57.5-65kg】",
"quantity": 992,
"sku_id": 19329148688
},
{
"price": 44.36,
"orginal_price": 63.36,
"properties": "0:3",
"properties_name": "0:3:T-shirt+skirt:2XL 【建议65-72.5kg】",
"quantity": 989,
"sku_id": 19329148689
},
{
"price": 26.66,
"orginal_price": 38.08,
"properties": "1:4",
"properties_name": "1:4:T-shirt:3XL 【建议72.5-82.5kg】",
"quantity": 999,
"sku_id": 19329148696
}
]
},
"has_discount": "false",
"item_size": [
"T-shirt+skirt",
"T-shirt",
"skirt"
],
"cid": 100017,
"categories": [
{
"catid": 100017,
"display_name": "Women Clothes",
"is_default_subcat": false,
"no_sub": false
},
{
"catid": 100104,
"display_name": "Dresses",
"is_default_subcat": false,
"no_sub": true
}
],
"currency": "MYR",
"sales": 337,
"item_imgs": {
"item_img": [
{
"url": "https://cf.shopee.com.my/file/f8bc1116ea922e5ed87a492390b1cc1a"
},
{
"url": "https://cf.shopee.com.my/file/c0d49dfae84b81468269a17714742adb"
},
{
"url": "https://cf.shopee.com.my/file/f4dd56edbe0ccc13ca2cba0d6ba5167a"
},
{
"url": "https://cf.shopee.com.my/file/35f35de0d5826c4969a42483b34d8bea"
},
{
"url": "https://cf.shopee.com.my/file/14b7804a2a87c70fa763c518ce6ec583"
},
{
"url": "https://cf.shopee.com.my/file/e1bc3fe36abc09c00ead17243b9825f0"
},
{
"url": "https://cf.shopee.com.my/file/ab490d68394575366c36cee16ad0f86e"
},
{
"url": "https://cf.shopee.com.my/file/a6148259a00b460f5e30ba04a327f9a3"
},
{
"url": "https://cf.shopee.com.my/file/e1bc5d2bb3c010af4f688e6f22a63eca"
}
]
},
"location": "Mainland China",
"shop_id": 264070136,
"prop_imgs": {
"prop_img": [
{
"properties": "0:0",
"url": "https://cf.shopee.com.my/file/81bea46afa4113012b7330cc3c846428"
},
{
"properties": "0:1",
"url": "https://cf.shopee.com.my/file/c0d49dfae84b81468269a17714742adb"
},
{
"properties": "0:2",
"url": "https://cf.shopee.com.my/file/f4dd56edbe0ccc13ca2cba0d6ba5167a"
}
]
},
"props_list": {
"2:0": "skirt:M 建议【42.5-50KG】",
"1:1": "T-shirt:L 建议 【50-57.5kg】",
"1:2": "T-shirt:XL 【建议57.5-65kg】",
"0:1": "T-shirt+skirt:L 建议 【50-57.5kg】",
"1:0": "T-shirt:M 建议【42.5-50KG】",
"2:3": "skirt:2XL 【建议65-72.5kg】",
"0:0": "T-shirt+skirt:M 建议【42.5-50KG】",
"2:2": "skirt:XL 【建议57.5-65kg】",
"0:4": "T-shirt+skirt:3XL 【建议72.5-82.5kg】",
"1:3": "T-shirt:2XL 【建议65-72.5kg】",
"2:1": "skirt:L 建议 【50-57.5kg】",
"2:4": "skirt:3XL 【建议72.5-82.5kg】",
"1:5": "T-shirt:4XL【建议82.5-90kg】",
"2:5": "skirt:4XL【建议82.5-90kg】",
"0:5": "T-shirt+skirt:4XL【建议82.5-90kg】",
"0:2": "T-shirt+skirt:XL 【建议57.5-65kg】",
"0:3": "T-shirt+skirt:2XL 【建议65-72.5kg】",
"1:4": "T-shirt:3XL 【建议72.5-82.5kg】"
},
"_ddf": "boy",
"props_img": {
"0:0": "https://cf.shopee.com.my/file/81bea46afa4113012b7330cc3c846428",
"0:1": "https://cf.shopee.com.my/file/c0d49dfae84b81468269a17714742adb",
"0:2": "https://cf.shopee.com.my/file/f4dd56edbe0ccc13ca2cba0d6ba5167a"
},
"format_check": "ok",
"desc_img": [],
"shop_item": [],
"relate_items": []
},
"error": "",
"secache": "da67365cb819d7c288d8451ffd8c3692",
"secache_time": 1699781394,
"secache_date": "2023-11-12 17:29:54",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"reason": "",
"error_code": "0000",
"cache": 1,
"api_info": "today:31 max:10000 all[136=31+56+49];expires:2030-12-31",
"execution_time": "0.04",
"server_time": "Beijing/2023-11-13 13:47:25",
"client_ip": "220.177.181.238",
"call_args": {
"num_iid": "264070136/5637247041",
"is_promotion": ".com.my"
},
"api_type": "shopee",
"translate_language": "zh-CN",
"translate_engine": "baidu",
"server_memory": "0.79MB",
"request_id": "gw-4.6551b86d478b3",
"last_id": "2263663607"
}