快宝开放平台 免费物流查询api

日期: 2019-09-10         浏览量: 4787

使用 快宝开放平台 免费查询物流信息



// 快宝api 快递查詢接口

const request = require("request");
const crypto = require('crypto');
const api_key = 'bcd80241fd89058be2776d7f04c9c65dbf7f36';
const app_id = '103428';
const time = new Date().getTime();
const sign = md5(`${app_id}express.info.get${time}${api_key}`);
var options = {
  method: 'POST',
  url: 'https://kop.kuaidihelp.com/api',
  headers:
  {
    'cache-control': 'no-cache',
    'content-type': 'application/x-www-form-urlencoded'
  },
  form:
  {
    app_id: '104428',
    method: 'express.info.get',
    ts: time,
    // ht 快递标示符
    data: '{ "waybill_no":"71697010047335", "exp_company_code":"ht","result_sort":"0"}',
    sign: sign
  }
};
request(options, function (error, response, body) {
  if (error) throw new Error(error);
  let res = JSON.parse(body);
  console.log(res);
  if (res.data[0]) {
    console.log(res.data[0].data);
  }
});
function md5(str) {
  let md5 = crypto.createHash('md5');
  md5.update(str);
  return md5.digest('hex');
}



快递标示符 下载并查看