本文へ移動

JD.com 商品詳細 API (V4) ​

GET
APIの健康状態
正常 利用可能 限られた数 ほとんど利用できない データなし
健康状態を読み込んでいます...

アイテムIDによってJD.comの商品詳細を取得します。カタログ調査や電子商取引分析のために商品情報や画像を確認する際に使用します。

ページングされた顧客コメントについては、JD.com 商品コメント (V1) APIをご覧ください。

ハイライト ​

機能 · 価格

商品の価格情報が利用可能です。

機能 · 属性

グループ化された商品-パラメータテーブルを提供します。

機能 · SKUオプション

SKU識別子、オプション名、および画像を提供します。

機能 · メイン画像とカルーセル画像

選択したSKUのメイン画像とカルーセル画像を提供します。

条件 · 説明画像

img_listにはメイン画像と一部の説明またはイラスト画像が混在している場合があります。より完全な説明画像リストにはV3を使用してください。

パラメータ ​

名前 パラメーターの場所 タイプ 必須 デフォルト 説明
token query string はい - このAPIサービスのアクセストークン。
itemId query string はい - JD.com上のユニークな商品識別子 (item ID)。

コードサンプル ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/jd/get-item-detail/v4?token=YOUR_API_KEY&itemId=VALUE'
text
私はJustOneAPIの"商品詳細 (V4)" APIを使用したいです。
基本URL: https://api.justoneapi.com.
APIパス: /api/jd/get-item-detail/v4?token=YOUR_API_KEY&itemId=VALUE
APIエンドポイント: BASE_URL + /api/jd/get-item-detail/v4?token=YOUR_API_KEY&itemId=VALUE
HTTPメソッド: GET
認証: "token"クエリパラメーターをURLに追加します。
OpenAPI定義: https://docs.justoneapi.com/openapi/jdcom/product-details-v4-ja.json

パラメーター:
- token (query): このAPIサービスのアクセストークン。 (必須)
- itemId (query): JD.com上のユニークな商品識別子 (item ID)。 (必須)

返信形式:実際のContent-Typeに応じて、JSONまたはテキストを安全に処理する。

レスポンスの処理とエラーコード:
1. API の処理結果はレスポンス本文の「code」フィールドで判定します。code が 0 なら成功です。
2. 推奨タイムアウト:リクエストのタイムアウトは 120 秒に設定してください。120 秒が長すぎる場合でも、最低 60 秒を確保してください。一部のリクエストは、結果を受け取る前にタイムアウトすることがあります。
3. 処理結果コード:
   - 0: 成功
   - 100: 無効または停止中のトークン
   - 301: データの取得に失敗しました。再試行してください。
   - 302: 呼び出し頻度の上限を超えました
   - 303: 日次の利用上限を超えました
   - 400: パラメーターが無効です
   - 500: サーバー内部エラー
   - 600: アクセス権限がありません
   - 601: 残高不足
   - 602: トークンの予算上限に達しました
4. コード 601 はアカウントの共有残高不足を示します。コード 602 は使用中の API トークン固有の累積予算上限に達したことを示します。トークンに予算上限を設定しても、共有残高から資金が移動することはありません。

お手伝いください。私が好むプログラミング言語でこのAPIを呼び出し、レスポンスを処理するスクリプトを作成してください。
python
import requests

BASE_URL = "https://api.justoneapi.com"  # オープンAPIサーバーによって提供される

url = BASE_URL + "/api/jd/get-item-detail/v4?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"; // オープンAPIサーバーによって提供される
const url = BASE_URL + "/api/jd/get-item-detail/v4?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"; // オープンAPIサーバーによって提供される
        final String url = BASE_URL + "/api/jd/get-item-detail/v4?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" // オープンAPIサーバーによって提供される

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/jd/get-item-detail/v4?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'; // オープンAPIサーバーによって提供される
$url = $BASE_URL . '/api/jd/get-item-detail/v4?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)。

アイテムの概要8 項目

data.itemOnly

ブランド、カテゴリー、選択可能なSKUを含む商品の概要。

フィールド タイプ 説明
skuId string 要求されたJD SKUの識別子がテキストとして返されました。
skuName string 商品概要で返されるSKUのタイトル。
brandId string JDブランドの識別子がテキストとして返されました。
brandName string JDカタログ内のブランド名。
category array SKUのカテゴリーパスに沿ったJDカテゴリーID。
category[] string 一つのJDカテゴリーID。
venderID string JD販売者の識別子がテキストとして返されました。
isPop boolean 要求されたSKUのJDマーケットプレイスの販売フラグ。
バリエーション15 項目

data.itemOnly

