快递100接口调用问题(推送订阅模式)

本文介绍了如何使用快递100的API进行订阅推送模式,详细讲解了订阅请求的关键参数设置,并强调回调接口地址必须为公网IP。回调接口接收到物流更新时,可将数据保存至数据库或Redis,提升查询效率。
摘要由CSDN通过智能技术生成

这种东西最好查阅快递100官方文档api,里面接口写的非常详细
废话不多说,直接上代码

首先是订阅模式

/**
* 订阅请求
*
*/
public class Demo {
public static void main(String[] args) {
String key = “这个是你在官网申请的授权秘钥”; //企业授权key
String company = “zhongtong”; //快递公司编码
String number = “7515829985”; //快递单号
String from = “”; //出发地城市
String to = “”; //目的地城市
String callbackurl = “http://ip:port/rollbackKuaiDi100”; //回调地址
String salt = “”; //加密串
int resultv2 = 1; //行政区域解析
int autoCom = 0; //单号智能识别
int interCom = 0; //开启国际版
String departureCountry = “”; //出发国
String departureCom = “”; //出发国快递公司编码
String destinationCountry = “”; //目的国
String destinationCom = “”; //目的国快递公司编码
String phone = “”; //手机号

        SubscribeDemo demo = new SubscribeDemo(key);
        String result = demo.subscribeData(company, number, from, to, callbackurl, salt, resultv2, autoCom, interCom, departureCountry, departureCom, destinationCountry, destinationCom, phone);
        System.out.println(result);
    }

    /**
     * 实时查询请求地址
     */
    private static final String SUBSCRIBE_URL = "http://poll.kuaidi100.com/poll";

    private String key;			//授权key

    public SubscribeDemo(String key) {
        this.key = key;
    }

    /**
     * 订阅请求方法
     * @param company				快递公司编码
     * @param number				快递单号
     * @param from					出发地城市
     * @param to					目的地城市
     * @param callbackurl			回调地址URL
     * @param salt					加密签名字符串
     * @param resultv2				行政区域解析
     * @param autoCom				智能判断单号归属快递公司
     * @param interCom				开启国际版
     * @param depa
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值