| 参数名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 |
|---|---|---|---|---|---|
| x-app-id | String | 是 | 32 | 应用ID | app-30252 |
| x-api-key | String | 是 | 32 | 应用密钥 | UE1JjU9ECZUvXTb5bMftQpNaZZJG8KOO |
| timestamp | int | 是 | 10 | 时间戳 | 时间戳,注:时间戳为10位 |
| 参数名称 | 参数类型 | 描述 | 示例值 |
|---|---|---|---|
| code | String | 返回码,详见 | 000 |
| desc | String | 返回码描述,详见数据字典 | 操作成功 |
| content | object | 业务返回 数据均包含在此字段中,参见具体的API接口文档 | 202411 |
| timestamp | String | 返回时间戳 | 1728981469695 |
| 参数名称 | 参数类型 | 必填 | 最大长度 | 描述 | 示例值 |
|---|---|---|---|---|---|
| perPage | Integer | 否 | 每页大小 | 默认20 | |
| page | Integer | 否 | 当前页,从1开始 | 默认1 |
| 参数名称 | 参数类型 | 描述 | 示例值 |
|---|---|---|---|
| total | long | 总条数 | |
| hasNextPage | boolean | 是否还有下一页数据 | false |
| list | list | 具体的分页数据 |
public static String getSignContent(Map<String, String> sortedParams) {
StringBuffer content = new StringBuffer();
List<String> keys = new ArrayList<String>(sortedParams.keySet());
Collections.sort(keys);
int index = 0;
for (int i = 0; i < keys.size(); i++) {
String key = keys.get(i);
String value = sortedParams.get(key);
if (StringUtils.areNotEmpty(key, value)) {
content.append((index == 0 ? "" : "&") + key + "=" + value);
index++;
}
}
return content.toString();
}public static String rsa256Sign(String content, String privateKey,
String charset) throws BaiChangApiException {
try { PrivateKey priKey = getPrivateKeyFromPKCS8(BaiChangOpenConstants.SIGN_TYPE_RSA,
new ByteArrayInputStream(privateKey.getBytes()));
java.security.Signature signature = java.security.Signature
.getInstance(BaiChangOpenConstants.SIGN_SHA256RSA_ALGORITHMS);
signature.initSign(priKey);
if (StringUtils.isEmpty(charset)) {
signature.update(content.getBytes());
} else {
signature.update(content.getBytes(charset));
}
byte[] signed = signature.sign();
return new String(Base64.encodeBase64(signed));
} catch (Exception e) {
throw new BaiChangApiException("RSAcontent = " + content + "; charset = " + charset, e);
}
}| code | desc(返回码描述) | content(明细数据) | 备注 |
|---|---|---|---|
| 200 | 操作成功 | ||
| 401 | token失效需要重新登录 | ||
| 801 | 数据已存在 | ||
| 821 | 请求ip不在ip白名单中 | 具体ip | |
| 822 | 时间戳校验失败 | ||
| 802 | APPID错误 | ||
| 401 | token失效需要重新登录 | ||
| 803 | 验签失败 | ||
| 805 | token校验失败 | ||
| 901 | 参数缺失 | ||
| 999 | 操作失败 | 可能未知异常,联系技术确认 | |
| 810 | 查询权限不足 | ||
| 811 | 订单号不能为空 | ||
| 812 | 请求唯一标识重复 | ||
| 817 | 请求唯一标识不能为空 |