Full Analysis of Taobao Item Detail API taobao.item.get

taobao.item.get is a core item detail query interface provided by the Taobao Open Platform . It is used to obtain complete information of Taobao platform items by item ID (num_iid), covering core data such as item basic attributes, price, sales volume, specification parameters, detailed descriptions, and store information. It is an essential interface for e-commerce product selection, item management, data monitoring, and other scenarios.

I. Core Positioning of the Interface

Item Details
Interface Identifier taobao.item.get
Interface Function Accurately query full-item detail data of Taobao items, supporting single-item/batch item information acquisition
Applicable Scenarios Item information collection, inventory monitoring, price tracking, product selection analysis, item data synchronization
Calling Restrictions Requires applying for developer permissions on the Taobao Open Platform and obtaining AppKey/AppSecret for identity verification

II. Detailed Explanation of Core Parameters

The interface request parameters are divided into basic parameters (platform authentication) and business parameters (item query). Among them, num_iid is a mandatory parameter, and other parameters can be configured as needed.

1. Basic Parameters (Mandatory)

Parameter Name Type Mandatory Description
app_key String Yes Developer AppKey, obtained by registering an application on the Taobao Open Platform
v String Yes API version number, fixed as 2.0
format String Yes Return data format, fixed as json
method String Yes Interface method name, fixed as taobao.item.get
sign String Yes Signature, an MD5 encrypted string generated based on AppSecret + request parameters
timestamp Long Yes Timestamp (millisecond-level), used to prevent replay attacks
access_token String No Authorization token, used in store authorization scenarios, can be omitted for ordinary queries

2. Business Parameters (Core)

Parameter Name Type Mandatory Description
num_iid Long Yes Item ID (unique identifier of Taobao items), mandatory
fields String Yes List of fields to be returned, separated by commas, can be filtered as needed
is_promotion Int No Whether to return promotion information, 1 for yes, 0 for no, default 0
is_tmall Int No Whether to query only Tmall items, 1 for yes, 0 for no, default 0

3. Example of Common fields Fields

fields is a core parameter that controls the scope of returned data. Common fields are as follows (combined as needed):

plaintext

复制代码
title,price,num_iid,item_img,item_num,shop_name,location,desc,sku, seller_info,price,post_fee
  • title: Item title; price: Item price
  • item_img: Item main image URL; desc: Item detail page HTML
  • sku: Item specification parameters (color, size, etc.); seller_info: Store information

III. Python Request Example (Fully Runable)

1. Preliminary Preparation

  1. Register a Developer Account:By clicking on c0b.cc/nIAWD4 (wechat id: Taobaoapi2014), register an account, complete the enterprise certification, and obtain the AppKey and AppSecret (for identity verification during interface calls).

  2. Install Dependencies : Use the requests library to send requests and the json library to parse data.

    bash

    复制代码
    pip install requests

2. Complete Code Implementation

python

复制代码
import requests
import json
import hashlib
import time
from urllib.parse import urlencode

# ===================== Core Configuration (Replace with actual values) =====================
APP_KEY = "your_app_key"
APP_SECRET = "your_app_secret"
API_URL = "https://eco.taobao.com/router/rest"  # Interface address
NUM_IID = "642345678901234567"  # Target item ID (example)
# ==================================================================

def generate_sign(params):
    """Generate interface signature (MD5 encryption)"""
    sorted_params = sorted(params.items(), key=lambda x: x[0])
    sign_str = f"{APP_SECRET}{''.join([f'{k}{v}' for k, v in sorted_params])}{APP_SECRET}"
    return hashlib.md5(sign_str.encode("utf-8")).hexdigest().upper()

def get_taobao_item_detail():
    """Obtain Taobao item details"""
    # 1. Construct request parameters
    timestamp = str(int(time.time() * 1000))
    params = {
        "app_key": APP_KEY,
        "v": "2.0",
        "format": "json",
        "method": "taobao.item.get",
        "timestamp": timestamp,
        "num_iid": NUM_IID,
        "fields": "title,price,num_iid,item_img,item_num,shop_name,location,desc,sku",
        "is_promotion": 0
    }

    # 2. Generate signature
    params["sign"] = generate_sign(params)

    try:
        # 3. Send request
        response = requests.get(API_URL, params=params, timeout=10)
        response.raise_for_status()
        result = response.json()

        # 4. Parse results
        if "error_response" in result:
            print(f"Interface call failed: {result['error_response']['error_msg']}")
            return None
        # Extract item details
        item = result["item_get_response"]["item"]
        print("Item details obtained successfully!")
        return item
    except Exception as e:
        print(f"Request exception: {str(e)}")
        return None

