admin 管理员组

文章数量: 887007

快递查询接口(trackingmore)

快递查询接口

目前提供快递查询的接口平台有:

  • Trackingmore
  • 快递100
  • 快递网
  • Track123

不同接口的区别:
(1)Trackingmore支持380家快递公司,其中有55家为国内的快递,其余325家为国际快递。具体的价格为0.6分钱/单号左右,新注册用户可以免费测试12小时。

(2)快递100属于在国内做得比较早的平台,可以申请每天最多2000次的API调用,但需要给快递100做一个友链。超过2000次收费,每次0.06~0.1元不等。

(3)快递网可以申请每天最多500次的API调用,但同样需要做一个友链。超过部分,每次0.05元。
 

快递API的应用场景与用途

1. 最常见的应用场景如下:
(1)电商网站:例如B2C、团购、B2B、批发分销站、C2C、本地生活交易等网站。
(2)管理系统:订单处理平台、订货平台、发货平台、分销系统、渠道管理系统、客户管理系统、ERP等。


2. 快递API的用途如下:
(1)让顾客登录网站后,直接在“我的订单”页面内就能看到订单的物流状态。
(2)自动筛选出“已签收”、“疑难件”等状态的单号,减轻物流跟单人员的压力。
(3)改变订单的状态和交易流程,例如单号变为“已签收”,就能让订单变为可以确认退换货等。
(4)评估选择快递公司,根据“已签收”的运单数,可以算出销售人员的业绩,且便于应对货到付款的结算。
(5)邮件、短信提醒用户运单的最新状态,可以安抚用户,也可以利用邮件短信二次营销。


对接示例
这里以Trackingmore为例,不同的接口的对接方式比较类似,都需要注册,并生成自己的API key。以下以Trackingmore的实时查询API为例。

接口支持的消息接收方式为HTTP POST
请求方法的编码格式为 utf-8
请求body部分的参数的数据格式为json 格式

接口参数      


接口请求地址

请求头部信息参数

其他的状态响应简码可以在这里看到。

返回示例

{"meta": {"code": 200,"type": "Success","message": "Success"},"data": {"items": [{"id": "442f798ea35749e7605d1a73d4181a01","tracking_number": "RE113184005HK","carrier_code": "hong-kong-post","status": "transit","original_country": "Hong Kong [CN]","destination_country": "Colombia","itemTimeLength": null,"origin_info": {"weblink": "http:\/\/www.hongkongpost.hk\/","phone": "852 2921 2222","carrier_code": "hong-kong-post","trackinfo": [{"Details": "CO","StatusDescription": "The item ( RE113184005HK ) left Hong Kong for its destination on  10-Oct-2015 ","Date": "2015-10-09 00:00"}]},"destination_info": {"weblink": "http:\/\/www.4-72.co\/","phone": "(57-1) 4722000","carrier_code": "colombia-post","trackinfo": [{"Date": "2015-10-22 20:52","StatusDescription": "DIGITALIZADO","Details": "CTP.CENTRO A"}, {"Date": "2015-10-22 17:02","StatusDescription": "Registro de entrega exitosa","Details": ""}, {"Date": "2015-10-22 16:55","StatusDescription": "ENTREGADO","Details": "CD.MONTEVIDEO"}, {"Date": "2015-10-22 09:31","StatusDescription": "REASIGNADO","Details": "CD.NORTE"}, {"Date": "2015-10-22 08:52","StatusDescription": "REASIGNADO","Details": "CD.NORTE"}, {"Date": "2015-10-22 02:39","StatusDescription": "En proceso","Details": "CTP.CENTRO A"}, {"Date": "2015-10-21 16:36","StatusDescription": "En proceso","Details": "CTP.CENTRO A"}, {"Date": "2015-10-20 06:29","StatusDescription": "Envío Recibido en la oficina de cambio internacional","Details": "COBOGC"}]}}]}
}


PHP接入示例

$url    = "";
$header = array('Content-Type:application/json','Trackingmore-Api-Key:b7a0009f-6cd2-43ee-9d1d-ed7135ad460f');
$postData = array('tracking_number'=>'LK664578623CN','carrier_code'=>'china-ems'
);$res = curl_post($url,json_encode($postData),$header);
print_r($res);function curl_post($url, $postData,$header=array(),$cookie_file='',$isheader=0,$proxy='',$debug=0,$autoRedirect=0,$time=89){$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);if(!empty($isheader)){curl_setopt($ch, CURLOPT_HEADER, $isheader);}  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);curl_setopt($ch, CURLOPT_TIMEOUT,$time);curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:44.0) Gecko/20100101 Firefox/44.0');if(!empty($header)){curl_setopt($ch, CURLOPT_HTTPHEADER,$header);}if(!empty($autoRedirect)){curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);}if(!empty($cookie_file)){// 读取文件所储存的Cookie信息curl_setopt ( $ch, CURLOPT_COOKIEFILE, $cookie_file );}if(!empty($proxy)){curl_setopt($ch, CURLOPT_PROXY, $proxy);}//curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');if(!empty($debug)){curl_setopt($ch,CURLOPT_VERBOSE,1);curl_setopt($ch,CURLOPT_FAILONERROR,TRUE);print_r(curl_error($ch));print_r(curl_getinfo($ch));}$html = curl_exec($ch);curl_close($ch);return $html;
}

本文标签: 快递查询接口(trackingmore)