---
title: "Taobao dan Tmall Detail Produk API (V4)"
description: "Mendapatkan detail produk Taobao atau Tmall berdasarkan ID item melalui endpoint V4. Gunakan untuk pencarian produk langsung untuk penelitian katalog, pemantauan produk, atau analisis e-commerce."
lastUpdated: false
aiUsagePrompt: true
---

# Taobao dan Tmall Detail Produk API \(V4\)

<ApiTester
  method="GET"
  :path='JSON.parse("\"/api/taobao/get-item-detail/v4\"")'
  :summary='JSON.parse("\"Detail Produk (V4)\"")'
  openapiDefinitionUrl="https://docs.justoneapi.com/openapi/taobao-and-tmall/product-details-v4-id.json"
  openapiVersion="3.1.0"
  :parameters='JSON.parse("[{\"name\":\"token\",\"in\":\"query\",\"description\":\"Token akses untuk layanan API ini.\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"itemId\",\"in\":\"query\",\"description\":\"Identifikasi produk unik di Taobao/Tmall (ID item).\",\"required\":true,\"schema\":{\"type\":\"string\"}}]")'
  :requestBody='JSON.parse("null")'
  :responses='JSON.parse("{\"200\":{\"description\":\"OK\",\"content\":{\"application/json\":{\"schema\":{\"if\":{\"properties\":{\"code\":{\"const\":0}},\"required\":[\"code\"]},\"then\":{\"properties\":{\"data\":{\"type\":[\"object\",\"null\"],\"description\":\"Detail produk Taobao atau Tmall dengan informasi item, entri SKU, dan opsi spesifikasi.\",\"properties\":{\"itemId\":{\"type\":\"integer\",\"description\":\"ID item Taobao atau Tmall yang dikembalikan sebagai bilangan bulat.\"},\"title\":{\"type\":\"string\",\"description\":\"Judul produk.\"},\"itemPic\":{\"type\":\"string\",\"description\":\"URL gambar utama produk.\"},\"images\":{\"type\":\"array\",\"description\":\"URL gambar produk.\",\"items\":{\"type\":\"string\",\"description\":\"URL gambar produk.\"}},\"itemPrice\":{\"type\":\"integer\",\"description\":\"Nilai harga yang dilaporkan pada tingkat produk sebagai bilangan bulat.\"},\"DiscountPrice\":{\"type\":\"integer\",\"description\":\"Nilai harga diskon yang dilaporkan pada tingkat produk sebagai bilangan bulat.\"},\"shopName\":{\"type\":\"string\",\"description\":\"Nama publik toko yang ditampilkan.\"},\"shopType\":{\"type\":\"string\",\"description\":\"Label jenis toko yang dilaporkan bersama dengan produk.\"},\"sku2info\":{\"type\":\"array\",\"description\":\"Daftar entri SKU, masing-masing dengan identifikasi dan opsi spesifikasi yang dipilih.\",\"items\":{\"type\":\"object\",\"description\":\"Satu entri SKU.\",\"properties\":{\"skuId\":{\"type\":\"string\",\"description\":\"ID SKU, dikembalikan sebagai string.\"},\"skuName\":{\"type\":\"string\",\"description\":\"Nama tampilan SKU.\"},\"skuPicUrl\":{\"type\":[\"string\",\"null\"],\"description\":\"URL gambar SKU jika tersedia.\"},\"valueList\":{\"type\":\"array\",\"description\":\"ID opsi spesifikasi yang dipilih untuk SKU ini. Mereka sesuai dengan valueId dalam skuBase.\",\"items\":{\"type\":\"string\",\"description\":\"Satu ID opsi spesifikasi yang dipilih.\"}},\"itemPrice\":{\"type\":\"integer\",\"description\":\"Nilai harga item yang dilaporkan dengan SKU ini, sebagai bilangan bulat.\"},\"finalPrice\":{\"type\":\"integer\",\"description\":\"Nilai harga akhir yang dilaporkan dengan entri SKU ini, sebagai bilangan bulat.\"},\"finalSkuPrice\":{\"type\":\"integer\",\"description\":\"Harga SKU akhir yang dilaporkan sebagai bilangan bulat.\"},\"thirdOriginalDiscountPrice\":{\"type\":\"integer\",\"description\":\"Harga diskon asli yang dilaporkan dengan SKU, sebagai bilangan bulat.\"},\"subsidyAmount\":{\"type\":[\"integer\",\"null\"],\"description\":\"Jumlah subsidi yang dilaporkan untuk SKU jika tersedia.\"},\"priceIncludesGovSubsidy\":{\"type\":[\"boolean\",\"null\"],\"description\":\"Apakah harga yang dilaporkan ditandai dengan adanya subsidi pemerintah, jika tersedia.\"},\"stock\":{\"type\":\"string\",\"description\":\"Jumlah stok yang dilaporkan untuk SKU ini dalam bentuk string.\"}}}},\"skuBase\":{\"type\":\"array\",\"description\":\"Properti spesifikasi dan opsi yang tersedia.\",\"items\":{\"type\":\"object\",\"description\":\"Satu properti spesifikasi dan daftar opsi-nya.\",\"properties\":{\"propertyId\":{\"type\":\"string\",\"description\":\"ID properti spesifikasi, dikembalikan sebagai string.\"},\"propertyName\":{\"type\":\"string\",\"description\":\"Nama tampilan atribut spesifikasi.\"},\"itemPropertyValues\":{\"type\":\"array\",\"description\":\"Opsi spesifikasi yang tersedia untuk properti spesifikasi ini.\",\"items\":{\"type\":\"object\",\"description\":\"Satu opsi spesifikasi yang dapat dipilih.\",\"properties\":{\"valueId\":{\"type\":\"string\",\"description\":\"ID opsi spesifikasi, dikembalikan sebagai string.\"},\"value\":{\"type\":\"string\",\"description\":\"Nilai tampilan dari opsi spesifikasi tersebut.\"},\"pic\":{\"type\":[\"string\",\"null\"],\"description\":\"URL gambar opsi spesifikasi jika tersedia.\"}}}}}}}}}}},\"allOf\":[{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}]}}}},\"400\":{\"description\":\"Parameter atau isi permintaan yang tidak valid\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"401\":{\"description\":\"Token akses yang tidak valid atau tidak aktif\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"403\":{\"description\":\"Izin ditolak\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"429\":{\"description\":\"Laju permintaan atau batas kuota harian terlampaui\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"500\":{\"description\":\"Kesalahan server internal\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}},\"503\":{\"description\":\"Layanan sementara tidak tersedia\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"code\":{\"type\":\"integer\",\"format\":\"int32\",\"enum\":[0,100,101,202,300,301,302,303,400,404,500,503,600,601,602]},\"message\":{\"type\":[\"string\",\"null\"]},\"data\":{},\"recordTime\":{\"type\":[\"string\",\"null\"]},\"requestId\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"requestParams\":{\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"body\":{\"type\":\"object\",\"properties\":{\"empty\":{\"type\":\"boolean\"},\"array\":{\"type\":\"boolean\"},\"null\":{\"type\":\"boolean\"},\"object\":{\"type\":\"boolean\"},\"float\":{\"type\":\"boolean\"},\"integralNumber\":{\"type\":\"boolean\"},\"floatingPointNumber\":{\"type\":\"boolean\"},\"valueNode\":{\"type\":\"boolean\"},\"nodeType\":{\"type\":\"string\",\"enum\":[\"ARRAY\",\"BINARY\",\"BOOLEAN\",\"MISSING\",\"NULL\",\"NUMBER\",\"OBJECT\",\"POJO\",\"STRING\"]},\"string\":{\"type\":\"boolean\"},\"missingNode\":{\"type\":\"boolean\"},\"container\":{\"type\":\"boolean\"},\"pojo\":{\"type\":\"boolean\"},\"short\":{\"type\":\"boolean\"},\"int\":{\"type\":\"boolean\"},\"long\":{\"type\":\"boolean\"},\"double\":{\"type\":\"boolean\"},\"bigDecimal\":{\"type\":\"boolean\"},\"bigInteger\":{\"type\":\"boolean\"},\"textual\":{\"type\":\"boolean\",\"deprecated\":true},\"boolean\":{\"type\":\"boolean\"},\"binary\":{\"type\":\"boolean\"},\"number\":{\"type\":\"boolean\"},\"embeddedValue\":{\"type\":\"boolean\"}}}}}},\"required\":[\"code\",\"data\",\"message\",\"recordTime\"]}}}}}")'
  :servers='JSON.parse("[{\"url\":\"https://api.justoneapi.com\",\"description\":\"API produksi global (default)\"}]")'
  :security='JSON.parse("[]")'
  :securitySchemes='JSON.parse("{}")'
  :schemas='JSON.parse("{}")'
