首页 > 大数据 > 数据分析 > 1688商品详情API接口(item_get)使用指南
一、接口核心功能
num_iid:商品唯一ID(必填)fields:自定义返回字段(如
title,price,total_sold,pic_url)cache:是否使用缓存(默认yes,提升响应速度)result_type:返回格式(默认json,可选xml/serialize)sales_data:设为1时获取近30天成交数据agent:设为1时获取分销代发价格app_key和
app_secret。item.get接口,提交权限申请(审核1-3个工作日)。access_token(有效期2小时)。key=value&key=value格式app_secret后进行MD5加密,转大写bashhttps://gw.open.1688.com/openapi/param2/1/com.alibaba.product/alibaba.product.get?app_key=YOUR_APP_KEY&num_iid=610947572360&fields=title,price,total_sold&sign=MD5(参数串+app_secret)
pythonimport requestsimport hashlibimport timeapp_key = "YOUR_APP_KEY"app_secret = "YOUR_APP_SECRET"num_iid = "610947572360"params = { "app_key": app_key, "method": "alibaba.product.get", "timestamp": str(int(time.time()*1000)), "v": "1.0", "format": "json", "num_iid": num_iid, "fields": "title,price,total_sold,pic_url"}# 生成签名sign_str = "".join([f"{k}{params[k]}" for k in sorted(params)]) + app_secretsign = hashlib.md5(sign_str.encode()).hexdigest().upper()params["sign"] = signresponse = requests.get("https://gw.open.1688.com/openapi/param2/1/com.alibaba.product/alibaba.product.get", params=params)if response.status_code == 200: print(response.json())else: print(f"Error: {response.status_code}")
json{ "item_get_response": { "item": { "num_iid": "商品ID", "title": "商品标题", "price": "当前价", "total_sold": "总销量", "pic_url": "主图URL", "skus": [{"sku_id": "规格ID", "price": "规格价", "quantity": "库存"}], "seller_info": {"nick": "卖家昵称", "shop_url": "店铺链接"} } }}200表示成功,非200需检查
error_msg字段app_secret,建议使用环境变量存储pageNo和
pageSize参数分批次获取数据item_search:按关键词搜索商品seller_info:获取店铺详情item_fee:计算运费通过本接口可快速搭建商品监控系统、竞品分析工具或供应链管理系统,建议结合官方文档1688开放API文档持续优化调用策略。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70046834/viewspace-3104148/ ,如需转载,请注明出处,否则将追究法律责任。