1688商品详情 API (V1)
接口健康状态
健康 可用 少量可用 基本不可用 暂无数据
正在加载健康状态…
通过商品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.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 | 已选购买方式的展示名称。 |
响应示例
正在加载响应示例…