通过电商商品信息查询返回主流电商平台商品信息和优惠信息
无参数
无参数
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
secret_key | string | true | 用户授权key |
secret_code | string | true | 接口编号 |
secret_sign | string | true | 加密签名:md5(secret_key+secret_secret)转大写 |
channel | string | true | 通道编码:taobao、jd、vip等 |
search | string | true | 搜索的商品名称 |
t | string | true | 时间戳 |
appKey | string | false | 平台申请的授权key,不填默认为快递100appKey |
appSecret | string | false | 平台申请的秘钥secret,不填默认为快递100appSecret |
adzoneId | long | false | 推广位ID,不填默认为快递100adzoneId |
pid | string | false | 媒体位ID,不填默认为快递100pid |
coupon | boolean | false | 是否有优惠券:false表示不限 |
dsr | int | false | 筛选店铺评分大于等于该值的商品,评分范围:0~100之间的值 |
overseas | boolean | false | 是否海外商品:false表示不限 |
catId | int | false | 商品筛选类目ID,根据不同渠道去获取相应的类目ID |
group | boolean | false | 是否拼购商品:false表示不限 |
tmall | boolean | false | channel编码为taobao时表示是否为天猫商品:false表示不限 |
jd | boolean | false | channel编码为jd时表示是否为京东自营:false表示不限 |
page | int | false | 查询页数,默认为:1 |
length | int | false | 每页返回数据条数,默认为:10 |
sort | string | false | 排序类型:DESC:降序;ASC:升序 |
field | string | false | 排序字段,详细说明参考产品详情 |
startPrice | int | false | 价格区间开始金额 |
endPrice | int | false | 价格区间结束金额 |
curl http://cloud.kuaidi100.com/api -X POST -d \
"secret_key=***&secret_code=5f81ab8a53c345f1b0d85e79f11d3952&secret_sign=md5(***)&channel=taobao&search=%E6%9C%8D%E8%A3%85&t=1623726170106&appKey=&appSecret=&adzoneId=&pid=&coupon=&dsr=&overseas=&catId=&group=&tmall=&jd=&page=&length=&sort=&field=&startPrice=&endPrice="
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
public class CloudDemo {
public static void main (String[] args) {
CloudDemo cloudDemo = new CloudDemo();
Map params = new HashMap();
params.put("secret_key", "***");
params.put("secret_code", "5f81ab8a53c345f1b0d85e79f11d3952");
params.put("secret_sign", "md5(***)");
params.put("channel", "taobao");
params.put("search", "服装");
params.put("t", "1623726170106");
params.put("appKey", "");
params.put("appSecret", "");
params.put("adzoneId", "");
params.put("pid", "");
params.put("coupon", "");
params.put("dsr", "");
params.put("overseas", "");
params.put("catId", "");
params.put("group", "");
params.put("tmall", "");
params.put("jd", "");
params.put("page", "");
params.put("length", "");
params.put("sort", "");
params.put("field", "");
params.put("startPrice", "");
params.put("endPrice", "");
cloudDemo.post(params);
}
public String post(Map params) {
StringBuilder response = new StringBuilder("");
BufferedReader reader = null;
try {
StringBuilder builder = new StringBuilder();
for (Map.Entry param : params.entrySet()) {
if (builder.length() > 0) {
builder.append('&');
}
builder.append(URLEncoder.encode(param.getKey(), "UTF-8"));
builder.append('=');
builder.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8"));
}
byte[] bytes = builder.toString().getBytes("UTF-8");
URL url = new URL("http://cloud.kuaidi100.com/api");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.setRequestMethod("POST");
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(bytes.length));
conn.setDoOutput(true);
conn.getOutputStream().write(bytes);
reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line = "";
while ((line = reader.readLine()) != null) {
response.append(line);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != reader) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return response.toString();
}
}
class MD5Utils { private static MessageDigest mdigest = null;
private static char digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
private static MessageDigest getMdInst() {
if (null == mdigest) {
try {
mdigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
return mdigest;
}
public static String encode(String s) {
if(null == s) {
return "";
}
try { byte[] bytes = s.getBytes();
getMdInst().update(bytes);
byte[] md = getMdInst().digest();
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for(int i = 0; i < j; i++) {
byte byte0 = md[i];
str[k++] = digits[byte0 >>> 4 & 0xf];
str[k++] = digits[byte0 & 0xf];
}
return new String(str);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
暂无示例
<?php
$params = "";
$params .= 'secret_key=***'.'&';
$params .= 'secret_code=5f81ab8a53c345f1b0d85e79f11d3952'.'&';
$params .= 'secret_sign=md5(***)'.'&';
$params .= 'channel=taobao'.'&';
$params .= 'search=%E6%9C%8D%E8%A3%85'.'&';
$params .= 't=1623726170106'.'&';
$params .= 'appKey='.'&';
$params .= 'appSecret='.'&';
$params .= 'adzoneId='.'&';
$params .= 'pid='.'&';
$params .= 'coupon='.'&';
$params .= 'dsr='.'&';
$params .= 'overseas='.'&';
$params .= 'catId='.'&';
$params .= 'group='.'&';
$params .= 'tmall='.'&';
$params .= 'jd='.'&';
$params .= 'page='.'&';
$params .= 'length='.'&';
$params .= 'sort='.'&';
$params .= 'field='.'&';
$params .= 'startPrice='.'&';
$params .= 'endPrice='.'&';
$params .= substr($params, 0, -1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, 'http://cloud.kuaidi100.com/api');
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo $result;
?>
# coding = utf-8
import sys,os
import requests,json,hashlib
params = {}
params['secret_key'] = '***'
params['secret_code'] = '5f81ab8a53c345f1b0d85e79f11d3952'
params['secret_sign'] = 'md5(***)'
params['channel'] = 'taobao'
params['search'] = '服装'
params['t'] = '1623726170106'
params['appKey'] = ''
params['appSecret'] = ''
params['adzoneId'] = ''
params['pid'] = ''
params['coupon'] = ''
params['dsr'] = ''
params['overseas'] = ''
params['catId'] = ''
params['group'] = ''
params['tmall'] = ''
params['jd'] = ''
params['page'] = ''
params['length'] = ''
params['sort'] = ''
params['field'] = ''
params['startPrice'] = ''
params['endPrice'] = ''
result = requests.post('http://cloud.kuaidi100.com/api', params)
print(result.text)
无参数
{
"code": 200,
"data": {
"datas": [
{
"id": "602203425017",
"channel": {
"code": "taobao",
"name": "淘宝"
},
"title": "妈妈装夏装套装棉麻短袖t恤奶奶装大码阔腿裤60中老年女装两件套",
"description": "",
"picture": "https://img.alicdn.com/bao/uploaded/i1/1033905306/O1CN01LAZZl81p4CCIluy8t_!!1033905306.jpg",
"smallPic": "https://img.alicdn.com/bao/uploaded/i1/1033905306/O1CN01LAZZl81p4CCIluy8t_!!1033905306.jpg_200x200.jpg",
"searchId": null,
"volume": "244",
"superiorBrand": false,
"preSale": {
"feeText": null,
"startTime": 0,
"endTime": 0,
"tailStartTime": 0,
"tailEndTime": 0,
"deposit": "0"
},
"comments": 0
}
],
"total": 2097432,
"pageKey": null
},
"message": "success",
"time": 465
}
{
"code": 10005,
"data": null,
"message": "fail",
"time": 465
}
状态码 | 状态码信息 | 描述 |
---|---|---|
200 | 成功 | 成功 |
10005 | 失败 | 失败 |
通过电商商品信息查询接口返回主流电商平台商品信息和优惠信息,
接口精准,返回迅速,响应及时
接口参数field 说明
PRICE(价格); TOTAL_SALES(销量); COMMISSION_RATE(佣金比率); TOTAL_COMMISSION(佣金); ORDER_COMMISSION(订单支出佣金);