Contact Us
Back top
Current Location : APIs > 天猫
天猫 Transactions( 83 )

天猫

Intro. : tmall product api

Tag : 天猫 On Shelves Time : 2017-03-03

Type :

商品 评论

Tutorials

Total invocations(updated per hour)

天猫商品 1.00 yuan/100calls Test Now

API Areas

API Mark

Example

-- 请求示例 url 默认请求参数已经做URL编码 curl -i "https://api02.bitspaceman.com/product/tmall?apikey=Your apikey&catid=%E5%88%86%E7%B1%BBID"
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://api02.bitspaceman.com/product/tmall?apikey=Your apikey&catid=%E5%88%86%E7%B1%BBID"; JSONObject json = getRequestFromUrl(url);; System.out.println(json.toString()); } }
//using System.Net.Security; //using System.Security.Cryptography.X509Certificates; private const String method = "GET"; static void Main(string[] args) { String bodys = ""; // 请求示例 url 默认请求参数已经做URL编码 String url = "https://api02.bitspaceman.com/product/tmall?apikey=Your apikey&catid=%E5%88%86%E7%B1%BBID"; HttpWebRequest httpRequest = null; HttpWebResponse httpResponse = null; if (url.Contains("https://")) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url)); } else { httpRequest = (HttpWebRequest)WebRequest.Create(url); } httpRequest.Method = method; if (0 < bodys.Length) { byte[] data = Encoding.UTF8.GetBytes(bodys); using (Stream stream = httpRequest.GetRequestStream()) { stream.Write(data, 0, data.Length); } } try { httpResponse = (HttpWebResponse)httpRequest.GetResponse(); } catch (WebException ex) { httpResponse = (HttpWebResponse)ex.Response; } Console.WriteLine(httpResponse.StatusCode); Console.WriteLine(httpResponse.Method); Console.WriteLine(httpResponse.Headers); Stream st = httpResponse.GetResponseStream(); StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8")); Console.WriteLine(reader.ReadToEnd()); Console.WriteLine("\n"); } public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; }
<?php $method = "GET"; // 请求示例 url 默认请求参数已经做URL编码 $url = "https://api02.bitspaceman.com/product/tmall?apikey=Your apikey&catid=%E5%88%86%E7%B1%BBID"; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_ENCODING, "gzip"); var_dump(curl_exec($curl)); ?>
# coding:utf-8 """ Compatible for python2.x and python3.x requirement: pip install requests """ from __future__ import print_function import requests # 请求示例 url 默认请求参数已经做URL编码 url = "https://api02.bitspaceman.com/product/tmall?apikey=Your apikey&catid=%E5%88%86%E7%B1%BBID" headers = { "Accept-Encoding": "gzip", "Connection": "close" } if __name__ == "__main__": r = requests.get(url, headers=headers) json_obj = r.json() print(json_obj)

Request Field( Params marked* means users should choose one from the each marked items to fill in.)

Property Name Type Mandatory Example Description
kw string * 关键词
catid string * 分类ID
id string * 530231541327
shopId string * 73200079
url string * https://detail.tmall.com/item.htm?id=40496369652
shopUrl string * https://elle.tmall.com
pageToken string 翻页值
brandId string
getBrands string false
searchType string

Response Fields

