如何通过建设网站赚钱推广软件的app
要获取1688(阿里巴巴)的商品详情数据,你需要使用阿里巴巴开放平台提供的API接口。与淘宝开放平台类似,你需要先在阿里巴巴开放平台注册账号,创建应用,并获取app_key和app_secret。然后,根据阿里巴巴开放平台的文档,获取access_token,并使用这个access_token来调用相应的API接口。
下面是一个使用Java语言请求阿里巴巴商品详情数据API接口item_get的示例代码。请注意,这个例子假设你已经有了有效的access_token,并且你已经阅读并理解了阿里巴巴开放平台的API文档。
请求示例,API接口接入Anzexi58

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.万邦.cn/1688/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=610947572360";JSONObject json = getRequestFromUrl(url);System.out.println(json.toString());}} 
 
公共参数
| 名称 | 类型 | 必须 | 描述 | 
|---|---|---|---|
| key | String | 是 | 调用key(必须以GET方式拼接在URL中) | 
| secret | String | 是 | 调用密钥WeChat18305163218 | 
| 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=610947572360
参数说明:num_iid:1688商品ID
 sales_data:&sales_data=1 获取近30天成交数据
 agent:&agent=1 获取1688分销代发价格数据
Version: Date:
| 名称 | 类型 | 必须 | 示例值 | 描述 | 
|---|---|---|---|---|
|   item  | item[] | 0 | 宝贝详情数据 | |
|   num_iid  | String | 0 | 610947572360 | 宝贝ID | 
|   title  | String | 0 | 厂家直销小米有品Qin2 Pro智能手机学生机老人机备用机小爱同学4G | 商品标题 | 
|   desc_short  | String | 0 | 商品简介 | |
|   price  | Float | 0 | 799.00 | 价格 | 
|   total_price  | Float | 0 | 0 | |
|   suggestive_price  | Float | 0 | 0 | |
|   orginal_price  | Float | 0 | 799.00 | 原价 | 
|   nick  | String | 0 | qin多亲科技(_sopid@BBBSvyqimnYtLnmm90B_59dsg) | 卖家昵称(以上2种参数都有可能输出,凡是_sopid@开头的即为加密openid) | 
|   num  | Int | 0 | 2191 | |
|   min_num  | Int | 0 | 2 | 最小起批量 | 
|   detail_url  | String | 0 | https://detail.1688.com/offer/610947572360.html | 宝贝链接 | 
|   pic_url  | String | 0 | https://cbu01.alicdn.com/img/ibank/2020/063/830/13235038360_979836901.jpg | 宝贝图片 | 
|   brand  | String | 0 | MAJE | 品牌 | 
|   brandId  | Int | 0 | 8879363 | 品牌id | 
|   rootCatId  | Int | 0 | 0 | 顶级分类ID | 
|   cid  | Int | 0 | 124264005 | |
|   desc  | String | 0 | ||
|   item_imgs  | Mix | 0 | item_imgs[] | 商品图片 | 
|   item_weight  | String | 0 | ||
|   post_fee  | Float | 0 | 9.00 | 邮费 | 
|   express_fee  | Float | 0 | 9.00 | EMS费用 | 
|   ems_fee  | Float | 0 | 9.00 | 物流费用 | 
|   shipping_to  | String | 0 | 广东广州白云区 | 发货至 | 
|   video  | video[] | 0 | 商品视频 | |
|   sample_id  | String | 0 | ||
|   props_name  | String | 0 | 0:0:机身内存:64GB;1:0:颜色:铁灰色;1:1:颜色:瓷白色 | 商品属性名 | 
|   prop_imgs  | prop_imgs[] | 0 | 商品属性图片列表 | |
|   property_alias  | String | 0 | 0:0:64GB;1:0:铁灰色;1:1:瓷白色 | 属性别名 | 
|   props  | Mix | 0 | [{"name": "品牌", "value": "other"}] | 商品详情 | 
|   total_sold  | Int | 0 | 1 | |
|   scale  | Int | 0 | ||
|   sellUnit  | Int | 0 | ||
|   skus  | skus[] | 0 | 商品规格信息列表 | |
|   seller_id  | Int | 0 | 2206619673102 | 卖家ID | 
|   sales  | Int | 0 | 100 | 销售额 | 
|   shop_id  | Int | 0 | 151372205 | 店铺ID | 
|   props_list  | Mix | 0 | {"0:0": "机身内存:64GB"} | 商品属性 | 
|   tmall  | Boolean | 0 | false | 是否天猫 | 
|   data_from  | String | 0 | 1688app | 错误信息 | 
|   error  | String | 0 | 错误信息 | |
|   unit  | String | 0 | 部; | 单位 | 
|   is_support_mix  | Boolean | 0 | true | |
|   mix_amount  | Int | 0 | 30 | |
|   mix_Begin  | Int | 0 | ||
|   mix_number  | Int | 0 | ||
|   sales_data  | Date | 0 | ||
|   location  | String | 0 | 广东省 深圳市 | 发货地 | 
|   props_img  | Mix | 0 | 属性图片 | |
|   sales_info  | Mix | 0 | ||
|   desc_img  | Mix | 0 | [{"https://cbu01.alicdn.com/img/ibank/2020/560/807/14112708065_979836901.jpg"}] | 详情图片列表 | 
|   shop_item  | Mix | 0 | ||
|   relate_items  | Mix | 0 | 