/>

<ApiHealthSection :api='JSON.parse("\"/api/taobao/get-item-detail/v4\"")' />

<p>Mendapatkan detail produk Taobao atau Tmall berdasarkan ID item melalui endpoint V4. Gunakan untuk pencarian produk langsung untuk penelitian katalog, pemantauan produk, atau analisis e-commerce.</p>

## Hal-hal penting

::: warning Kondisi · Harga
<p>Mengembalikan harga produk asli dan harga SKU. Harga produk dan SKU akhir tersedia untuk beberapa produk.</p>
:::

::: warning Keterbatasan · Atribut
<p>Tabel parameter produk tidak dikembalikan dalam sampel yang terverifikasi.</p>
:::

::: info Kemampuan · Opsi SKU
<p>Menyediakan identifikasi SKU, opsi spesifikasi, dan informasi jumlah.</p>
:::

::: info Kemampuan · Gambar utama dan gambar carousel
<p>Menyediakan gambar utama dan gambar carousel produk.</p>
:::

::: warning Keterbatasan · Gambar deskripsi
<p>Gambar deskripsi dan HTML deskripsi tidak dikembalikan dalam sampel yang terverifikasi.</p>
:::

::: tip Kondisi
<p>Beberapa produk mungkin tidak tersedia melalui endpoint ini.</p>
:::