Property Name Type Example Description
  • hasNext boolean true 是否有下一页
  • retcode string 000000 返回的状态码
  • appCode string tmall 本次查询的api名
  • dataType string product 本次查询的api类型
  • pageToken string 2 翻页值
  • -
    data array [...] 返回数据
    • rating number 4.7 商品评分
    • subtitle string 原封国行 官网价直降 副标题
    • marketPrice number 5388 市场价
    • likeCount string null 点赞数或喜爱数
    • commentCount number 70510 评论数
    • originPlace string 浙江杭州 产地
    • saleCount number 4480 销售数
    • catPathKey string null 分类key, 值为 catName1_catName2_...catNameN
    • id string 538473991555 产品ID
    • catName2 string null 2级分类名
    • imageUrls array [...] 图像url合集
    • title string 【稀缺货源】Apple/苹果 iPhone 7 32G 全网通4G智能手机 商品名称
    • publishDateStr string null 发布时间:字符串格式
    • +
      goodTagDist array [...] 正向评论tag列表
      • tagid string 1020_1 tag的ID
      • key string 正品行货 商品属性key
      • value number 1424 商品属性value
    • tags string null 标签
    • +
      keyValues array [...] 键值对
      • key string CPU品牌 商品属性key
      • value string Apple/苹果 商品属性value
    • +
      skuOptions array [...] 不同规格的商品详情
      • stockSize number 233 库存量
      • price number 4388 价格
      • id string 3217960944455 产品ID
    • logiRating number 4.8 物流评分
    • sellerId string 2616970884 销售者ID或店铺名
    • favoriteCount number 122890 收藏数
    • saleRank string null 销售排名
    • catName3 string null 3级分类名
    • description string null 描述
    • catName1 string null 1级分类名
    • storehouse string null 仓库
    • price number 4388 价格
    • +
      badTagDist array [...] 差评TAG列表
      • tagid string 921_0 tag的ID
      • key string 性能一般 商品属性key
      • value number 156 商品属性value
    • mallType string null 通常为1, 海外为2
    • brandId string 30111 品牌ID
    • discount number 8.14 折扣:统一为0到10
    • appPrice string null 通过手机购买价格
    • publishDate string null 发布时间:时间戳格式
    • openDate string 2015-08-10 21:40:07 店铺创建时间
    • soldout string null 是否售完
    • promotions string null 优惠、促销信息
    • url string https://detail.tmall.com/item.htm?id=538473991555 该产品链接
    • catId3 string null 3级分类ID
    • detailImageUrls array [...] 商品详情部分的图片列表
    • queryWord string null 查询关键字
    • catId2 string null 2级分类ID
    • sellerScreenName string 苏宁易购官方旗舰店 销售者的昵称
    • brandName string Apple/苹果 商标名
    • descRating number 4.8 描述评分
    • lowPrice string null 价格区间的低价
    • servRating number 4.8 服务评分
    • highPrice string null 价格区间的高价
    • catId1 string null 1级分类ID

Returns The Sample

