接口说明
获取渠道名称和秘钥
联系工作人员获取渠道名称 channel 和 秘钥 secret
请求地址:http://127.0.0.1/xstrive
签名规则 (token生成)
- 签名使用md5加密生成token参数进行传递校验
- 通过第一步获取的secret 进行加密串拼接
- 加密串按Url参数词典序(如有大小写并列,大写在前)进行排序通过&符号进行拼接
参数排序JS代码示例:keys = [key1,key2,...,secret,t]; keys = keys.sort();
其它语言请自行查阅API
比如:
http://127.0.0.1/xstrive/product/online?channel=common&productId=test144&token=c054ddeb010a3c44427bd3a345aba1ee&t=1577587794
加密串(除token外的所有参数):
sign = channel=common&productId=test144&secret=df138a4ffa97d1f8fe41646670ccc842&t=1577587794
加密后: token = md5(sign) = c054ddeb010a3c44427bd3a345aba1ee
加密后的串和请求的token一致签名验证通过
请求 content-type 设置
header[‘content-type’] 为 application/x-www-form-urlencoded
请求固定携带参数
| 参数名 | 描述 | 类型 | 必传 | 附加说明 |
|---|---|---|---|---|
| channel | 渠道名 | String | Y | |
| token | 签名串 | String | Y | |
| t | 当前时间戳 | Number | Y | 单位:秒 |
失败统一返回JSON格式
{
"code": Number, // 错误码
"msg": String // 错误信息
}
示例:
{
"code":401,
"msg":"非法请求"
}
这份文档没解决你的问题?联系我们,技术工程师直接对接。