淘寶和天貓商品詳情 API (V11)
API 端點健康狀態
健康 可用 少量可用 基本不可用 暫無資料
正在載入健康狀態…
通過商品ID獲取淘寶商品詳情。可用於查詢商品信息,以進行商品目錄研究或監控。
使用提示
支持能力 · 商品覆蓋範圍
支持通過商品ID查詢所有淘寶商品的商品詳情。
支持能力 · 價格
提供展示的商品價格和SKU價格(如可用)。
支持能力 · SKU 選項
提供SKU標識符、規格選項以及上報的庫存數量。
支持能力 · 商品圖片和視頻
提供商品圖片和視頻(如可用)。
支持能力 · 配送
提供發貨地和顯示的郵費(如可用)。
請求參數
| 參數名 | 位置 | 類型 | 必填 | 預設值 | 說明 |
|---|---|---|---|---|---|
token |
query | string |
是 | - | 此 API 服務的訪問令牌。 |
itemId |
query | string |
是 | - | 淘寶商品ID。 |
程式碼範例
bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/taobao/get-item-detail/v11?token=YOUR_API_KEY&itemId=VALUE'
text
我想使用 JustOneAPI 提供的“商品詳情 (V11)”接口。
接入地址: https://api.justoneapi.com。
接口路徑: /api/taobao/get-item-detail/v11?token=YOUR_API_KEY&itemId=VALUE
接口地址: BASE_URL + /api/taobao/get-item-detail/v11?token=YOUR_API_KEY&itemId=VALUE
HTTP 方法: GET
身份驗證: 在 URL 中傳入 token 查詢參數。
OpenAPI 定義: https://docs.justoneapi.com/openapi/taobao-and-tmall/product-details-v11-zh-hant.json
請求參數說明:
- token (query): 此 API 服務的訪問令牌。 (必填)
- itemId (query): 淘寶商品ID。 (必填)
返回格式: 請根據實際 Content-Type 安全處理 JSON 或文本回應。
回應處理與錯誤代碼:
1. 需通過返回體中的 "code" 欄位判斷業務結果(code 為 0 表示成功)。
2. 逾時建議:建議將請求逾時時間設置為 120 秒;如果 120 秒偏長,請至少設置為 60 秒,但可能會有少量請求因逾時而未接收到結果。
3. 業務碼說明:
- 0: 成功
- 100: Token 無效或已失效
- 301: 採集失敗,請重試
- 302: 超出速率限制
- 303: 超出每日配額
- 400: 參數錯誤
- 500: 內部伺服器錯誤
- 600: 權限不足
- 601: 帳戶餘額不足
- 602: TOKEN 限額超限
4. code 601 表示帳戶共享餘額不足。code 602 表示當前 API TOKEN 自身的累計消費上限已達到。TOKEN 限額不是資金劃撥,多個 TOKEN 仍共享同一個帳戶餘額。
請幫我用我擅長的編程語言寫一個腳本來呼叫這個接口,並處理返回結果。
python
import requests
BASE_URL = "https://api.justoneapi.com" # 由 OpenAPI servers 提供
url = BASE_URL + "/api/taobao/get-item-detail/v11?token=YOUR_API_KEY&itemId=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
content_type = response.headers.get("content-type", "").lower()
if "json" in content_type:
try:
print(response.json())
except ValueError:
print(response.text)
elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
print(response.text)
else:
with open("response.bin", "wb") as output:
output.write(response.content)
print(f"Saved {len(response.content)} bytes to response.bin")
js
const BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
const url = BASE_URL + "/api/taobao/get-item-detail/v11?token=YOUR_API_KEY&itemId=VALUE";
const response = await fetch(url, {
method: "GET",
signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
const contentType = (response.headers.get("content-type") || "").toLowerCase();
const mediaType = contentType.split(";", 1)[0].trim();
const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
if (textual) {
const responseText = new TextDecoder().decode(responseBytes);
let data = responseText;
if (contentType.includes("json")) {
try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
}
console.log(data);
} else {
console.log(`Received ${responseBytes.byteLength} binary bytes`);
}
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) throws Exception {
final String BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
final String url = BASE_URL + "/api/taobao/get-item-detail/v11?token=YOUR_API_KEY&itemId=VALUE";
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create(url))
.timeout(Duration.ofSeconds(120))
.method("GET", HttpRequest.BodyPublishers.noBody());
HttpRequest request = builder.build();
HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
System.out.println(response.statusCode());
String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
String mediaType = contentType.split(";", 2)[0].trim();
if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
System.out.println(new String(response.body(), StandardCharsets.UTF_8));
} else {
Files.write(Path.of("response.bin"), response.body());
System.out.println("Saved " + response.body().length + " bytes to response.bin");
}
}
}
go
package main
import (
"fmt"
"io"
"os"
"strings"
"net/http"
"time"
)
const BASE_URL = "https://api.justoneapi.com" // 由 OpenAPI servers 提供
func main() {
client := &http.Client{Timeout: 120 * time.Second}
url := BASE_URL + "/api/taobao/get-item-detail/v11?token=YOUR_API_KEY&itemId=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
bodyBytes, _ := io.ReadAll(resp.Body)
contentType := strings.ToLower(resp.Header.Get("Content-Type"))
mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
fmt.Println(string(bodyBytes))
} else {
os.WriteFile("response.bin", bodyBytes, 0600)
fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
}
}
php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // 由 OpenAPI servers 提供
$url = $BASE_URL . '/api/taobao/get-item-detail/v11?token=YOUR_API_KEY&itemId=VALUE';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
echo $response;
} else {
file_put_contents('response.bin', $response);
echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}
返回欄位
業務成功時(code = 0)的主要返回欄位。
| 欄位路徑 | 類型 | 說明 |
|---|---|---|
data |
object |
所請求淘寶商品的詳情。查詢成功也可能表示商品詳情不可用。 |
data.exists |
boolean |
是否為所請求的商品ID找到了商品詳情。 |
data.reason |
string |
商品詳情不可用時返回的原因。 |
data.item |
object |
商品標題、媒體和展示標籤。 |
data.item.title |
string |
商品標題。 |
data.item.titleIcon |
string |
與商品標題關聯的圖標。 |
data.item.images |
array |
返回的商品圖片。 |
data.item.images[] |
string |
一張商品圖片的地址。 |
data.item.videos |
array |
返回的商品視頻。 |
data.item.videos[] |
object |
一條商品視頻。 |
data.item.videos[].videoId |
string |
商品視頻標識符(文本形式)。 |
data.item.videos[].type |
string |
返回的視頻類型。 |
data.item.videos[].url |
string |
商品視頻地址。 |
data.item.videos[].videoThumbnailURL |
string |
視頻縮略圖的 URL。 |
data.item.videos[].spatialVideoDimension |
string |
返回的視頻尺寸(文本形式)。 |
data.item.videos[].weexRecommendUrl |
string |
隨該視頻返回的相關內容URL。 |
data.item.videoDetail |
object |
商品視頻詳情。 |
data.item.videoDetail.videoId |
string |
商品視頻標識符(文本形式)。 |
data.item.videoDetail.type |
string |
返回的視頻類型。 |
data.item.videoDetail.url |
string |
商品視頻地址。 |
data.item.videoDetail.videoThumbnailURL |
string |
視頻縮略圖的 URL。 |
data.item.videoDetail.spatialVideoDimension |
string |
返回的視頻尺寸(文本形式)。 |
data.item.videoDetail.mainPicList |
array |
隨視頻詳情返回的商品圖片。 |
data.item.videoDetail.mainPicList[] |
string |
一張商品圖片的地址。 |
data.item.vagueSellCount |
string |
商品頁面上顯示的銷量,可能為縮寫形式。 |
data.item.skuText |
string |
用於SKU選擇的顯示文本。 |
data.item.showShopActivitySize |
string |
返回的店鋪活動展示次數(文本形式)。 |
data.price |
object |
報告的商品價格和價格標籤。 |
data.price.price |
object |
主要展示的商品價格。 |
data.price.price.priceText |
string |
主要價格的展示文本。 |
data.price.price.type |
string |
報告的價格類型代碼。 |
data.price.extraPrices |
array |
商品展示的附加價格。 |
data.price.extraPrices[] |
object |
一個附加價格。 |
data.price.extraPrices[].priceText |
string |
此價格的展示文本。 |
data.price.extraPrices[].priceTitle |
string |
與此價格一起顯示的標籤。 |
data.price.extraPrices[].lineThrough |
string |
價格是否顯示刪除線,以文本表示。 |
data.price.extraPrices[].type |
string |
報告的價格類型代碼。 |
data.price.priceTag |
array |
商品價格附近顯示的標籤。 |
data.price.priceTag[] |
object |
一個價格標籤。 |
data.price.priceTag[].text |
string |
標籤上顯示的文本。 |
data.price.priceTag[].bgColor |
string |
標籤的背景顏色。 |
data.price.transmitPrice |
object |
附加價格詳情。 |
data.price.transmitPrice.priceText |
string |
此價格的展示文本。 |
data.skuBase |
object |
商品變體標識符及其規格選項。 |
data.skuBase.props |
array |
商品可用的規格屬性。 |
data.skuBase.props[] |
object |
一個規格屬性。 |
data.skuBase.props[].pid |
string |
規格屬性 ID,以文本返回。 |
data.skuBase.props[].name |
string |
規格屬性的展示名稱。 |
data.skuBase.props[].values |
array |
此屬性的選項。 |
data.skuBase.props[].values[] |
object |
一個規格選項。 |
data.skuBase.props[].values[].vid |
string |
規格選項ID(文本形式)。 |
data.skuBase.props[].values[].name |
string |
選項的展示名稱。 |
data.skuBase.props[].values[].image |
string |
與該選項關聯的圖片URL。 |
data.skuBase.skus |
array |
SKU標識符及其規格組合。 |
data.skuBase.skus[] |
object |
一個SKU組合。 |
data.skuBase.skus[].skuId |
string |
以文本形式表示的SKU ID。使用它在skuCore.sku2info中查找對應條目。 |
data.skuBase.skus[].propPath |
string |
此SKU的屬性和選項ID的編碼路徑。 |
data.skuCore |
object |
報告的變體價格、數量和配送信息。 |
data.skuCore.sku2info |
object |
SKU ID到其報告價格和數量記錄的映射。 |
data.skuCore.sku2info.{key} |
object |
一個SKU條目的報告值。 |
data.skuCore.sku2info.{key}.quantity |
string |
此條目的報告庫存數量,以文本形式表示。 |
data.skuCore.sku2info.{key}.price |
object |
這個條目報告的價格。 |
data.skuCore.sku2info.{key}.price.priceMoney |
string |
報告價格的數字表示,以文本形式返回。 |
data.skuCore.sku2info.{key}.price.priceText |
string |
報告價格的顯示文本。 |
data.skuCore.sku2info.{key}.price.type |
string |
報告的價格類型代碼。 |
data.skuCore.sku2info.{key}.logisticsTime |
string |
此條目的報告配送時間文本。 |
data.skuCore.skuItem |
object |
與變體選擇器一起顯示的配送信息。 |
data.skuCore.skuItem.location |
string |
與變體選擇器一起顯示的位置文本。 |
data.skuCore.skuItem.showAddressTaobao |
string |
以文本形式表示的地址顯示標誌。 |
data.skuCore.abSwitch |
object |
額外的變體顯示設置。 |
data.skuCore.atmosphere |
object |
額外的變體顯示元資料。 |
data.skuTransform |
object |
變體選擇器的額外顯示內容。 |
data.skuTransform.extraText |
string |
與變體選項一起顯示的額外文本。 |
data.skuTransform.skuContents |
array |
為變體選項顯示的額外內容。 |
data.skuTransform.skuContents[] |
object |
一個變體內容條目。 |
data.skuTransform.skuContents[].img |
string |
為規格選項展示的圖片URL |
data.delivery |
object |
商品報告的配送信息 |
data.delivery.from |
string |
報告的發貨地文本 |
data.delivery.to |
string |
報告的配送目的地文本 |
data.delivery.completedTo |
string |
附加配送目的地文本 |
data.delivery.areaId |
string |
配送區域標識符文本 |
data.delivery.postage |
string |
顯示的運費或郵費描述 |
data.delivery.addressWeexUrl |
string |
返回的用於配送地址接口的URL |
data.delivery.overseaContraBandFlag |
string |
表示為文本的海外配送限制標誌 |
data.delivery.extras |
object |
附加配送信息 |
data.consumerProtection |
object |
展示給商品的消費者保障信息 |
data.consumerProtection.items |
array |
顯示的消費者保障條目 |
data.consumerProtection.items[] |
object |
一個消費者保障條目 |
data.consumerProtection.items[].title |
string |
保障條目標題 |
data.consumerProtection.items[].desc |
string |
為保障條目顯示的描述 |
data.consumerProtection.channel |
object |
展示給商品的附加消費者保障信息 |
data.consumerProtection.channel.logo |
string |
為消費者保障渠道展示的標識URL |
data.consumerProtection.channel.title |
string |
為消費者保障渠道顯示的標題 |
data.consumerProtection.passValue |
string |
隨消費者保障信息返回的附加文本 |
data.promotion |
object |
展示給商品的促銷信息 |
data.promotion.entranceTip |
string |
促銷入口顯示的文本。 |
data.promotion.entranceUrl |
string |
促銷入口的 URL。 |
data.promotion.items |
array |
顯示的促銷入口項。 |
data.promotion.items[] |
object |
一個顯示的促銷入口項。 |
data.promotion.items[].content |
string |
主要促銷文本。 |
data.promotion.items[].scontent |
string |
附加促銷文本。 |
data.promotion.items[].bgImage |
string |
主要促銷背景圖片的 URL。 |
data.promotion.items[].sbgImage |
string |
附加促銷背景圖片的 URL。 |
data.promotion.items[].textColor |
string |
促銷入口的文本顏色。 |
data.promotion.items[].type |
string |
上報的促銷類型。 |
data.promotionFloatingData |
object |
促銷浮層的顯示信息。 |
data.promotionFloatingData.promotionName |
string |
顯示的促銷名稱。 |
data.promotionFloatingData.showNow |
string |
當前促銷顯示標誌(文本形式)。 |
data.promotionFloatingData.showWarm |
string |
促銷預覽顯示標誌(文本形式)。 |
data.promotionFloatingData.detailPromotionTimeDO |
object |
促銷展示元資料。 |
data.promotionFloatingData.detailPromotionTimeDO.promotionType |
string |
上報的促銷類型。 |
data.resource |
object |
附加的優惠券、促銷和展示資源。 |
data.resource.coupon |
object |
隨商品返回的優惠券資源。 |
data.resource.coupon.h5LinkUrl |
string |
優惠券頁面的 URL。 |
data.resource.promsCalcInfo |
object |
上報的促銷計算信息。 |
data.resource.promsCalcInfo.cheapestMoney |
string |
上報的此促銷計算的最低金額(以文本形式返回)。 |
data.resource.promsCalcInfo.hasCoupon |
string |
以文本表示的優惠券可用性指示 |
data.resource.promsCalcInfo.hitPromItems |
array |
促銷計算結果返回的促銷條目 |
data.resource.promsCalcInfo.promTip |
object |
促銷計算的展示詳情 |
data.resource.promsCalcInfo.promTip.icon |
string |
隨促銷提示返回的圖標 |
data.resource.promsCalcInfo.promTip.title |
string |
促銷提示的文本 |
data.resource.promsCalcInfo.promTip.useHuaBian |
string |
促銷提示的額外顯示設置 |
data.resource.shopProm |
array |
隨商品返回的店鋪促銷 |
data.resource.shopProm[] |
object |
一個店鋪促銷 |
data.resource.shopProm[].title |
string |
店鋪促銷的標題 |
data.resource.shopProm[].content |
array |
促銷顯示的文本 |
data.resource.shopProm[].content[] |
string |
一個促銷文本條目 |
data.resource.shopProm[].actionUrl |
string |
與促銷關聯的URL |
data.resource.shopProm[].icon |
string |
促銷顯示的圖標 |
data.resource.shopProm[].iconText |
string |
促銷圖標旁顯示的文本 |
data.resource.entrances |
object |
額外的資源入口點 |
data.resource.floatView |
object |
用於浮動顯示的資源 |
data.resource.floatView.list |
array |
浮動顯示返回的條目 |
data.resource.newBigPromotion |
object |
額外的促銷元資料 |
data.trade |
object |
購買和購物車操作的可用性與連結 |
data.trade.buyEnable |
string |
以文本表示的購買可用性標誌 |
data.trade.buyUrl |
string |
購買操作的URL。 |
data.trade.buyParam |
object |
購買操作的附加參數。 |
data.trade.cartEnable |
string |
以文本表示的加入購物車可用性標誌。 |
data.trade.cartJumpUrl |
string |
購物車操作的URL。 |
data.trade.cartParam |
object |
購物車操作的附加參數。 |
data.trade.isBanSale4Oversea |
string |
以文本表示的海外購買限制標誌。 |
data.vertical |
object |
隨商品返回的附加內容模塊。 |
data.vertical.askAll |
object |
商品問答入口。 |
data.vertical.askAll.title |
string |
商品問答部分顯示的標題。 |
data.vertical.askAll.askText |
string |
商品問答入口顯示的文本。 |
data.vertical.askAll.askIcon |
string |
商品問答入口顯示的圖標。 |
data.vertical.askAll.questNum |
string |
以文本表示的問題數量。 |
data.vertical.askAll.linkUrl |
string |
商品問答部分的URL。 |
data.vertical.groupChat |
object |
羣聊信息(如有)。 |
data.vertical.groupChat.title |
string |
顯示的羣聊標題。 |
data.vertical.groupChat.desc |
string |
顯示的羣聊描述。 |
data.vertical.groupChat.image |
string |
羣聊圖片URL。 |
data.vertical.groupChat.fansCount |
string |
以文本表示的關注者數量。 |
data.vertical.groupChat.url |
string |
羣聊入口的URL。 |
data.vertical.transparentBroadcast |
object |
直播視頻信息(如有)。 |
data.vertical.transparentBroadcast.liveId |
string |
以文本形式表示的直播標識符。 |
data.vertical.transparentBroadcast.playUrl |
string |
直播視頻播放的 URL。 |
data.vertical.transparentBroadcast.jumpUrl |
string |
直播入口的 URL。 |
data.vertical.overSeas |
object |
附加海外購物信息。 |
data.vertical.videoFlow |
object |
附加視頻模塊信息。 |
data.vertical.vipComment |
object |
附加評價內容元資料。 |
data.gallery |
object |
附加商品圖庫信息。 |
data.feature |
object |
商品頁面功能設置。 |
data.layout |
object |
商品頁面佈局信息。 |
data.layout.layoutId |
string |
以文本形式表示的上報佈局標識符。 |
data.extendedData |
object |
隨回應返回的附加商品詳情。 |
data.diversion |
object |
附加商品推薦元資料。 |
data.hybrid |
object |
附加嵌入內容元資料。 |
data.skuVertical |
object |
附加SKU模塊信息。 |
data.weappData |
object |
附加應用展示資料。 |
data.debug |
object |
隨商品詳情返回的診斷元資料。 |
data.params |
object |
附加商品頁面元資料。 |
data.traceDatas |
object |
隨商品詳情返回的跟蹤元資料。 |
回應示例
正在載入回應範例…