{
    "hasNext": true,
    "retcode": "000000",
    "appCode": "tmall",
    "dataType": "product",
    "pageToken": "2",
    "data": [
        {
            "rating": 4.7,
            "subtitle": "原封国行 官网价直降",
            "marketPrice": 5388,
            "likeCount": null,
            "commentCount": 70510,
            "originPlace": "浙江杭州",
            "saleCount": 4480,
            "catPathKey": null,
            "id": "538473991555",
            "catName2": null,
            "imageUrls": [
                "http:\/\/img.alicdn.com\/imgextra\/i1\/2616970884\/TB16n.zf6uhSKJjSspdXXc11XXa_!!0-item_pic.jpg",
                "http:\/\/img.alicdn.com\/imgextra\/i2\/2616970884\/TB2Ll4Cfd4opuFjSZFLXXX8mXXa_!!2616970884.jpg",
                "http:\/\/img.alicdn.com\/imgextra\/i3\/2616970884\/TB2.4vQe_cCL1FjSZFPXXXZgpXa_!!2616970884.jpg",
                "http:\/\/img.alicdn.com\/imgextra\/i2\/TB1pQkANpXXXXbeXFXXXXXXXXXX_!!0-item_pic.jpg",
                "http:\/\/img.alicdn.com\/imgextra\/i2\/2616970884\/TB2Kr3XX1IPyuJjSspcXXXiApXa_!!2616970884.png"
            ],
            "title": "【稀缺货源】Apple\/苹果 iPhone 7 32G 全网通4G智能手机",
            "publishDateStr": null,
            "goodTagDist": [
                {
                    "tagid": "1020_1",
                    "key": "正品行货",
                    "value": 1424
                },
                {
                    "tagid": "620_1",
                    "key": "手机不错",
                    "value": 1383
                },
                {
                    "tagid": "420_1",
                    "key": "快递不错",
                    "value": 1023
                },
                {
                    "tagid": "10120_1",
                    "key": "服务态度好",
                    "value": 1021
                },
                {
                    "tagid": "921_1",
                    "key": "性能强劲",
                    "value": 776
                }
            ],
            "tags": null,
            "keyValues": [
                {
                    "key": "CPU品牌",
                    "value": "Apple\/苹果 "
                },
                {
                    "key": "产品名称",
                    "value": "iPhone 7 "
                },
                {
                    "key": "屏幕尺寸",
                    "value": "4.7英寸 "
                },
                {
                    "key": "品牌",
                    "value": "Apple\/苹果 "
                },
                {
                    "key": "Apple型号",
                    "value": "iPhone 7 "
                },
                {
                    "key": "网络类型",
                    "value": "无需合约版 "
                },
                {
                    "key": "款式",
                    "value": "直板 "
                },
                {
                    "key": "机身颜色",
                    "value": "黑色 金色 玫瑰金色 银色 亮黑色 "
                },
                {
                    "key": "套餐类型",
                    "value": "官方标配 "
                },
                {
                    "key": "后置摄像头",
                    "value": "1200 万像素摄像头 "
                },
                {
                    "key": "操作系统",
                    "value": "iOS 10 "
                },
                {
                    "key": "附加功能",
                    "value": "不详 "
                },
                {
                    "key": "售后服务",
                    "value": "全国联保 "
                },
                {
                    "key": "触摸屏类型",
                    "value": "具备3DTouch 技术的 Retina HD 显示屏 "
                },
                {
                    "key": "运行内存RAM",
                    "value": "不详 "
                },
                {
                    "key": "存储容量",
                    "value": "32GB "
                },
                {
                    "key": "键盘类型",
                    "value": "虚拟触屏键盘 "
                },
                {
                    "key": "分辨率",
                    "value": "1334 x 750 像素分辨率,326 ppi "
                },
                {
                    "key": "手机类型",
                    "value": "不详 "
                },
                {
                    "key": "电池类型",
                    "value": "不可拆卸式电池 "
                },
                {
                    "key": "摄像头类型",
                    "value": "1200 万像素摄像头 "
                },
                {
                    "key": "视频显示格式",
                    "value": "1080P(全高清D5) "
                },
                {
                    "key": "网络模式",
                    "value": "蜂窝网络和无线连接 "
                },
                {
                    "key": "核心数",
                    "value": "不详 "
                },
                {
                    "key": "版本类型",
                    "value": "中国大陆 "
                }
            ],
            "skuOptions": [
                {
                    "stockSize": 233,
                    "price": 4388,
                    "imageUrls": [
                        "http:\/\/gw.alicdn.com\/bao\/uploaded\/i7\/TB1Xpe_NXXXXXXRXFXXGTq09XXX_035318.jpg"
                    ],
                    "id": "3217960944455",
                    "keyValues": [
                        {
                            "key": "网络类型",
                            "value": "无需合约版"
                        },
                        {
                            "key": "机身颜色",
                            "value": "黑色"
                        },
                        {
                            "key": "套餐类型",
                            "value": "官方标配"
                        },
                        {
                            "key": "存储容量",
                            "value": "32GB"
                        }
                    ]
                },
                {
                    "stockSize": 133,
                    "price": 4388,
                    "imageUrls": [
                        "http:\/\/gw.alicdn.com\/bao\/uploaded\/i1\/TB1EBK7NXXXXXaMXFXXh9e79XXX_035357.jpg"
                    ],
                    "id": "3217960944456",
                    "keyValues": [
                        {
                            "key": "网络类型",
                            "value": "无需合约版"
                        },
                        {
                            "key": "机身颜色",
                            "value": "金色"
                        },
                        {
                            "key": "套餐类型",
                            "value": "官方标配"
                        },
                        {
                            "key": "存储容量",
                            "value": "32GB"
                        }
                    ]
                },
                {
                    "stockSize": 83,
                    "price": 4388,
                    "imageUrls": [
                        "http:\/\/gw.alicdn.com\/bao\/uploaded\/i6\/TB1OiqNNXXXXXXiapXXnH2X9XXX_035413.jpg"
                    ],
                    "id": "3217960944457",
                    "keyValues": [
                        {
                            "key": "网络类型",
                            "value": "无需合约版"
                        },
                        {
                            "key": "机身颜色",
                            "value": "玫瑰金色"
                        },
                        {
                            "key": "套餐类型",
                            "value": "官方标配"
                        },
                        {
                            "key": "存储容量",
                            "value": "32GB"
                        }
                    ]
                },
                {
                    "stockSize": 0,
                    "price": 4388,
                    "imageUrls": [
                        "http:\/\/gw.alicdn.com\/bao\/uploaded\/i5\/TB1DKCLNXXXXXaZapXX9U549XXX_035343.jpg"
                    ],
                    "id": "3217962888349",
                    "keyValues": [
                        {
                            "key": "网络类型",
                            "value": "无需合约版"
                        },
                        {
                            "key": "机身颜色",
                            "value": "银色"
                        },
                        {
                            "key": "套餐类型",
                            "value": "官方标配"
                        },
                        {
                            "key": "存储容量",
                            "value": "32GB"
                        }
                    ]
                },
                {
                    "stockSize": 21,
                    "price": 4388,
                    "imageUrls": [
                        "http:\/\/gw.alicdn.com\/bao\/uploaded\/i8\/TB1LxA2afBNTKJjSszcMfDO2VXa_082356.jpg"
                    ],
                    "id": "3653330655690",
                    "keyValues": [
                        {
                            "key": "网络类型",
                            "value": "无需合约版"
                        },
                        {
                            "key": "机身颜色",
                            "value": "亮黑色"
                        },
                        {
                            "key": "套餐类型",
                            "value": "官方标配"
                        },
                        {
                            "key": "存储容量",
                            "value": "32GB"
                        }
                    ]
                }
            ],
            "logiRating": 4.8,
            "sellerId": "2616970884",
            "favoriteCount": 122890,
            "saleRank": null,
            "catName3": null,
            "description": null,
            "catName1": null,
            "storehouse": null,
            "price": 4388,
            "stockSize": null,
            "badTagDist": [
                {
                    "tagid": "921_0",
                    "key": "性能一般",
                    "value": 156
                }
            ],
            "mallType": null,
            "brandId": "30111",
            "discount": 8.14,
            "appPrice": null,
            "publishDate": null,
            "openDate": "2015-08-10 21:40:07",
            "soldout": null,
            "promotions": null,
            "url": "https:\/\/detail.tmall.com\/item.htm?id=538473991555",
            "catId3": null,
            "detailImageUrls": [
                "https:\/\/img.alicdn.com\/imgextra\/i2\/2616970884\/TB2YSX.XYAlyKJjSZFBXXbtiFXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i3\/2616970884\/TB2MgcXXheI.eBjSsplXXX6GFXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i1\/2616970884\/TB2Z_gYswxlpuFjy0FoXXa.lXXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i2\/2616970884\/TB2FGKPsrBkpuFjy1zkXXbSpFXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i3\/2616970884\/TB2PaO6sr0kpuFjy0FjXXcBbVXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i1\/2616970884\/TB2REOYsxXlpuFjSsphXXbJOXXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i4\/2616970884\/TB2nr7CcCvHfKJjSZFPXXbttpXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i1\/2616970884\/TB21pl2wdRopuFjSZFtXXcanpXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i1\/2616970884\/TB24FXrwctnpuFjSZFKXXalFFXa-2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i2\/2616970884\/TB26rOajC7PL1JjSZFHXXcciXXa-2616970884.png",
                "https:\/\/img.alicdn.com\/imgextra\/i1\/2616970884\/TB2fRh.czuhSKJjSspaXXXFgFXa_!!2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i4\/2616970884\/TB2nzfgbLNNTKJjSspkXXaeWFXa_!!2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i4\/2616970884\/TB2YA01hMoQMeJjy1XaXXcSsFXa_!!2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i4\/2616970884\/TB2ZwJ7hHsTMeJjSszhXXcGCFXa_!!2616970884.jpg",
                "https:\/\/img.alicdn.com\/imgextra\/i1\/2616970884\/TB2a9CcfuEJL1JjSZFGXXa6OXXa-2616970884.jpg"
            ],
            "queryWord": null,
            "catId2": null,
            "sellerScreenName": "苏宁易购官方旗舰店",
            "brandName": "Apple\/苹果",
            "descRating": 4.8,
            "lowPrice": null,
            "servRating": 4.8,
            "highPrice": null,
            "catId1": null
        }
    ]
}

Detailed Data

No Details

Error code

Error Return Value Format : JSON

{

message:"API rate limit exceeded",

retcode:100703

}
Error Code Error Message Detailed Description
100000 Server internal error 服务器内部错误
100001 Network error 网络错误
100002 Search no result 目标参数搜索没结果
100004 Target server error 目标服务器错误
100005 Param error 用户输入参数错误
100301 Account not found 用户帐号不存在
100700 Invalid authentication credentials 授权失败
100701 API stopped 您的当前API已停用
100702 Account stopped 您的账户已停用
100703 API rate limit exceeded 并发已达上限
100704 API maintenance API维护中
100705 API not found with these values API不存在
100706 Please add api first 请先添加api
100707 Number of calls exceeded 调用次数超限
100802 Missing url param 'time' or uri path is not equal to 2 请求路径错误或者缺少"time"参数
100803 Wrong pageToken 参数pageToken有误

Often With The Purchase Of Data