一、订单接口分类
- custom 自定义API操作
- buyer_cart_add 添加到购物车
- buyer_cart_remove 删除购物车商品
- buyer_cart_clear 清空购物车
- buyer_cart_list 获取购物车的商品列表
- buyer_cart_order 将购物车商品保存为订单
- buyer_order_list 获取购买到的商品订单列表
- buyer_order_detail 获取购买到的商品订单详情
- buyer_order_express 获取购买到的商品订单物流
- buyer_order_message 获取购买到的订单买家留言
- buyer_address_list 收货地址列表
- buyer_address_clear 清除收货地址
- buyer_address_remove 删除收货地址
- buyer_address_modify 修改收货地址
- buyer_address_add 添加收货地址
- buyer_info 买家信息
- buyer_token 买家token
- seller_order_list 获取卖出的商品订单列表
- seller_order_detail 获取卖出的商品订单详情
- seller_order_close 卖家关闭一笔交易
- seller_order_message 获取或修改卖出去的订单备注
- seller_auction_list 商品可上下架商品列表
- seller_auction 商品上下架
- seller_item_add 商品上传
- upload_img 上传图片到淘宝
- img2text 图片识别商品接口
- tbk_order_query 淘宝客订单查询
- item_list_weight 批量获取商品信息
- item_history_price 获取商品历史价格信息
- item_get_app 获得淘宝app商品详情原数据
二、响应参数
名称 | 类型 | 必须 | 示例值 | 描述 |
---|---|---|---|---|
cart_id | Bigint | 0 | 1055921809617 | 购物车商品ID |
num_iid | Bigint | 0 | 544135010416 | 商品ID |
title | String | 0 | Philips/飞利浦 DLK35002 车载手机支架 多功能吸盘式汽车手机座 | 商品标题 |
pic_url | String | 0 | //img.alicdn.com/bao/uploaded/i2/2934435917/TB2Ite9tlsmBKNjSZFFXXcT9VXa_!!2934435917-0-item_pic.jpg | 宝贝图片 |
detail_url | String | 0 | //detail.tmall.com/item.htm?id=544135010416 | 宝贝链接 |
promotion_price | Int | 0 | 69 | 优惠价 |
price | Int | 0 | 99 | 价格 |
num | Int | 0 | 1 | 数量 |
sku | Mix | 0 | {"颜色分类": "黑色"} | 商品规格列表 |
is_tmall | Boolean | 0 | true | 是否天猫 |
seller_info | Mix | 0 | {"shop_type": "B", "title": "飞利浦淘参谋专卖", "sid": 165655803, "user_num_id": "2934435917", "zhuy": "//store.taobao.com/shop/view_shop.htm?user_number_id=2934435917"} | 卖家信息 |
三、请求示例
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/taobao/buyer_order_list/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&page=1&tab_code=all";
JSONObject json = getRequestFromUrl(url);
System.out.println(json.toString());
}