API接口之一 轨迹查询
-------------- 物流信息查询
1,查询轨迹
msgType=QueryTrack
报文内容(content)字段说明:
参数名 | 类型 | 说明 |
expressNumber | string | 运单号 |
示例:
请求示例(参数)header: "Content-Type":"application/json", "msgId": "1", "msgType": "QueryTrack" "partnerCode": "ANDIC002" "dataDigest": "e5c0126a12c9607437b9de0803657632" body: { "expressNumber":"AD-ADMY188" } |
PHP示例:
$pass = '61d6dfbd3d'; $body = '{"expressNumber":"AD-ADMY188"}'; $dataDigest= MD5($body.$pass); $headstr = 'content-type:application/json,msgId:1,msgType:QueryTrack,partnerCode:ANDIC002,dataDigest:'; $headMB = $headstr.$dataDigest; $head = explode(',',$headMB);//这里转数组或者直接jion_encode() $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPHEADER,$head); curl_setopt($curl, CURLOPT_URL, "https://www.andi56.com?c=API"); //设置获取的信息以文件流的形式返回,而不是直接输出。 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设置post方式提交 curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $body); $result = curl_exec($curl); curl_close($curl); $dataArr = json_decode($result,TRUE); |
返回的data字段说明:
参数名 | 类型 | 说明 |
Location | string | 发生地点或上传信息的网点 |
TrackDateTime | string | 发生时间 |
TrackStatus | string | 轨迹信息 |
remark | string | 备注 |
返回示例:
失败响应示例 { "code": "400", "data": null, "msg": "无货物跟踪轨迹" } 成功响应示例 {"data":[{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-20","TrackStatus":"Delivery completed \/ 已完成派送"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-19","TrackStatus":"Waiting for arrangement delivery \/ 等待安排发货"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-16","TrackStatus":"Arrange for opening \/ 安排开柜"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-15","TrackStatus":"Arrived Malaysia warehouse \/ 柜子已到马来西亚仓库"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-15","TrackStatus":"Done custom clearance at the destination port \/ 在目的地港清关完成"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-15","TrackStatus":"Proceed custom clearance at the destination port \/ 目的地港进行清关"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-14","TrackStatus":"Discharges from port \/ 已安排下船"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-14","TrackStatus":"Waiting Discharges from ship \/ 等待柜子下船"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-14","TrackStatus":"Actual Time Of Arrival \/ 实际到港"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-10","TrackStatus":"Actual Time Of Departure \/ 实际离港"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-15 02:02:02","TrackStatus":"ETA(estimated time of arrival)预计到港"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-11 02:02:02","TrackStatus":"ETD(estimated time of departure)预计离港"},{"Location":"安抵MY海运","remark":"","TrackDateTime":"2023-06-05 02:02:02","TrackStatus":"Loaded装柜"}],"msg":"轨迹获取成功","code":200} 成功响应解码:(示例上图重用php解码为数组) Array ( [data] => Array ( [0] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-20 [TrackStatus] => Delivery completed / 已完成派送 ) [1] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-19 [TrackStatus] => Waiting for arrangement delivery / 等待安排发货 ) [2] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-16 [TrackStatus] => Arrange for opening / 安排开柜 ) [3] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-15 [TrackStatus] => Arrived Malaysia warehouse / 柜子已到马来西亚仓库 ) [4] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-15 [TrackStatus] => Done custom clearance at the destination port / 在目的地港清关完成 ) [5] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-15 [TrackStatus] => Proceed custom clearance at the destination port / 目的地港进行清关 ) [6] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-14 [TrackStatus] => Discharges from port / 已安排下船 ) [7] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-14 [TrackStatus] => Waiting Discharges from ship / 等待柜子下船 ) [8] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-14 [TrackStatus] => Actual Time Of Arrival / 实际到港 ) [9] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-10 [TrackStatus] => Actual Time Of Departure / 实际离港 ) [10] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-15 02:02:02 [TrackStatus] => ETA(estimated time of arrival)预计到港 ) [11] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-11 02:02:02 [TrackStatus] => ETD(estimated time of departure)预计离港 ) [12] => Array ( [Location] => 安抵MY海运 [remark] => [TrackDateTime] => 2023-06-05 02:02:02 [TrackStatus] => Loaded装柜 ) ) [msg] => 轨迹获取成功 [code] => 200 ) |