跳至主要內容

1688商品詳情 API (V1) ​

GET
API 端點健康狀態
健康 可用 少量可用 基本不可用 暫無資料
正在載入健康狀態…

通過商品ID獲取1688批發商品的公開詳情。用於在產品採購或目錄研究時審查已知報價。

請求參數 ​

參數名 位置 類型 必填 預設值 說明
token query string 是 - 此 API 服務的訪問令牌。
itemId query string 是 - 1688上的唯一商品標識符。

程式碼範例 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/1688/get-item-detail/v1?token=YOUR_API_KEY&itemId=VALUE'
text
我想使用 JustOneAPI 提供的“商品詳情 (V1)”接口。
接入地址: https://api.justoneapi.com。
接口路徑: /api/1688/get-item-detail/v1?token=YOUR_API_KEY&itemId=VALUE
接口地址: BASE_URL + /api/1688/get-item-detail/v1?token=YOUR_API_KEY&itemId=VALUE
HTTP 方法: GET
身份驗證: 在 URL 中傳入 token 查詢參數。
OpenAPI 定義: https://docs.justoneapi.com/openapi/1688/product-details-v1-zh-hant.json

請求參數說明:
- token (query): 此 API 服務的訪問令牌。 (必填)
- itemId (query): 1688上的唯一商品標識符。 (必填)

返回格式: 請根據實際 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/1688/get-item-detail/v1?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/1688/get-item-detail/v1?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/1688/get-item-detail/v1?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/1688/get-item-detail/v1?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/1688/get-item-detail/v1?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)的主要返回欄位。

商品與店鋪15 個欄位

data

以下欄位適用於對象類型的 data,描述查詢的 1688 商品。接口呼叫成功但未返回商品詳情時,data 可能為空字符串。

欄位 類型 說明
item object 商品基本信息及商家的店鋪展示資料。
item.offerId string 1688 商品 ID,以文本返回。
item.offerTitle string 商品的展示標題。
item.companyName string 商家展示的企業名稱。
item.winportUrl string 商家展示的店鋪連結。
item.defaultOfferImg string 商品預設展示圖片的連結。
item.offerUnit string 商品展示的銷售單位。
item.saleOut boolean 商品是否標記為售罄。
item.price string 商品概要返回的價格展示文本。
item.saledCount integer 商品信息返回的銷量。
item.saledCountStr string 商品返回的銷量展示文本。
item.topCategoryId string 商品返回的頂級類目 ID,以文本返回。
item.postCategoryId string 商品返回的發佈類目 ID,以文本返回。
item.businessType string 該商品條目返回的業務類型標籤。
item.consignOffer boolean 商品條目是否標記為分銷商品。
商品圖與視頻45 個欄位

data

欄位 類型 說明
mainPic object 使用此媒體佈局時返回的商品圖片組。
mainPic.offerId string 1688 商品 ID,以文本返回。
mainPic.isPrivacy boolean 媒體組是否標記為私密。
mainPic.videoUrl string 媒體組返回的視頻連結,可能為空字符串。
mainPic.videoId integer 媒體組返回的數字視頻 ID。
mainPic.offerImgList array 該媒體組中的商品圖片連結。
mainPic.offerImgList[] string 媒體組中一張商品圖片的連結。
mainPic.offerImages array 帶類型標記的商品圖片。
mainPic.offerImages[] object 該商品媒體組中的一張圖片。
mainPic.offerImages[].imgUrl string 商品圖片連結。
mainPic.offerImages[].type string 商品圖片類型代碼,以文本返回。
mainPic.offerImages[].typeDes string 商品圖片類型的展示描述。
mainPic.offerInfoModel object 該媒體組附帶的商品概要。
mainPic.offerInfoModel.offerId integer 1688 商品 ID,以整數返回。
mainPic.offerInfoModel.title string 媒體組返回的商品標題。
mainPic.offerInfoModel.price string 媒體組返回的價格展示文本。
mainPic.skuImages array 與 SKU 規格選項名稱關聯的圖片。
mainPic.skuImages[] object 一張 SKU 規格選項圖片。
mainPic.skuImages[].imgUrl string SKU 規格選項圖片連結。
mainPic.skuImages[].name string 與該圖片關聯的 SKU 規格選項展示名稱。
mainPic.skuImages[].type string SKU 規格選項圖片的類型代碼。
video object 視頻媒體組。當商品媒體通過 mainPic 返回時,此對象可能為空。
video.offerId string 1688 商品 ID,以文本返回。
video.isPrivacy boolean 媒體組是否標記為私密。
video.videoUrl string 媒體組返回的視頻連結,可能為空字符串。
video.videoId integer 媒體組返回的數字視頻 ID。
video.offerImgList array 該媒體組中的商品圖片連結。
video.offerImgList[] string 媒體組中一張商品圖片的連結。
video.offerImages array 帶類型標記的商品圖片。
video.offerImages[] object 該商品媒體組中的一張圖片。
video.offerImages[].imgUrl string 商品圖片連結。
video.offerImages[].type string 商品圖片類型代碼,以文本返回。
video.offerImages[].typeDes string 商品圖片類型的展示描述。
video.offerInfoModel object 該媒體組附帶的商品概要。
video.offerInfoModel.offerId integer 1688 商品 ID,以整數返回。
video.offerInfoModel.title string 媒體組返回的商品標題。
video.offerInfoModel.price string 媒體組返回的價格展示文本。
images array 商品圖片條目及其不同規格的連結。
images[] object 一項商品圖片。
images[].imageURI string 商品圖片返回的主連結。
images[].fullPathImageURI string 商品圖片返回的完整連結。
images[].size220x220ImageURI string 220×220 規格欄位返回的圖片連結。
images[].size310x310ImageURI string 310×310 規格欄位返回的圖片連結。
images[].searchImageURI string 搜索展示使用的圖片連結。
images[].summImageURI string 商品返回的摘要圖連結。
商品描述與屬性23 個欄位

