Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

14 Commits

Repository files navigation

TrackingMore-sdk-nodejs

node.js SDK for TrackingMore API

Contact: manage@trackingmore.org

Official document

Document

Index

  1. Installation
  2. Testing
  3. SDK
    1. Couriers
    2. Trackings
    3. Air Waybill

Installation

npm install trackingmore-sdk-nodejs

Quick Start

constTrackingMore=require('trackingmore-sdk-nodejs')constkey='your api key'consttrackingmore=newTrackingMore(key)trackingmore.couriers.getAllCouriers().then(result=>console.log(result)).catch(e=>console.log(e))

Testing

npm run test or npm test

Error handling

For asynchronous operations, you can use Promise's catch method to listen for exceptions.

// Get all couriers (couriers/all)trackingmore.couriers.getAllCouriers().then(result=>console.log(result)).catch(e=>console.error('An error occurred:',e.message))

Couriers

Return a list of all supported couriers.

https://api.trackingmore.com/v4/couriers/all

trackingmore.couriers.getAllCouriers().then(result=>console.log(result)).catch(e=>console.log(e))
Return a list of matched couriers based on submitted tracking number.

https://api.trackingmore.com/v4/couriers/detect

constparams={'tracking_number': '9400111899562537624326'}trackingmore.couriers.detect(params).then(result=>console.log(result)).catch(e=>console.log(e))

Trackings

Create a tracking.

https://api.trackingmore.com/v4/trackings/create

constparams={'tracking_number': '9400111899562537624326','courier_code': 'usps','order_number': '','customer_name': '','title': '','language': 'en','note': 'test Order'}trackingmore.trackings.createTracking(params).then(result=>console.log(result)).catch(e=>console.log(e))
Get tracking results of multiple trackings.

https://api.trackingmore.com/v4/trackings/get

constparams={'tracking_numbers': '9400111899562539126562,9400111899562537624656','courier_code': 'usps','created_date_min': '2023-08-23T06:00:00+00:00','created_date_max': '2023-09-05T07:20:42+00:00',}trackingmore.trackings.getTrackingResults(params).then(result=>console.log(result)).catch(e=>console.log(e))
Create multiple trackings (Max. 40 tracking numbers create in one call).

https://api.trackingmore.com/v4/trackings/batch

constparams=[{'tracking_number': '9400111899562537680047','courier_code':'usps'},{'tracking_number': '9400111899562537680048','courier_code':'usps'}]trackingmore.trackings.batchCreateTrackings(params).then(result=>console.log(result)).catch(e=>console.log(e))
Update a tracking by ID.

https://api.trackingmore.com/v4/trackings/update/{id}

constparams={'customer_name': 'New name','note':'New test order note'}constidString="9a135b15b5d983e1d8950d99022db0c7"trackingmore.trackings.updateTrackingByID(idString,params).then(result=>console.log(result)).catch(e=>console.log(e))
Delete a tracking by ID.

https://api.trackingmore.com/v4/trackings/delete/{id}

constidString="9a135b15b5d983e1d8950d99022db0c7"trackingmore.trackings.deleteTrackingByID(idString).then(result=>console.log(result)).catch(e=>console.log(e))
Retrack expired tracking by ID.

https://api.trackingmore.com/v4/trackings/retrack/{id}

constidString="99f4ed7fc73aa83fe68fd69ab6458b28"trackingmore.trackings.retrackTrackingByID(idString).then(result=>console.log(result)).catch(e=>console.log(e))

Air Waybill

Create an air waybill.

https://api.trackingmore.com/v4/awb

constparams={'awb_number': '235-69030430',}trackingmore.airWaybills.createAnAirWayBill(params).then(result=>console.log(result)).catch(e=>console.log(e))

Response Code

Trackingmore uses conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the provided information (e.g. a required parameter was missing, a charge failed, etc.), and codes in the 5xx range indicate an TrackingMore's server error.

Http CODEMETA CODETYPEMESSAGE
200200SuccessRequest response is successful
400400BadRequestRequest type error. Please check the API documentation for the request type of this API.
4004101BadRequestTracking No. already exists.
4004102BadRequestTracking No. no exists. Please use 「Create a tracking」 API first to create shipment.
4004103BadRequestYou have exceeded the shipment quantity of API call. The maximum quantity is 40 shipments per call.
4004110BadRequestThe value of tracking_number is invalid.
4004111BadRequestTracking_number is required.
4004112BadRequestInvalid Tracking ID.
4004113BadRequestRetrack is not allowed. You can only retrack an expired tracking.
4004120BadRequestThe value of courier_code is invalid.
4004121BadRequestCannot detect courier.
4004122BadRequestMissing or invalid value of the special required fields for this courier.
4004130BadRequestThe format of Field name is invalid.
4004160BadRequestThe awb_number is required or invaild format.
4004161BadRequestThe awb airline does not support yet.
4004190BadRequestYou are reaching the maximum quota limitation, please upgrade your current plan.
401401UnauthorizedAuthentication failed or has no permission. Please check and ensure your API Key is correct.
403403ForbiddenAccess prohibited. The request has been refused or access is not allowed.
404404NotFoundPage does not exist. Please check and ensure your link is correct.
429429TooManyRequestsExceeded API request limits, please try again later. Please check the API documentation for the limit of this API.
500511ServerErrorServer error. Please contact us: service@trackingmore.org.
500512ServerErrorServer error. Please contact us: service@trackingmore.org.
500513ServerErrorServer error. Please contact us: service@trackingmore.org.

About

node.js SDK for TrackingMore API

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages