Skip to content

Latest commit

 

History

History
110 lines (81 loc) · 2.97 KB

dhl-ecommerce-tracking-api-nodejs.md

File metadata and controls

110 lines (81 loc) · 2.97 KB

DHL eCommerce Tracking API - Node.js

Use Node.js to track DHL eCommerce shipments with DHL eCommerce Tracking API.

Features

  • Real-time DHL eCommerce tracking.
  • Batch DHL eCommerce tracking.
  • Other features to manage your DHL eCommerce tracking.

Installation

Installation is easy:

$ npm install trackingmore-sdk-nodejs

Quick Start

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 DHL eCommerce shipments.

Usage

Create a tracking (Real-time tracking):

  const TrackingMore = require('trackingmore-sdk-nodejs')
  const key = 'your api key'
  const trackingmore = new TrackingMore(key)
  
  const params = {
    'tracking_number': '4982891432',
    'courier_code': 'dhlglobalmail',
    'order_number': '',
    'customer_name': '',
    'title': '',
    'language': 'en',
    'note': 'test Order'
  }
  trackingmore.trackings.createTracking(params)
    .then(result => console.log(result))
    .catch(e => console.log(e))

Create trackings (Max. 40 tracking numbers create in one call):

const TrackingMore = require('trackingmore-sdk-nodejs')
const key = 'your api key'
const trackingmore = new TrackingMore(key)

const params = [{
    'tracking_number': '2967650674',
    'courier_code':'dhlglobalmail'
},{
  'tracking_number': '8307478620',
  'courier_code':'dhlglobalmail'
}]
trackingmore.trackings.batchCreateTrackings(params)
  .then(result => console.log(result))
  .catch(e => console.log(e))

Get status of the shipment:

const TrackingMore = require('trackingmore-sdk-nodejs')
const key = 'your api key'
const trackingmore = new TrackingMore(key)

# Perform queries based on various conditions
const params = [{
    'tracking_number': '8307478620',
    'courier_code':'dhlglobalmail'
},{
  'tracking_number': '2967650674',
  'courier_code':'dhlglobalmail'
}]
trackingmore.trackings.batchCreateTrackings(params)
  .then(result => console.log(result))
  .catch(e => console.log(e))

Update a tracking by ID:

const TrackingMore = require('trackingmore-sdk-nodejs')
const key = 'your api key'
const trackingmore = new TrackingMore(key)

const params = {
    'customer_name': 'New name',
    'note':'New test order note'
}
const idString = "9b42b6bbbb647005acf63b5ed64f22f0"
trackingmore.trackings.updateTrackingByID(idString, params)
  .then(result => console.log(result))
  .catch(e => console.log(e))