Use Node.js to track DPD shipments with DPD Tracking API.
- Real-time DPD tracking.
- Batch DPD tracking.
- Other features to manage your DPD tracking.
Installation is easy:
gem install trackingmore
Get the API key:
To use this API, you need to generate your API key.
- Click here to access TrackingMore admin.
-
Go to the "Developer" section.
-
Click "Generate API Key".
-
Give a name to your API key, and click "Save" .
Then, start to track your DPD shipments.
Create a tracking (Real-time tracking):
require 'trackingmore'
TrackingMore.api_key = 'your api key'
begin
params = {"tracking_number" => "05222757378047","courier_code"=>"dpd"}
response = TrackingMore::Tracking.create_tracking(params)
puts response
rescue TrackingMore::TrackingMoreException => e
puts "Caught Custom Exception: #{e.message}"
rescue StandardError => e
puts "Caught Standard Error: #{e.message}"
end
Create trackings (Max. 40 tracking numbers create in one call):
require 'trackingmore'
TrackingMore.api_key = 'your api key'
begin
params = [{"tracking_number" => "01206100616399","courier_code"=>"dpd"},{"tracking_number" => "01305199914553","courier_code"=>"dpd"}]
response = TrackingMore::Tracking.batch_create_trackings(params)
puts response
rescue TrackingMore::TrackingMoreException => e
puts "Caught Custom Exception: #{e.message}"
rescue StandardError => e
puts "Caught Standard Error: #{e.message}"
end
Get status of the shipment:
require 'trackingmore'
TrackingMore.api_key = 'your api key'
begin
# Perform queries based on various conditions
# params = {"courier_code"=>"dpd"}
# params = {"tracking_numbers" => "01206100616399,01305199914553","courier_code"=>"dpd"}
params = {"created_date_min" => "2023-08-23T14:00:00+08:00","created_date_max"=>"2023-08-23T15:04:00+08:00"}
response = TrackingMore::Tracking.get_tracking_results(params)
puts response
rescue TrackingMore::TrackingMoreException => e
puts "Caught Custom Exception: #{e.message}"
rescue StandardError => e
puts "Caught Standard Error: #{e.message}"
end
Update a tracking by ID:
require 'trackingmore'
TrackingMore.api_key = 'your api key'
begin
params = {"customer_name" => "New name","note"=>"New tests order note"}
id_string = '9a2f87d7df40d90a5752a8d7d3b98cb5'
response = TrackingMore::Tracking.update_tracking_by_id(id_string, params)
puts response
rescue TrackingMore::TrackingMoreException => e
puts "Caught Custom Exception: #{e.message}"
rescue StandardError => e
puts "Caught Standard Error: #{e.message}"
end