对接说明
域名
对外统一域名:https://open-api.lixiaoyun.com
IP 白名单说明
每个客户会针对 ClientId 设置 IP 白名单校验,需要向励销云进行配置。
限流说明
单个客户调用励销云具体功能服务 QPS 不大于 300,如有特殊需求,可申请扩增。
单个客户访问接口,有流量控制,可申请扩增流量,详见接口说明。
接口验签说明
所有客户调用励销云开放平台接口,需要进行安全签名验证,详见下文。
Header说明
调用开放平台接口,需要在 Header 中携带以下参数。
Header名称 | 类型 | 是否必填 | 说明 |
---|---|---|---|
ClientId | String | 是 | 对接客户ID;需要向微问家申请 |
AppId | String | 是 | 对接客户应用ID;需要向微问家申请 |
SIGN | String | 是 | 签名,详见下文 |
DATE | Unix时间戳 | 是 | Unix时间戳;毫秒级。 |
名词说明
- SIGN 规则:”LXY-V1” +”:”+ClientId+ “:” + AppId + “:” + sha1(AppSecret + URL + DATE)
- LXY-V1: 接口版本,当前固定为LXY-V1。
- URL:当前请求URL,不带域名和请求参数的纯路径,如”/skb/internal-ent-detail/api/v1/ent/company_detail”
- 标准 sha1 算法: 结果为一个40个字符的字符串,16进制小写表示的string
- ClientId、AppId和AppSecret:向励销云授权中心申请。
- DATE:请求日期(格式: Unix时间戳;毫秒级),签名有效时间默认 5 分钟。
签名代码示例
java 版
/**
* @description:lxyv1签名
*/
@Slf4j
public class SignUtils {
/**
* @description:生成sign
*/
public static String generateSignStr(String clientId, String appId, String appSecret, String url, String date) {
String sign = null;
try {
sign = "LXY-V1:" + clientId + ":" + appId + ":" + EncodeUtils.sha1Encode(appSecret + url + date);
} catch (UnsupportedEncodingException e) {
log.error("UCSignUtils validateV1Sign", e);
}
return sign;
}
}
/**
* @description:MD5、SHA加密工具类
*/
public class EncodeUtils {
private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d",
"e", "f"};
public static String sha1Encode(String str) throws UnsupportedEncodingException {
MessageDigest sha = null;
try {
sha = MessageDigest.getInstance("SHA");
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
return "";
}
byte[] byteArray = str.getBytes("UTF-8");
return byteArrayToHexString(sha.digest(byteArray));
}
public static String md5Encode(String str) throws UnsupportedEncodingException {
String resultString = null;
try {
resultString = new String(str);
MessageDigest md = MessageDigest.getInstance("MD5");
resultString = byteArrayToHexString(md.digest(resultString.getBytes("UTF-8")));
} catch (Exception e) {
}
return resultString;
}
private static String byteArrayToHexString(byte b[]) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
resultSb.append(byteToHexString(b[i]));
}
return resultSb.toString();
}
private static String byteToHexString(byte b) {
int n = b;
if (n < 0) {
n += 256;
}
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
}
node
//获取接口配置
const crypto = require("crypto")
const APIHost = "https://open-api.lixiaoyun.com"
const clientId = "YOUR CLIENT ID";
const appId = "YOUR APP ID";
const appSecret = "YOUR APP SECRET";
function getSign(route, nowTime){
let sha1 = crypto.createHash('sha1').update( appSecret + route + nowTime ).digest('hex');
let sign= "LXY-V1" +":" + clientId + ":" + appId + ":" + sha1;
return sign;
}
function getStaticConfig(){
let nowTime = new Date().getTime() + "";
let route = "/skb/internal-ent-detail/api/v2/staticConfig";
let sign = getSign(route, nowTime)
var myHeaders = new Headers();
myHeaders.append("ClientId", clientId);
myHeaders.append("AppId", appId);
myHeaders.append("SIGN", sign);
myHeaders.append("DATE", nowTime);
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch(`${APIHost}/${route}`, requestOptions)
.then(response => response.text())
.then(result => console.log((result)))
.catch(error => console.log('error', error));
}
getStaticConfig()
文档更新时间: 2025-04-28 16:35 作者:李茂