Api-下载产品 ¶
该api为通过接口获取分销系统的产品的功能
备注:
- 依据SPU数列及仓库下载不同语言的产品数据,例如一个SPU有三个颜色四个尺码二个仓库,有12个SKU的24条数据,只要一SPU号就可获取。
- 如果需要更多SPU,可以在Quarkscm.com 选择类目,品牌,仓库后,选全部页面的产品,下载SPU列表。
准备工作 ¶
登录获取access-token,并将access-token设置为请求头参数,如何获取access-token,请参考“获取token文档”
功能说明: ¶
下载产品
API说明: ¶
URL: https://dpapi.quarkscm.com/v1/myproduct/download/{language}
方式:POST
请求参数说明: ¶
url参数: ¶
参数名称 | 是否必须 | 类型 | 描述 |
---|---|---|---|
language | 必须 | String | 语言包目前支持语言参数有(en_US , es_ES , ru_RU , de_DE , fr_FR , it_IT , jp_JP , pt_PT , pl_PL , ar_AR) |
请求头参数: ¶
参数名称 | 是否必须 | 类型 | 描述 |
---|---|---|---|
access-token | 必须 | string | 登录后获取的token,此接口access-token必填 |
Body Form-Data: ¶
格式:json
参数名称 | 是否必须 | 类型 | 描述 |
---|---|---|---|
spus | 必须 | Array | spu数组 |
warehouse | 选填 | string | 仓库名(见文档下方说明),不填则获取SZ1仓库的产品 |
请求参数示例如下:
{
"spus":[
"H13589",
"WW13853",
"G2341"
],
"warehouse":"SZ1"
}
返回参数说明 : ¶
格式:json
参数名称 | 是否必须 | 类型 | 描述 |
---|---|---|---|
status | 必须 | string | 是否请求成功 |
code | 必须 | integer | 状态码 |
data | 不必须 | array | 请求成功为data数组数据,请求失败则无此参数 |
meta | 必须 | array | 内容分别是存在,不存在和品牌未授权的spu数组 |
message | 必须 | string | 描述 |
返回数据data参数说明: ¶
参数名称 | 类型 | 描述 |
---|---|---|
first_category | string | 一级类目 |
first_category_id | int | 一级类目ID |
sub_category | string | 二级类目 |
sub_category_id | int | 二级类目ID |
3rd_category | string | 三级类目 |
3rd_category_id | int | 三级类目ID |
forth_category | string | 四级类目 |
forth_category_id | int | 四级类目ID |
product_name | string | 名称 |
product_description | string | 描述 |
sku_special | array | sku特殊属性,详情见底部解释 |
stock | integer | 库存(单位:个) |
clearance | string | 是否清仓 |
brand | string | 品牌名称 |
spu | string | Spu |
sku | string | Sku |
price | integer | 当前价格 |
listing_id | string | listing_id |
image_main | string | 主图URL |
image_gallery | array | 图片数组 |
spu_items | array | spu_items |
other_items | array | other_items |
warehouse_name | string | 仓库名 |
length | integer | 长(单位:厘米) |
width | integer | 宽(单位:厘米) |
height | integer | 高(单位:厘米) |
weight | integer | 重(单位:克) |
active | integer | 状态:1为上架,2为下架 |
embargoed_platforms | array | 所有禁售的平台 |
返回参数示例: ¶
返回参数详细:
1.成功:返回参数
1.1 全部产品下载成功
{
"status": "success",
"code": 200,
"data": [
{
"spu": "H10513",
"sku": "H10513BL",
"warehouse_name": "UK",
"stock": 22,
"active": 1,
"clearance": "NO",
"brand": "",
"sku_special": [
"16",
],
"first_category": "Apparel & Jewelry",
"first_category_id": 864,
"sub_category": "Watches",
"sub_category_id": 983,
"3rd_category": "Sports watch",
"3rd_category_id": 990,
"forth_category": "",
"forth_category_id": null,
"product_name": "Pulse Heart Rate Monitor Calorie Counter Fitness Sport Exercise Wrist Watch Blue",
"product_description": "<strong>Features</strong>:<br />\nIt has been designed to calculate the calories burned and pulse rate.<br />\nIndividual data is based on present age, weight, sex, and other surrounding environment.<br />\nTime and calendar.<br />\nMultifunctional design: 5 modes for your choice, real time, daily alarm, chronograph, pulse calculation, calories calculation.<br />\nFashionable design, mixed color collocation.<br />\n<br />\n<strong>Specifications</strong>:<br />\nItem type: Sport watch<br />\nModes: Real time mode, daily alarm mode, chronograph mode, pulse mode, exercise mode<br />\nColor: Blue<br />\nDial material type: ABS<br />\nBand material type: PU<br />\nMovement: Digital<br />\nDial display: Digital<br />\nGender: Unisex<br />\nDial shape: Square<br />\nDial diameter: 4cm / 1.6in<br />\nBand length: 20cm / 7.9in<br />\nTotal weight: 45g / 1.6oz<br />\n<br />\n<strong>Package List</strong>:<br />\n1 x Heart Rate Pulse Watch<br />\n1 x Instruction Manual (English)<br />\n<br />\n<strong>Notes</strong>:<br />\nDue to the different environment, testing data would be different.<br />\nAvoid being placed in the place that television, computer, light or other electronic source, or it would suffer the interference.",
"listing_id": "0827f218-d938-1004-8d98-556fb94bfa59",
"image_main": "//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513bl-11-af6e.jpg",
"image_gallery": [
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513bl-8-af6e.jpg",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513bl-7-af6e.jpg",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513bl-4-af6e.jpg",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513bl-10-af6e.jpg",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513bl-1-af6e.jpg",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513bl-9-af6e.jpg"
],
"spu_items": {
"color": "blue"
},
"other_items": {
"case material": "resin",
"dial window material type": "resin",
"dial material type": "rubber",
"movement": "digital",
"style": "sport",
"feature": "heart rate monitor",
"gender": "men",
"case shape": "round",
"band material type": "leather",
"boxes & cases material": "paper",
"condition": "new without tags",
"dial display": "digital"
},
"length": 0,
"width": 0,
"height": 0,
"weight": 0,
"price": 4.38,
"embargoed_platforms": [
"Aliexpress prohibition sale"
]
},
{
"spu": "H10513",
"sku": "H10513R",
"warehouse_name": "UK",
"stock": 22,
"active": 1,
"clearance": "NO",
"brand": "",
"sku_special": [
"16",
],
"first_category": "Apparel & Jewelry",
"first_category_id": 864,
"sub_category": "Watches",
"sub_category_id": 983,
"3rd_category": "Sports watch",
"3rd_category_id": 990,
"forth_category": "",
"forth_category_id": null,
"product_name": "Pulse Heart Rate Monitor Calorie Counter Fitness Sport Exercise Wrist Watch Red",
"product_description": "<strong>Features</strong>:<br />\nIt has been designed to calculate the calories burned and pulse rate.<br />\nIndividual data is based on present age, weight, sex, and other surrounding environment.<br />\nTime and calendar.<br />\nMultifunctional design: 5 modes for your choice, real time, daily alarm, chronograph, pulse calculation, calories calculation.<br />\nFashionable design, mixed color collocation.<br />\n<br />\n<strong>Specifications</strong>:<br />\nItem type: Sport watch<br />\nModes: Real time mode, daily alarm mode, chronograph mode, pulse mode, exercise mode<br />\nColor: Red<br />\nDial material type: ABS<br />\nBand material type: PU<br />\nMovement: Digital<br />\nDial display: Digital<br />\nGender: Unisex<br />\nDial shape: Square<br />\nDial diameter: 4cm / 1.6in<br />\nBand length: 20cm / 7.9in<br />\nTotal weight: 45g / 1.6oz<br />\n<br />\n<strong>Package List</strong>:<br />\n1 x Heart Rate Pulse Watch<br />\n1 x Instruction Manual (English)<br />\n<br />\n<strong>Notes</strong>:<br />\nDue to the different environment, testing data would be different.<br />\nAvoid being placed in the place that television, computer, light or other electronic source, or it would suffer the interference.",
"listing_id": "08281928-d938-1004-8d98-556fb94bfa59",
"image_main": "//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513r-2-1fb0.jpg",
"image_gallery": [
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-8-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-5-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-2-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-10-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-1-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-4-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-11-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-3-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-6-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-12-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-9-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/gu1/H/H10513R/H10513R-7-1fb0.JPG",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513r-11-1fb0.jpg",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513r-5-1fb0.jpg",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513r-7-1fb0.jpg",
"//fx.quarkscm.com/product/xy/2000/2000/p/tt/h/1/h10513r-12-1fb0.jpg"
],
"spu_items": {
"color": "red"
},
"other_items": {
"case material": "resin",
"dial window material type": "resin",
"dial material type": "rubber",
"movement": "digital",
"style": "sport",
"feature": "heart rate monitor",
"gender": "men",
"case shape": "round",
"band material type": "leather",
"boxes & cases material": "paper",
"condition": "new without tags",
"dial display": "digital"
},
"length": 0,
"width": 0,
"height": 0,
"weight": 0,
"price": 4.38,
"embargoed_platforms": [
"Aliexpress prohibition sale"
]
}
],
"meta": {
"exist_spu": [
"H10513"
],
"not_exist_spu": []
},
"message": "Download All Success"
}
1.2 部分产品下载成功,部分产品找不到
{
"status": "success",
"code": 200,
"data": [
{
...
}
],
"meta": {
"exist_spu": [
"H10513",
"G2341"
],
"not_exist_spu": [
"WW13853"
],
"brand_unauthorized_spu":[
"G2341"
]
},
"message" : "Do not Have Spu : [WW13853] in warehouse : SZ1. Spu:[G2341] 's Brand is unauthorized, please check."
}
2.失败:返回参数
2.1 未传spus参数
{
"status": "fail",
"code": 401,
"message": "Need Spu"
}
2.2 可用下载数不足
{
"status": "fail",
"code": 402,
"message": "Not Enough Download Count"
}
php 代码示例: ¶
<?php
function getCurlData($url,$type="get",$data=array(),$timeout = 10) {
//对空格进行转义
$http_header = array();
if(isset($data['access-token'])){
$http_header[] = 'access-token: ' . $data['access-token'];
unset($data['access-token']);
}
$url = str_replace(' ','+',$url);
if (strtolower($type) == "get") {
if (!empty($data) && is_array($data)) {
$arr = [];
foreach ($data as $k=>$v) {
$arr[] = $k."=".$v;
}
$str = implode("&",$arr);
if (strstr($url,"?")) {
$url .= "&".$str;
} else {
$url .= "?".$str;
}
}
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); //定义超时3秒钟
if(strtolower($type) == "post"){
$data = json_encode($data);
// POST数据
curl_setopt($ch, CURLOPT_POST, 1);
$http_header[] = 'Accept: application/json';
$http_header[] = 'Content-Type: application/json';
$http_header[] = 'Content-Length: ' . strlen($data);
// 把post的变量加上
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($ch, CURLOPT_HTTPHEADER,$http_header);
//执行并获取url地址的内容
$output = curl_exec($ch);
//echo $output ;
//释放curl句柄
curl_close($ch);
//var_dump($output);exit;
return $output;
}
$url = 'https://dpapi.quarkscm.com/v1/myproduct/download/en_US';
$data['access-token'] = "c_xyXeQgyKcWHM9kS0yukwlC5bgMVJST";
$data['spus'] = ["H10513","WW13853","G2341"];
$data['warehouse'] = 'SZ1';
$res = getCurlData($url,'post',$data);
echo $res;
?>
仓库代码解释: ¶
中国:SZ1美国:US3、US5、US6、US7、US10、US12、USF
英国:UK4、UK5、UK6、UK7、UK8、UK9、UK11、UKF
德国:DE4、DE7、DE8、DEF
捷克:CZ1、CZ3、CZ4、EUF
法国:FR1、FR3、FRF
西班牙:ES4、ES5、ESF
俄罗斯:RU5、RUF
意大利:IT1、ITF
澳大利亚:AU1、AU3、AUF
墨西哥:MX4
加拿大:CA1、CA5
特殊属性代码解释: ¶
1:纯电池2:打火石产品
3:刀具
4:磁性产品
5:外置电池
6:配套电池
7:可拆卸电池
8:内置电池
9:纽扣电池
10:锂电池
11:不可拆卸电池
12:液体产品
13:粉末产品
14:仿牌
15:普货
16:低风险磁性
17:低风险液体
18:低风险粉末
19:认证不合格
20:松香产品
21:膏状产品
22:颗粒产品
23:易碎品
24:大功率电池
25:太阳能产品
26:木制品