TrackingMore API

Ruby Class Example 

  • API類
    //www.trackingmore.com/api-class_ruby.html

    インストール:
    1.ご希望の位置にこの類をインストールします。
    2.この行でごapikey protected $apikey = 'YOUR API KEY'をご入力ください。
    3.この類がプログラムに含んでいる。

    すべての運送商をリストする。
    url="http://api.trackingmore.com/v2/carriers/"
    postData = ""
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"GET")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    Detect a carrier by tracking code
    url="http://api.trackingmore.com/v2/carriers/detect"
    postData = {"tracking_number":"EA152563251CN"}
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    すべての追跡をリストします。
    url="http://api.trackingmore.com/v2/trackings/get?page=1&limit=100&created_at_min=1521314361&created_at_max=1541314361&update_time_min=1521314361&update_time_max=1541314361&order_created_time_min=1521314361&order_created_time_max=1541314361&numbers=BYS006086078&orders=#123&lang=en"
    postData = ""
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"GET")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    一つの追跡条目を創建します。
    url="http://api.trackingmore.com/v2/trackings/post"
    postData = {"tracking_number":"BYS006086078","carrier_code":"yanwen","title":"chase chen","customer_name":"chase","customer_email":"[email protected]","order_id":"#123","order_create_time":"1521314361","destination_code":"IL","tracking_ship_date":"1521314361","tracking_postal_code":"13ES20","lang":"en","logistics_channel":"4PX挂号小包"}
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    多くの追跡を創建します。
    url="http://api.trackingmore.com/v2/trackings/batch"
    postData = [
       {"tracking_number": "BYS006086087","carrier_code":"yanwen","title":"chase chen","customer_name":"chase","customer_email":"[email protected]","order_id":"#123","order_create_time":"2018-05-11 12:00","destination_code":"IL","tracking_ship_date":"1521314361","tracking_postal_code":"13ES20","lang":"en","logistics_channel":"4545454"},
       {"tracking_number": "BYS006086076","carrier_code":"yanwen","title":"chase chen","customer_name":"chase","customer_email":"[email protected]","order_id":"#123","order_create_time":"2018-05-10 12:00","destination_code":"IL","tracking_ship_date":"1521314361","tracking_postal_code":"13ES20","lang":"en","logistics_channel":"4PX挂号小包"}
    ]
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    一つの追跡結果を受け取ります。
    url="http://api.trackingmore.com/v2/trackings/yanwen/RX478151565DE"
    postData =""
    tracker  = Trackingmore.new()
    res      = tracker.tracker(url,postData,"GET")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    追跡条目を更新する
    url="http://api.trackingmore.com/v2/trackings/yanwen/BYS006086079"
    postData = {"title":"ruby test","customer_name":"test","customer_email":"[email protected]","order_id":"#1234567","logistics_channel":"4PX挂号小包"}
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"PUT")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    追跡条目を削除する
    url="http://api.trackingmore.com/v2/trackings/yanwen/RX478151548DE"
    postData =""
    tracker  = Trackingmore.new()
    res      = tracker.tracker(url,postData,"DELETE")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    一回のリアタイム追跡結果を取得します。
    url="http://api.trackingmore.com/v2/trackings/realtime"
    postData = {"tracking_number": "RO454978691CN","carrier_code":"china-post","destination_code": "United States","tracking_ship_date":"deutsch-post","tracking_postal_code":"postnl-3s","specialNumberDestination":"postnl-3s","order":"#123123","order_create_time":"1521314361","lang":"en"}
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    複数の追跡項目を削除します。
    url="http://api.trackingmore.com/v2/trackings/delete"
    postData = [{"tracking_number":"BYS006086077","carrier_code":"yanwen"},{"tracking_number":"BYS006086088","carrier_code":"yanwen"}]
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    宅配便コードを変更します。
    url="http://api.trackingmore.com/v2/trackings/update"
    postData = {"tracking_number":"BYS006086077","carrier_code":"dhl","update_carrier_code":"yanwen"}
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    ユーザー情報を取得します。
    url="http://api.trackingmore.com/v2/trackings/getuserinfo"
    postData = ""
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"GET")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    ステータス番号を取得します。
    url="http://api.trackingmore.com/v2/trackings/getstatusnumber"
    postData = ""
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"GET")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    追跡項目を更新しないようにバッチ
    url="http://api.trackingmore.com/v2/trackings/notupdate"
    postData = [
       {"tracking_number":"BYS006086077","carrier_code":"yanwen"},
       {"tracking_number":"BYS006086088","carrier_code":"yanwen"}
    ]
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    出荷は遠隔地に送信されますを確認します。
    url="http://api.trackingmore.com/v2/trackings/remote"
    postData = [{"country":"CN","postcode":"400422","company":"dhl"},{"country":"CN","postcode":"412000","company":"dhl"}]
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    宅配高齢化結果を得る
    url="http://api.trackingmore.com/v2/trackings/costtime"
    postData = [{"carrier_code":"dhl","destination":"US","original":"CN"},{"carrier_code":"dhl","destination":"RU","original":"CN"}]
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    
    多くの追跡項目を更新します。
    url="http://api.trackingmore.com/v2/trackings/updatemore"
    postData =[{"tracking_number":"BYS006086087","carrier_code":"yanwen","title":"chase chen111","customer_name":"chaseddd","customer_email":"[email protected]","order_id":"#123457777774","destination_code":"IL","status":"4","logistics_channel":"4PX挂号小包"},{"tracking_number":"BYS006086076","carrier_code":"yanwen","title":"chase chen222","customer_name":"chase dsd","customer_email":"[email protected]","order_id":"#1234577777","destination_code":"IL","status":"4","logistics_channel":"4PX挂号小包"}]
    tracker = Trackingmore.new()
    res = tracker.tracker(url,postData,"POST")
    puts "Response #{res.code} #{res.message}: #{res.body}"
    

あなたの
今日の出荷追跡

出荷の更新を自動化したり、配送効率を向上させたりしたいとお考えですか?TrackingMoreの強力なAPIを使用すると、顧客の購入後のジャーニーを変革するためのすべてのツールをすぐに利用できます。