1688阿里巴巴官方开放平台API接口获取商品详情、商品规格信息列表、价格、宝贝详情数据调用示例说明

商品详情API接口在电商平台和购物应用中的作用非常重要。它提供了获取商品详细信息的能力,帮助用户了解和选择合适的商品,同时也支持开发者进行竞品分析、市场研究和推广营销等工作,以提高用户体验和促进销售增长。
1688.item_get-获得1688商品详情
1、公共参数
名称类型必须描述
keyString调用key(必须以GET方式拼接在URL中)注册调用key请求接入api
secretString调用密钥
api_nameStringAPI接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]
cacheString[yes,no]默认yes,将调用缓存的数据,速度比较快
result_typeString[json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读
langString[cn,en,ru]翻译语言,默认cn简体中文
versionStringAPI版本

2、请求参数

请求参数:num_iid=610947572360

参数说明:num_iid:1688商品ID
sales_data:&sales_data=1 获取近30天成交数据
agent:&agent=1 获取1688分销代发价格数据

3、响应参数

4、请求示例

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://api-gw.onebound.cn/1688/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=610947572360";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}

5、响应示例

{
	"item": {
		"num_iid": "610947572360",
		"title": "厂家直销小米有品Qin2 Pro智能手机学生机老人机备用机小爱同学4G",
		"desc_short": "",
		"price": "799.00",
		"total_price": 0,
		"suggestive_price": 0,
		"orginal_price": "799.00",
		"nick": "qin多亲科技",
		"num": "1763",
		"detail_url": "https://detail.1688.com/offer/610947572360.html",
		"pic_url": "https://cbu01.alicdn.com/img/ibank/2020/063/830/13235038360_979836901.jpg",
		"brand": "",
		"brandId": "",
		"rootCatId": "",
		"cid": "50903",
		"desc": "<div id=\"offer-template-0\"></div><p><span><span>深圳市多亲科技有限公司(简称&ldquo;多亲科技&rdquo;)成立于2014年9月是国内领先的人工智能硬件解决方案供应商。多亲科技积极推动人工智能技术的创新研发,在人工智能终端设备、系统软件的研发和生产领域,具有深厚的技术沉淀与实力。</span></span></p><p><span>&nbsp;</span></p><p><span>&nbsp; &nbsp; &nbsp; &nbsp; 多亲产品销售网络覆盖全国各地乃至远销海外,欢迎企业定制、团购、经销代理。</span></p><p><span>&nbsp; &nbsp; &nbsp; &nbsp; 优质的产品、过硬的技术、完善的服务、是我们合作双赢的开篇。</span></p><p><span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span ><strong><span >欢迎有意向者实地考察,垂询电话:13662284449.</span></strong></span></span></p><p><span>&nbsp;</span></p><p><span>温馨提示:</span></p><p><span><span><span>1、可定制--</span></span>承接各种订单订制!为客户定制机身、开机画面、预装软件、包装等定制!</span><br /><span><span><span>2、质量保证--</span></span>本公司专注通讯行业10年,线下线下百花齐放,客户复购率达30%以上。</span><br /><span><span><span>3、价格实惠--</span></span>本店是工厂直供,没有中间商差价,一站到客,薄利多销。</span><br /><span><span><span>4、售后服务--</span></span>本店出售的所有产品均提供1年的质保。因质量原因退换货(非人为因素)30天内换新。</span></p><p>&nbsp;</p><p><span><img alt=\"undefined\" height=\"446.22866894197955\" src=\"https://cbu01.alicdn.com/img/ibank/2020/560/807/14112708065_979836901.jpg\" width=\"790\" /><br /><img alt=\"undefined\" height=\"457.5154730327144\" src=\"https://cbu01.alicdn.com/img/ibank/2020/303/507/14112705303_979836901.jpg\" width=\"790\" /><br /><img alt=\"undefined\" height=\"443.2365499573014\" src=\"https://cbu01.alicdn.com/img/ibank/2020/499/812/14150218994_979836901.jpg\" width=\"790\" /><br /><img alt=\"undefined\" height=\"440.350569675723\" src=\"https://cbu01.alicdn.com/img/ibank/2020/770/128/14199821077_979836901.jpg\" width=\"790\" /><br /></span></p><p><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/588/942/13197249885_979836901.jpg\" /></p><p><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/778/789/13234987877_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/109/489/13234984901_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/156/072/13197270651_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/270/710/13235017072_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/735/999/13234999537_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/549/252/13197252945_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/409/552/13197255904_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/247/935/13278539742_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/355/845/13278548553_979836901.jpg\" /><br /><br /></p><p><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/917/372/13197273719_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/969/099/13234990969_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/175/455/13278554571_979836901.jpg\" /></p><p><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/427/386/13314683724_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/331/365/13278563133_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/654/500/13235005456_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/542/110/13235011245_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/291/020/13235020192_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/329/635/13278536923_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/996/155/13278551699_979836901.jpg\" /></p><p><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/230/920/13235029032_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/464/972/13197279464_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/380/275/13278572083_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/999/462/13197264999_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/868/245/13278542868_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/843/410/13235014348_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/897/200/13235002798_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/914/800/13235008419_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/709/762/13197267907_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/427/545/13278545724_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/741/003/13197300147_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/175/710/13235017571_979836901.jpg\" /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/410/485/13278584014_979836901.jpg\" /><br /><br /><img alt=\"undefined\" src=\"https://cbu01.alicdn.com/img/ibank/2020/863/665/13278566368_979836901.jpg\" /><br /><br /><br /></p>",
		"item_imgs": [
			{
				"url": "https://cbu01.alicdn.com/img/ibank/2020/063/830/13235038360_979836901.jpg"
			},
			{
				"url": "https://cbu01.alicdn.com/img/ibank/2020/445/748/13819847544_979836901.jpg"
			},
			{
				"url": "https://cbu01.alicdn.com/img/ibank/2020/487/543/13234345784_979836901.jpg"
			},
			{
				"url": "https://cbu01.alicdn.com/img/ibank/2020/296/695/13418596692_979836901.jpg"
			},
			{
				"url": "https://cbu01.alicdn.com/img/ibank/2020/167/778/13462877761_979836901.jpg"
			}
		],
		"item_weight": "",
		"post_fee": "",
		"express_fee": "",
		"ems_fee": "",
		"shipping_to": "",
		"video": [],
		"sample_id": "",
		"props_name": "0:0:机身内存:64GB;1:0:颜色:铁灰色;1:1:颜色:瓷白色",
		"prop_imgs": {
			"prop_img": []
		},
		"property_alias": "0:0:64GB;1:0:铁灰色;1:1:瓷白色",
		"props": [
			{
				"name": "品牌",
				"value": "多亲"
			},
			{
				"name": "型号",
				"value": "Qin 2 Pro"
			},
			{
				"name": "手机类型",
				"value": "老人手机"
			},
			{
				"name": "外形",
				"value": "直板"
			},
			{
				"name": "主屏尺寸",
				"value": "大屏幕(5.0英寸—5.9英寸)"
			},
			{
				"name": "网络制式",
				"value": "移动4G(TD-LTE),联通/电信4G(FDD-LTE)"
			},
			{
				"name": "操作系统",
				"value": "Android 9.0系统"
			},
			{
				"name": "电池容量",
				"value": "2100"
			},
			{
				"name": "摄像头像素",
				"value": "1200万-1999万"
			},
			{
				"name": "存储卡",
				"value": "支持存储卡"
			},

6、注:本帖只展示部分响应参数,具体可以注册账号测试或者联系业务经理

阿里巴巴开放平台 SDK 运行样例。 调用阿里巴巴开放平台API你是不是获取不到访问口令,看一下我的例子吧,原因是后台已经更改,而网站的说明没有更新。 IniFile ini = new IniFile(); Dictionary sl = new Dictionary(); sl = ini.GetSectionValues("Setting"); strAppKey = sl["appKey"].ToString(); strAccToken = sl["access_token"].ToString(); strAppSecret = sl["appSecret"].ToString(); string strTokeyTime = sl["datatime"].ToString(); string strRefresh_token = sl["refresh_token"].ToString(); //比较令牌保存时间,如果比现在早10个小时以上就更新 DateTime dt = Convert.ToDateTime(strTokeyTime); TimeSpan ts = System.DateTime.Now.Subtract(dt); if ((Int16.Parse(ts.Days.ToString()) >= 1) || (decimal.Parse(ts.Hours.ToString()) > 8)) { //超过有效期,重新获取Access_Token //利用Refresh_token获取access_token Dictionary ls = new Dictionary(); string urlStr = "https://gw.open.china.alibaba.com/openapi/http/1/system.oauth2/getToken/" + strAppKey; Dictionary dc = new Dictionary(); dc.Add("grant_type", "refresh_token"); dc.Add("need_refresh_token", "true"); dc.Add("client_id", strAppKey); dc.Add("client_secret", strAppSecret); dc.Add("redirect_uri", "http://localhost"); dc.Add("refresh_token", strRefresh_token); WebUtils wu = new WebUtils(); string tbxToken = wu.DoPost(urlStr, dc); Hashtable hs = (Hashtable)PluSoft.Utils.JSON.Decode(tbxToken); //保存令牌 ini.WriteValue("Setting", "access_token", hs["access_token"].ToString()); ini.WriteValue("Setting", "datatime", System.DateTime.Now.ToString()); strAccToken = hs["access_token"].ToString(); } 获取授权的CODE和令牌,分两步。 一、获取CODE   将得到的CODE码复制到文本框中: 二、得到令牌,并存在本地   三、利用refresh_token获取access_token 四、两个例子: [Setting] appKey=输入你的App ID appSecret=输入你的App Secret Key refresh_token=f3863b17-dcf3-45f6-8787-481befb188c7 access_token=faf4a195-e87d-4bfd-afbd-dc804c264c9c datatime=2012-12-2 16:53:33 [tu] albumId=35150663 albumName=产品相册J imageCount=90 本Demo为接入阿里平台的“HelloWorld”,主要调用平台的免登录接口接入平台。Demo中对平台提供的SIP接 口返回值进行解析,其中解析和签名部分适用于平台上提供的所有REST风格接口。 一、线上Demo运行效果查看 本Demo已经部署到线上环境,您可以试订购,订购后在“我的软件”中将有此Demo入口,点击使用即可。 Demo订购URL:http://mall.alisoft.com/apps/shopwindow/showAppDetailAction!view.jspa?appID=16857 二、Demo 结构介绍 1、本Demo采用Visual Studio2005开发的web网站项目。 2、Demo中主要文件介绍: Default.aspx,显示免登录是否成功页面,显示调用免登录系统级参数和应用级参数。 Signature.cs ,签名参数生成工具类,其中code为软件注册后获得的CERT CODE。 三、本地部署 1.确认安装有Visual Studio或IIS,安装.net Framawork。 2.将项目导入Visual Studio或部署到IIS服务器,或者将项目拷贝到D盘,点击dotnethelloworld.sln打开项目。 3.配置CERT CODE Signature.cs中将code设置成自己注册软件的CERT CODE,因为签名会用到此安全编码。 四、运行 1.软件入口: 线上环境demo入口为:http://demo.aliapp.com/dotnethelloworld/Default.aspx 本地部署入口如为:http://localhost:1702/dotnethelloworld/Default.aspx 2.将软件入口录入到您注册软件的“软件测试入口”。 3.点击阿里软件集市平台中“我的软件”,找到自己部署软件,点击使用即可登录您本地的应用。 也可在开发者工作台中点击“免登录接口测试”,进入您刚部署的Demo应用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值