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 priceitem_img: Item main image URL;desc: Item detail page HTMLsku: Item specification parameters (color, size, etc.);seller_info: Store information
III. Python Request Example (Fully Runable)
1. Preliminary Preparation
-
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).
-
Install Dependencies : Use the
requestslibrary to send requests and thejsonlibrary 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
- Permission Application : Ordinary developers need to apply for the
item_getinterface permission. For store authorization scenarios, an additionalaccess_tokenneeds to be applied for. - Signature Generation : The signature must be generated strictly according to the rule of
AppSecret + sorted parameters + AppSecret; otherwise, a "signature error" will be returned. - 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.
- 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.
- Multi-Specification Item Processing : The specification parameters (such as color and size) need to be obtained through the
skufield; 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
- Item Data Collection: Batch acquisition of item information for e-commerce platform data synchronization and product selection analysis.
- Inventory Monitoring: Real-time query of item inventory to implement inventory early warning reminders.
- Price Tracking: Monitor price fluctuations of items to assist in adjusting pricing strategies.
- Item Detail Display: Display Taobao item details on third-party systems (requires compliant authorization).