## Parameter

<div class="api-doc-table api-doc-table--params">

| Nama | Lokasi | Jenis | Wajib | Bawaan | Deskripsi |
| --- | --- | --- | --- | --- | --- |
| <code>token</code> | query | <code>string</code> | Ya | - | Token akses untuk layanan API ini. |
| <code>itemId</code> | query | <code>string</code> | Ya | - | Identifikasi produk unik di Taobao/Tmall (ID item). |

</div>

## Contoh Kode

::: code-group

```bash [🐚 cURL]
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/taobao/get-item-detail/v4?token=YOUR_API_KEY&itemId=VALUE'
```

```text [🤖 Prompt AI]
Saya ingin menggunakan API "Detail Produk (V4)" dari JustOneAPI.
URL dasar: https://api.justoneapi.com.
Jalur API: /api/taobao/get-item-detail/v4?token=YOUR_API_KEY&itemId=VALUE
Endpoint API: BASE_URL + /api/taobao/get-item-detail/v4?token=YOUR_API_KEY&itemId=VALUE
Metode HTTP: GET
Autentikasi: Tambahkan parameter query "token" ke URL.
Definisi OpenAPI: https://docs.justoneapi.com/openapi/taobao-and-tmall/product-details-v4-id.json

Parameter:
- token (query): Token akses untuk layanan API ini. (Wajib)
- itemId (query): Identifikasi produk unik di Taobao/Tmall (ID item). (Wajib)

Format Kembalian: tangani dengan aman JSON atau teks sesuai dengan Content-Type yang sebenarnya.

Penanganan respons dan kode kesalahan:
1. Tentukan hasil pemrosesan dari kolom "code" dalam isi respons (code 0 berarti berhasil).
2. Batas waktu yang disarankan: Atur batas waktu permintaan menjadi 120 detik. Jika 120 detik terlalu lama untuk kebutuhan Anda, gunakan setidaknya 60 detik. Sebagian kecil permintaan mungkin mencapai batas waktu sebelum hasil diterima.
3. Kode hasil:
   - 0: Berhasil
   - 100: Token tidak valid atau tidak aktif
   - 301: Gagal mengambil data. Silakan coba lagi.
   - 302: Batas frekuensi permintaan terlampaui
   - 303: Kuota harian terlampaui
   - 400: Parameter tidak valid
   - 500: Kesalahan internal server
   - 600: Akses ditolak
   - 601: Saldo tidak mencukupi
   - 602: Batas anggaran token tercapai
4. Kode 601 berarti saldo bersama akun tidak mencukupi. Kode 602 berarti token API yang digunakan telah mencapai batas anggaran kumulatifnya sendiri. Menetapkan batas anggaran token tidak memindahkan dana dari saldo bersama akun.

Tolong bantu saya menulis skrip dalam bahasa pemrograman favorit saya untuk memanggil API ini dan menangani responsnya.
```

```python [🐍 Python]
import requests

BASE_URL = "https://api.justoneapi.com"  # Diberikan oleh server OpenAPI

url = BASE_URL + "/api/taobao/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 [🌐 JavaScript]
const BASE_URL = "https://api.justoneapi.com"; // Diberikan oleh server OpenAPI
const url = BASE_URL + "/api/taobao/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 [☕ 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"; // Diberikan oleh server OpenAPI
        final String url = BASE_URL + "/api/taobao/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 [🐹 Go]
package main

import (
	"fmt"
	"io"
	"os"
	"strings"
	"net/http"
	"time"
)

const BASE_URL = "https://api.justoneapi.com" // Diberikan oleh server OpenAPI

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/taobao/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]
<?php
$BASE_URL = 'https://api.justoneapi.com'; // Diberikan oleh server OpenAPI
$url = $BASE_URL . '/api/taobao/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;
}
```

:::

<div style="text-align: right; margin-top: -20px; margin-bottom: 20px;">
<a href="/openapi/taobao-and-tmall/product-details-v4-id.json" target="_blank" style="font-size: 12px; color: var(--vp-c-text-3); text-decoration: none; opacity: 0.8;">[Definisi OpenAPI (JSON)]</a>
</div>

## Field Respons

Field Kunci dalam respons yang sukses (`code = 0`).

<div class="api-doc-table api-doc-table--response">