data

欄位 類型 說明
title object 商品標題和展示標籤。
title.offerId integer 1688 商品 ID,以整數返回。
title.title string 商品頁標題區顯示的標題。
title.selledNumber string 標題附近展示的銷量文本。
title.wantBuy string 標題附近展示的購買意向文字,有資料時返回。
title.tagList array 標題附近展示的標籤,數組可能為空。
title.tagList[] string 商品展示標籤的文本。
title.scrollList array 商品標題區返回的滾動展示文本。
title.scrollList[] object 標題區的一項展示文字。
title.scrollList[].prefix string 主體標籤之前展示的文字。
title.scrollList[].text string 標題區該展示條目的主體文字。
title.scrollList[].suffix string 主體標籤之後展示的文字。
description object 商品詳情描述信息。
description.detailUrl string 商品擴展詳情描述的平台連結。
description.isUseNewDetail boolean 商品詳情描述是否使用較新的詳情格式。
attribute object 商品屬性及其展示值。
attribute.offerId integer 1688 商品 ID,以整數返回。
attribute.title string 商品屬性區展示的標題。
attribute.propsList array 商品展示的屬性名稱和值。
attribute.propsList[] object 一項展示的商品屬性。
attribute.propsList[].name string 商品屬性的展示名稱。
attribute.propsList[].value string 商品屬性的展示值。
attribute.propsList[].show boolean 該屬性是否標記為展示。
價格與數量階梯18 個欄位

data

欄位 類型 說明
price object 商品價格、展示單位和數量階梯。
price.displayType string 商品返回的價格展示類型標籤。
price.unit string 商品價格旁展示的單位。
price.priceModel object 商品按數量返回的價格階梯。
price.priceModel.priceDisplayType string 價格模型中的展示類型代碼。
price.priceModel.currentPrices array 按訂購數量返回的當前價格階梯。
price.priceModel.currentPrices[] object 一個起訂數量對應的價格檔位。
price.priceModel.currentPrices[].price string 該數量檔位的價格,以展示文本返回。
price.priceModel.currentPrices[].beginAmount integer 該價格檔位對應的起訂數量。
price.priceModel.originalPrices array 按訂購數量返回的原價階梯,有資料時返回。
price.priceModel.originalPrices[] object 一個起訂數量對應的價格檔位。
price.priceModel.originalPrices[].price string 該數量檔位的價格,以展示文本返回。
price.priceModel.originalPrices[].beginAmount integer 該價格檔位對應的起訂數量。
price.priceModel.originalPriceDisplay string 原價展示文本,有資料時返回。
price.priceModel.currentPricesWithOnePiece array 包含單件價格的當前數量階梯,有資料時返回。
price.priceModel.currentPricesWithOnePiece[] object 一個起訂數量對應的價格檔位。
price.priceModel.currentPricesWithOnePiece[].price string 該數量檔位的價格,以展示文本返回。
price.priceModel.currentPricesWithOnePiece[].beginAmount integer 該價格檔位對應的起訂數量。
優惠券與促銷27 個欄位

data

