快递100提供了4种语言的请求方式,分别是php,java,c#,net。
本文提供js的请求方式,具体示例如下
key和customer需要自己去申请https://www.kuaidi100.com/openapi/applypoll.shtml
const axios = require("axios");
const crypto = require("crypto"); //加密模块
const Qs = require("qs");
function md5(data) {
return crypto
.createHash("md5")
.update(data, "utf8")
.digest("hex");
}
var param = {
com: "jd",
num: "JD0004885123336"
};
var key = "xxxxxxxxxx"; //快递100给的key
var customer = "xxxxxxxxxxxxxxxxxxxxxxx"; //快递100给的customer
var sign = md5(JSON.stringify(param) + key + customer).toUpperCase();
var dat