# Call the interface
if __name__ == "__main__":
    item_detail = get_taobao_item_detail()
    if item_detail:
        # Print core information
        print(f"Item title: {item_detail.get('title', 'None')}")
        print(f"Item price: {item_detail.get('price', 'None')}")
        print(f"Item inventory: {item_detail.get('item_num', 'None')}")
        print(f"Store name: {item_detail.get('shop_name', 'None')}")
        print(f"Item main image: {item_detail.get('item_img', [{}])[0].get('url', 'None')}")
        # Print details (truncated to 100 characters)
        print(f"Item details: {str(item_detail.get('desc', 'None'))[:100]}...")

IV. Return Result Parsing

The interface returns data in JSON format, with the core structure as follows:

json

复制代码
{
    "item_get_response": {
        "item": {
            "title": "New Summer Short-Sleeve Loose Plus-Size Cotton T-Shirt for Men",
            "price": "99.00",
            "num_iid": "642345678901234567",
            "item_img": [{"url": "https://img.xxx.jpg"}],
            "item_num": "1000",
            "shop_name": "XX Clothing Flagship Store",
            "location": "Hangzhou, Zhejiang",
            "desc": "<div>HTML content of item details...</div>",
            "sku": [
                {"spec": "Black-XXL", "price": "99.00", "stock": "500"},
                {"spec": "White-XXL", "price": "99.00", "stock": "300"}
            ],
            "seller_info": {
                "nick": "XX Clothing Flagship Store",
                "shop_id": "12345678"
            }
        }
    }
}
  • Core Field Explanation :
    • title: Item title (used for search matching)
    • price: Item price (unit: RMB)
    • sku: Item specification list (required for multi-specification items)
    • desc: Item detail page HTML (can be directly used for display)
    • seller_info: Store information (used for merchant association)

V. Notes

  1. Permission Application : Ordinary developers need to apply for the item_get interface permission. For store authorization scenarios, an additional access_token needs to be applied for.
  2. Signature Generation : The signature must be generated strictly according to the rule of AppSecret + sorted parameters + AppSecret; otherwise, a "signature error" will be returned.
  3. Interface Frequency Limitations: The calling frequency is limited for a single IP/single application (default 5 times per second). The calling interval needs to be controlled to avoid triggering traffic limiting.
  4. Data Compliance: Only public item data can be obtained. It is prohibited to crawl or use unauthorized item information for commercial purposes, which may violate platform rules.
  5. Multi-Specification Item Processing : The specification parameters (such as color and size) need to be obtained through the sku field; otherwise, key information cannot be retrieved.

VI. Common Problems and Solutions

Problem Cause Solution
Signature Error Incorrect signature generation rules Strictly generate the MD5 signature according to the rule of AppSecret + sorted parameters + AppSecret
Invalid Item ID The input num_iid does not exist Confirm the correctness of the item ID, which can be queried through the taobao.item.search interface
Empty Field Return Incorrect configuration of the fields field Check whether the fields field exists and ensure that the field names are correct (case-sensitive)
Interface Call Failure Insufficient permissions Apply for the corresponding interface permission or obtain access_token through store authorization

VII. Interface Application Scenarios

  1. Item Data Collection: Batch acquisition of item information for e-commerce platform data synchronization and product selection analysis.
  2. Inventory Monitoring: Real-time query of item inventory to implement inventory early warning reminders.
  3. Price Tracking: Monitor price fluctuations of items to assist in adjusting pricing strategies.
  4. Item Detail Display: Display Taobao item details on third-party systems (requires compliant authorization).
相关推荐
折七1 分钟前
2026 年 Node.js 后端技术选型,为什么我选了 Hono 而不是 NestJS
前端·后端·node.js
高斯林.神犇8 分钟前
idea快捷键
java·ide·intellij-idea
毕设源码-钟学长9 分钟前
【开题答辩全过程】以 基于Vue的租房App为例,包含答辩的问题和答案
前端·javascript·vue.js
CappuccinoRose12 分钟前
HTML语法学习文档 - 汇总篇
前端·学习·html5
青春易逝丶27 分钟前
术语缩写
java
xdpcxq102927 分钟前
嵌入式Linux手动交叉编译
linux·运维·服务器
Web极客码32 分钟前
WordPress 被重定向到垃圾站的排查全过程
运维·服务器·网络·wordpress
ideal-cs34 分钟前
总结:Nginx配置文件案例说明
java·运维·nginx·nginx配置文件
无尽的沉默1 小时前
Thymeleaf 基本语法和表达式
java·开发语言
Coder_Boy_1 小时前
Java后端核心技术体系全解析(个人总结)
java·开发语言·spring boot·分布式·spring cloud·中间件