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 分钟前
JAVA实现Manus智能体
java·react·cot·智能体·spring ai·manus·agent loop
ZC跨境爬虫3 分钟前
跟着 MDN 学CSS day_6:(伪类和伪元素详解)
前端·javascript·css·数据库·ui·html
idcu4 分钟前
Lyt.js + Vite 快速开发指南
前端·typescript
暗不需求4 分钟前
玩转 React Hooks:从基础到实战,逐行解析带你彻底掌握
前端·react.js·面试
用户3721574261355 分钟前
Java 如何插入和删除 Excel 行和列
java
一颗小青松6 分钟前
css 文字区域根据图片形状显示,根据文字设置背景图
前端·css
翼龙云_cloud6 分钟前
云代理商:Hermes Agent在量化交易中的实战应用
运维·服务器·人工智能·ai智能体·hermes agent
阿黎梨梨7 分钟前
跟 Git 打交道的正确姿势
前端
idcu7 分钟前
深入 Lyt.js 路由系统:L6 生态系统层的核心
前端·typescript
@SmartSi7 分钟前
AgentScope Java 入门:如何使用 OpenAIChatModel 集成兼容 OpenAI 协议模型
java·agentscope