node.js SDK for TrackingMore API
Contact: manage@trackingmore.org
npm install trackingmore-sdk-nodejs
const TrackingMore = require('trackingmore-sdk-nodejs')
const key = 'your api key'
const trackingmore = new TrackingMore(key)
trackingmore.couriers.getAllCouriers()
.then(result => console.log(result))
.catch(e => console.log(e))
npm run test or npm test
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))
https://api.trackingmore.com/v4/couriers/all
trackingmore.couriers.getAllCouriers()
.then(result => console.log(result))
.catch(e => console.log(e))
https://api.trackingmore.com/v4/couriers/detect
const params = {'tracking_number': '9400111899562537624326'}
trackingmore.couriers.detect(params)
.then(result => console.log(result))
.catch(e => console.log(e))
https://api.trackingmore.com/v4/trackings/create
const params = {
'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))
https://api.trackingmore.com/v4/trackings/get
const params = {
'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))
https://api.trackingmore.com/v4/trackings/batch
const params = [{
'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))
https://api.trackingmore.com/v4/trackings/update/{id}
const params = {
'customer_name': 'New name',
'note':'New test order note'
}
const idString = "9a135b15b5d983e1d8950d99022db0c7"
trackingmore.trackings.updateTrackingByID(idString, params)
.then(result => console.log(result))
.catch(e => console.log(e))
https://api.trackingmore.com/v4/trackings/delete/{id}
const idString = "9a135b15b5d983e1d8950d99022db0c7"
trackingmore.trackings.deleteTrackingByID(idString)
.then(result => console.log(result))
.catch(e => console.log(e))
https://api.trackingmore.com/v4/trackings/retrack/{id}
const idString = "99f4ed7fc73aa83fe68fd69ab6458b28"
trackingmore.trackings.retrackTrackingByID(idString)
.then(result => console.log(result))
.catch(e => console.log(e))
https://api.trackingmore.com/v4/awb
const params = {
'awb_number': '235-69030430',
}
trackingmore.airWaybills.createAnAirWayBill(params)
.then(result => console.log(result))
.catch(e => console.log(e))
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 CODE | META CODE | TYPE | MESSAGE |
---|---|---|---|
200 | 200 | Success |
Request response is successful |
400 | 400 | BadRequest |
Request type error. Please check the API documentation for the request type of this API. |
400 | 4101 | BadRequest |
Tracking No. already exists. |
400 | 4102 | BadRequest |
Tracking No. no exists. Please use 「Create a tracking」 API first to create shipment. |
400 | 4103 | BadRequest |
You have exceeded the shipment quantity of API call. The maximum quantity is 40 shipments per call. |
400 | 4110 | BadRequest |
The value of tracking_number is invalid. |
400 | 4111 | BadRequest |
Tracking_number is required. |
400 | 4112 | BadRequest |
Invalid Tracking ID. |
400 | 4113 | BadRequest |
Retrack is not allowed. You can only retrack an expired tracking. |
400 | 4120 | BadRequest |
The value of courier_code is invalid. |
400 | 4121 | BadRequest |
Cannot detect courier. |
400 | 4122 | BadRequest |
Missing or invalid value of the special required fields for this courier. |
400 | 4130 | BadRequest |
The format of Field name is invalid. |
400 | 4160 | BadRequest |
The awb_number is required or invaild format. |
400 | 4161 | BadRequest |
The awb airline does not support yet. |
400 | 4190 | BadRequest |
You are reaching the maximum quota limitation, please upgrade your current plan. |
401 | 401 | Unauthorized |
Authentication failed or has no permission. Please check and ensure your API Key is correct. |
403 | 403 | Forbidden |
Access prohibited. The request has been refused or access is not allowed. |
404 | 404 | NotFound |
Page does not exist. Please check and ensure your link is correct. |
429 | 429 | TooManyRequests |
Exceeded API request limits, please try again later. Please check the API documentation for the limit of this API. |
500 | 511 | ServerError |
Server error. Please contact us: service@trackingmore.org. |
500 | 512 | ServerError |
Server error. Please contact us: service@trackingmore.org. |
500 | 513 | ServerError |
Server error. Please contact us: service@trackingmore.org. |