欄位 類型 說明
coupon object | array 有資料時返回優惠券信息。此欄位也可能返回空數組。
coupon.offerId integer 1688 商品 ID,以整數返回。
coupon.buttonName string 優惠券操作按鈕的展示文字。
coupon.pageName string 優惠券區域的展示名稱。
coupon.couponRuleLinkText string 優惠券規則連結的展示文字。
coupon.couponList array 商品條目附帶的優惠券標籤。
coupon.couponList[] object 一項優惠券展示標籤。
coupon.couponList[].couponType string 該優惠券返回的類型代碼。
coupon.couponList[].couponContent string 該優惠券的展示文字。
coupon.couponInfoList array 優惠券的詳細展示組,有資料時返回。
coupon.couponInfoList[] object 一組優惠券詳細展示信息。
coupon.couponInfoList[].name string 優惠券分組的展示名稱。
coupon.couponInfoList[].summary string 優惠券分組的展示摘要。
coupon.couponInfoList[].buttonName string 優惠券分組操作按鈕的展示文字。
coupon.couponInfoList[].type string 優惠券分組返回的類型代碼。
coupon.couponInfoList[].promotionItems array 該優惠券展示組內的促銷條目。
coupon.couponInfoList[].promotionItems[] object 一項優惠券促銷條目。
coupon.couponInfoList[].promotionItems[].summary string 促銷活動展示的摘要。
coupon.couponInfoList[].promotionItems[].label string 促銷活動返回的展示標籤。
coupon.couponInfoList[].promotionItems[].promotionDisplayName string 優惠券中展示的促銷活動名稱。
coupon.couponInfoList[].promotionItems[].availablePeriod string 促銷活動展示的可用時段。
coupon.couponInfoList[].promotionItems[].startTime string 促銷開始時間,以文本返回。
coupon.couponInfoList[].promotionItems[].endTime string 促銷結束時間,以文本返回。
coupon.couponInfoList[].promotionItems[].detail string 促銷活動的詳細展示文字。
coupon.couponInfoList[].promotionItems[].discountFee string 折扣金額,以展示文本返回。
coupon.couponInfoList[].promotionItems[].applied boolean 促銷活動是否標記為已應用。
coupon.couponInfoList[].promotionItems[].canApply boolean 促銷活動是否標記為可應用。
配送與保障30 個欄位

data

欄位 類型 說明
delivery object 商品條目返回的發貨與買家保障信息。
delivery.offerId integer 1688 商品 ID,以整數返回。
delivery.location string 商品展示的發貨地。
delivery.logistics string 商品返回的物流展示文本。
delivery.deliveryLimitTxt string 發貨或送達承諾的展示文本。
delivery.postFree boolean 本次回應是否將運費標記為免費。
delivery.postFeeValue integer 該商品條目返回的數字運費值。
delivery.templateId integer 返回的運費模板標識。
delivery.unitWeight integer 發貨信息返回的單位重量值。
delivery.skuWeight object 以返回的 SKU 標識為鍵的重量值。
delivery.skuWeight.{key} number 該 SKU 鍵對應的重量值。
delivery.deliveryLimitTimeModel object 該商品條目返回的發貨時效承諾詳情。
delivery.deliveryLimitTimeModel.limitTimeDay integer 發貨時效限制返回的天數。
delivery.deliveryLimitTimeModel.limitTimeDesc string 發貨時效限制的展示說明。
delivery.deliveryLimitTimeModel.expectTimeDesc string 預計發貨時間的展示說明。
delivery.protectionInfos array 發貨信息中的保障服務。
delivery.protectionInfos[] object 一項展示的服務或保障。
delivery.protectionInfos[].serviceName string 服務的展示名稱。
delivery.protectionInfos[].serviceCode string 服務返回的代碼。
delivery.protectionInfos[].description string 保障服務的展示說明。
delivery.protectionInfos[].longDescription string 保障服務的詳細說明。
delivery.protectionInfos[].buyerDescription string 面向買家的保障服務說明。
delivery.protectionInfos[].agreeDeliveryHours integer 返回的約定時效,單位為小時。
delivery.buyerProtectionModel array 發貨信息中另行展示的買家保障條目。
delivery.buyerProtectionModel[] object 一項展示的服務或保障。
delivery.buyerProtectionModel[].serviceName string 服務的展示名稱。
delivery.buyerProtectionModel[].serviceCode string 服務返回的代碼。
delivery.buyerProtectionModel[].enabled boolean 買家保障條目是否標記為啓用。
delivery.buyerProtectionModel[].shortBuyerDesc string 面向買家的簡短說明。
delivery.buyerProtectionModel[].textDesc string 買家保障條目的展示說明。
商品服務與購買方式21 個欄位

data

欄位 類型 說明
service object 商品展示的服務及說明。
service.offerId integer 1688 商品 ID,以整數返回。
service.service1 string 商品返回的第一項服務展示文字。
service.service2 string 第二項服務展示文字,有資料時返回。
service.service3 string 第三項服務展示文字,有資料時返回。
service.serviceDetail array 已展示服務的詳細信息。
service.serviceDetail[] object 一項展示的服務或保障。
service.serviceDetail[].serviceName string 服務的展示名稱。
service.serviceDetail[].serviceCode string 服務返回的代碼。
service.serviceDetail[].description string 服務展示的說明。
service.serviceDesc array 商品條目附帶的服務說明項。
service.serviceDesc[] object 一項展示的服務或保障。
service.serviceDesc[].serviceName string 服務的展示名稱。
service.serviceDesc[].serviceCode string 服務返回的代碼。
service.serviceDesc[].type string 服務說明項返回的類型標籤。
order object 商品條目展示的購買方式。
order.sceneList array 商品展示的購買方式。
order.sceneList[] object 一項展示的購買選項。
order.sceneList[].sceneName string 購買方式的展示名稱。
order.selectedScene object 商品條目中標記為已選的購買方式。
order.selectedScene.sceneName string 已選購買方式的展示名稱。

回應示例 ​

正在載入回應範例…