フィールド タイプ 説明
newColorSize array 商品にリストされている選択可能なSKU、要求されたSKUも含む。
newColorSize[] object 一つのリストされたSKUとその仕様値。
newColorSize[].skuId string このバリアントのJD SKUの識別子。
newColorSize[].color string このバリアントに表示される色または最初の仕様ラベル。
newColorSize[].size string サイズ、容量、または二番目の仕様ラベル。利用できる場合に返されます。
newColorSize[].spec string 利用可能な場合の追加仕様値。
newColorSize[].specName string 利用可能な場合の追加仕様の名前。
newColorSize[].imagePath string このバリアントの画像参照。
saleProp object 販売プロパティIDから表示名へのマッピング。
saleProp.{key} string 販売プロパティの表示名。
salePropSeq object 販売プロパティIDから仕様値の順序付けリストへのマッピング。
salePropSeq.{key} array この販売プロパティの順序付けされた仕様値。
salePropSeq.{key}[] string 一つの仕様値をテキスト形式で。
spAttr object 仕様名からSKUで表示される値へのマッピング。
spAttr.{key} string この仕様の表示値。
選択されたSKUの詳細20 項目

data.itemInfo.product

詳細な商品と選択されたSKU情報。

フィールド タイプ 説明
skuId string 詳細な商品セクションでのJD SKU識別子。
skuName string 詳細な商品セクションでの商品タイトル。このタイトルは商品概要タイトルとは異なる場合があります。
realSpuId string JDが報告するSPU識別子、テキスト形式で返されます。
brandId string 詳細な商品セクションでのJDブランドID。
brandName string 詳細な商品セクションでのブランド名。
cat1 string 一級JDカテゴリID。
cat2 string 二級JDカテゴリID。
cat3 string 三級JDカテゴリID。
color string 選択されたSKUの色または第一の仕様ラベル。
size string 選択されたSKUのサイズ、容量、または第二の仕様ラベル(利用可能な場合)。
spec string 選択されたSKUの追加仕様値(利用可能な場合)。
specName string 選択されたSKUの追加仕様名(利用可能な場合)。
imageurl string 詳細な商品セクションでの選択されたSKUの画像参照。
venderId string 詳細な商品セクションでの売り手ID、テキスト形式で返されます。
shopId string 詳細な商品セクションでのショップID、テキスト形式で返されます。
model string 商品モデルラベルが利用可能な場合。
length string 商品の長さが報告され、テキストとして返されます。
width string 商品の幅が報告され、テキストとして返されます。
height string 商品の高さが報告され、テキストとして返されます。
weight string 商品の重量が報告され、テキストとして返されます。
価格10 項目

data

フィールド タイプ 説明
itemInfo.priceFloor object 詳細商品セクションからの表示価格情報。
itemInfo.priceFloor.price string JDの価格表示テキスト。このフィールドには小数値が含まれることがあります。
itemInfo.priceFloor.ext object 追加の価格表示情報。
itemInfo.priceFloor.ext.jdPrice string 拡張表示情報からのJD価格テキスト。
priceInfo object このSKUに対して返される価格データ。
priceInfo.skuId integer この価格記録で使用されるJD SKU識別子、整数として返されます。
priceInfo.jdPrice number この価格セクションで報告されるJDの数値価格。
priceInfo.productPrice object 追加の数値商品価格。
priceInfo.productPrice.jdPrice number 商品価格詳細内のJDの数値価格。
priceInfo.productPrice.marketPrice number JDが利用可能な場合に報告される市場参考価格。
画像と説明5 項目

data

フィールド タイプ 説明
itemOnly.image array 商品概要に添付された画像参照。
itemOnly.image[] string 一つの概要画像参照。
img_list array 商品画像ギャラリーは項目概要から別途返されます。
img_list[] string 一つの商品ギャラリー画像参照。
description string HTML文字列としてのJD商品説明。
商品属性16 項目

data

フィールド タイプ 説明
products_introduction array 構造化された商品属性グループ。
products_introduction[] object 一つの商品属性グループ。
products_introduction[].groupName string 利用可能な場合の商品属性グループの表示名。
products_introduction[].atts array このグループの属性。
products_introduction[].atts[] object 一つの名前付き商品属性。
products_introduction[].atts[].attName string 属性の表示名。
products_introduction[].atts[].categoryGroupAttId string カテゴリグループ属性IDがテキストとして返されます。
products_introduction[].atts[].attRemark string 属性が利用可能な場合の備考。
products_introduction[].atts[].vals array 属性のリスト表示値。
products_introduction[].atts[].vals[] string テキスト形式の表示値一つ。
products_introduction[].atts[].attVals array 属性の構造化値。
products_introduction[].atts[].attVals[] object 構造化された属性値一つ。
products_introduction[].atts[].attVals[].attValId integer 属性値IDが利用可能な場合。
products_introduction[].atts[].attVals[].attValName string 属性値の表示名。
products_introduction[].atts[].attVals[].attValueDefinition string 属性値の定義テキストが利用可能な場合。
products_introduction[].atts[].attVals[].orderSort integer 属性値の順序位置の報告。
ショップと販売者5 項目

data

フィールド タイプ 説明
shop_infos object SKUと共に返されるJDショップと販売者情報。
shop_infos.shopId integer 整数として返されるJDショップ識別子。
shop_infos.shopName string ショップの表示名。
shop_infos.venderId integer 整数として返されるJD販売者識別子。
shop_infos.vender string JDが表示する販売者名。

レスポンス例 ​

レスポンスのサンプルを読み込んでいます...