| Jalur Field | Jenis | Deskripsi |
| --- | --- | --- |
| <code>data</code> | <code>object &#124; null</code> | Detail produk Taobao atau Tmall dengan informasi item, entri SKU, dan opsi spesifikasi. |
| <code>data.itemId</code> | <code>integer</code> | ID item Taobao atau Tmall yang dikembalikan sebagai bilangan bulat. |
| <code>data.title</code> | <code>string</code> | Judul produk. |
| <code>data.itemPic</code> | <code>string</code> | URL gambar utama produk. |
| <code>data.images</code> | <code>array</code> | URL gambar produk. |
| <code>data.images[]</code> | <code>string</code> | URL gambar produk. |
| <code>data.itemPrice</code> | <code>integer</code> | Nilai harga yang dilaporkan pada tingkat produk sebagai bilangan bulat. |
| <code>data.DiscountPrice</code> | <code>integer</code> | Nilai harga diskon yang dilaporkan pada tingkat produk sebagai bilangan bulat. |
| <code>data.shopName</code> | <code>string</code> | Nama publik toko yang ditampilkan. |
| <code>data.shopType</code> | <code>string</code> | Label jenis toko yang dilaporkan bersama dengan produk. |
| <code>data.sku2info</code> | <code>array</code> | Daftar entri SKU, masing-masing dengan identifikasi dan opsi spesifikasi yang dipilih. |
| <code>data.sku2info[]</code> | <code>object</code> | Satu entri SKU. |
| <code>data.sku2info[].skuId</code> | <code>string</code> | ID SKU, dikembalikan sebagai string. |
| <code>data.sku2info[].skuName</code> | <code>string</code> | Nama tampilan SKU. |
| <code>data.sku2info[].skuPicUrl</code> | <code>string &#124; null</code> | URL gambar SKU jika tersedia. |
| <code>data.sku2info[].valueList</code> | <code>array</code> | ID opsi spesifikasi yang dipilih untuk SKU ini. Mereka sesuai dengan valueId dalam skuBase. |
| <code>data.sku2info[].valueList[]</code> | <code>string</code> | Satu ID opsi spesifikasi yang dipilih. |
| <code>data.sku2info[].itemPrice</code> | <code>integer</code> | Nilai harga item yang dilaporkan dengan SKU ini, sebagai bilangan bulat. |
| <code>data.sku2info[].finalPrice</code> | <code>integer</code> | Nilai harga akhir yang dilaporkan dengan entri SKU ini, sebagai bilangan bulat. |
| <code>data.sku2info[].finalSkuPrice</code> | <code>integer</code> | Harga SKU akhir yang dilaporkan sebagai bilangan bulat. |
| <code>data.sku2info[].thirdOriginalDiscountPrice</code> | <code>integer</code> | Harga diskon asli yang dilaporkan dengan SKU, sebagai bilangan bulat. |
| <code>data.sku2info[].subsidyAmount</code> | <code>integer &#124; null</code> | Jumlah subsidi yang dilaporkan untuk SKU jika tersedia. |
| <code>data.sku2info[].priceIncludesGovSubsidy</code> | <code>boolean &#124; null</code> | Apakah harga yang dilaporkan ditandai dengan adanya subsidi pemerintah, jika tersedia. |
| <code>data.sku2info[].stock</code> | <code>string</code> | Jumlah stok yang dilaporkan untuk SKU ini dalam bentuk string. |
| <code>data.skuBase</code> | <code>array</code> | Properti spesifikasi dan opsi yang tersedia. |
| <code>data.skuBase[]</code> | <code>object</code> | Satu properti spesifikasi dan daftar opsi-nya. |
| <code>data.skuBase[].propertyId</code> | <code>string</code> | ID properti spesifikasi, dikembalikan sebagai string. |
| <code>data.skuBase[].propertyName</code> | <code>string</code> | Nama tampilan atribut spesifikasi. |
| <code>data.skuBase[].itemPropertyValues</code> | <code>array</code> | Opsi spesifikasi yang tersedia untuk properti spesifikasi ini. |
| <code>data.skuBase[].itemPropertyValues[]</code> | <code>object</code> | Satu opsi spesifikasi yang dapat dipilih. |
| <code>data.skuBase[].itemPropertyValues[].valueId</code> | <code>string</code> | ID opsi spesifikasi, dikembalikan sebagai string. |
| <code>data.skuBase[].itemPropertyValues[].value</code> | <code>string</code> | Nilai tampilan dari opsi spesifikasi tersebut. |
| <code>data.skuBase[].itemPropertyValues[].pic</code> | <code>string &#124; null</code> | URL gambar opsi spesifikasi jika tersedia. |

</div>

## Contoh Respons

<ApiExampleSection :api='JSON.parse("\"/api/taobao/get-item-detail/v4\"")' />

