Webhooks 

Webhook URL
Learn more about   format of inbound webhooks
Version

 Webhook V2

     When the tracking is updated and it triggers an update of one of your trigger setting, we make a POST request to the callback URL that you defined in the webhook page. The post body contains a JSON string of the below data.

     We currently support either HTTP or HTTPS urls, so you can have security by using an SSL-enabled url. But keep in mind that your endpoint is going to be wide-open on the internet, and you might not want others to be able to submit random data to your systems. At this time, aside from trying to keep the URL private, our best suggestion is to simply include a secret key in the URL that your provide and check the secret GET parameter in your scripts.


  •   Example Code  
  • Write response data into file
    
    $handle    = fopen('test.log','a+'); 
    $inputJSON = file_get_contents("php://input");
    if(!empty($inputJSON)){
    	fwrite($handle, date("Y-m-d H:i:s").":  ".$inputJSON . "\r\n");
    	print_r($inputJSON);
    }else{
    	fwrite($handle, date("Y-m-d H:i:s").": can not get webhook data!\r\n");
    }
    
  • Response  200
  • Headers
    Content-Type: application/json
    Body
    {
    "meta":{
       "code":200,
       "type":"Success",
       "message":"Success"
    },
       "data":{
    	"id":"7eabcb811fa10ab1f77d10418579a7f5",
    	"tracking_number":"LX203960974CN",
    	"carrier_code":"china-ems",
    	"status":"exception",
    	"created_at":"2016-11-09T22:21:43+08:00",
    	"updated_at":"2016-11-16T00:13:34+08:00",
    	"title":"","order_id":null,
    	"customer_name":null,
    	"customer_email":"",
    	"original_country":"China",
    	"destination_country":"Sweden",
    	"itemTimeLength":18,
    	"origin_info":{
    		"weblink":"http:\/\/www.ems.com.cn\/",
    		"phone":null,
    		"carrier_code":"china-ems",
    		"trackinfo":[
    		{
    			"Date":"2016-11-15 08:23",
    			"StatusDescription":"\u672a\u59a5\u6295",
    			"Details":"\u745e\u5178"
    		},{
    			"Date":"2016-11-14 09:34",
    			"StatusDescription":"\u5230\u8fbe\u5904\u7406\u4e2d\u5fc3,\u6765\u81ea\u4e2d\u56fd \u5e7f\u5dde",
    			"Details":"\u745e\u5178"
    		},{
    			"Date":"2016-10-31 22:45",
    			"StatusDescription":"\u6d77\u5173\u653e\u884c",
    			"Details":"\u5e7f\u5dde\u5e02"
    		},{
    			"Date":"2016-10-31 22:35",
    			"StatusDescription":"\u9001\u4ea4\u6d77\u5173",
    			"Details":"\u5e7f\u5dde\u5e02"
    		},{
    			"Date":"2016-10-29 22:04",
    			"StatusDescription":"\u5230\u8fbe\u5e7f\u5dde\u822a\u7ad9\u5904\u7406\u4e2d\u5fc3\uff08\u7ecf\u8f6c\uff09",
    			"Details":"\u5e7f\u5dde\u5e02"
    		},{
    			"Date":"2016-10-29 20:20",
    			"StatusDescription":"\u79bb\u5f00\u4e2d\u5c71\u5e02 \u53d1\u5f80\u5e7f\u5dde\u5e02",
    			"Details":"\u4e2d\u5c71\u5e02"
    		},{
    			"Date":"2016-10-29 16:24",
    			"StatusDescription":"\u4e2d\u5c71\u5e02\u90ae\u653f\u901f\u9012\u7269\u6d41\u516c\u53f8\u6052\u57fa\u901f\u9012\u90e8\u5df2\u6536\u4ef6\uff08\u63fd\u6295\u5458\u59d3\u540d\uff1a\u9ad8\u4f1f\u5065,\u8054\u7cfb\u7535\u8bdd:13631122287\uff09",
    			"Details":"\u4e2d\u5c71\u5e02"
    		}]
    	},
    	"destination_info":{
    		"weblink":"http:\/\/www.posten.se\/",
    		"phone":null,
    		"carrier_code":"sweden-posten",
    		"trackinfo":[{
    			"Date":"2016-11-15 15:04",
    			"StatusDescription":"Posten has not been able to reach the recipient for delivery before 10.00. New delivery attempt to be made no later than 18.00. The item will subsequently be treated as an ordinary letter",
    			"Details":"535031, Sweden"
    		},{
    			"Date":"2016-11-15 14:00",
    			"StatusDescription":"The shipment item could not be delivered because the recipient was not possible to reach. A notice has been given and the shipment item is delivered to a service point.",
    			"Details":"535031, Sweden"
    		},{
    			"Date":"2016-11-15 07:23",
    			"StatusDescription":"The item has arrived at the recipient\u00b4s delivery point. Express to be dispatched to the recipient, other items notified",
    			"Details":"535031, Sweden"
    		},{
    			"Date":"2016-11-14 23:32",
    			"StatusDescription":"The item has been through the post terminal",
    			"Details":"149, Sweden"
    		},{
    			"Date":"2016-11-14 09:34",
    			"StatusDescription":"The item has arrived from abroad to Posten\u00b4s international terminal for sorting",
    			"Details":"Stockholm utr"
    		}]
    		}
    	}
    }