npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

trackingmore-sdk-nodejs

v1.0.8

Published

node.js SDK for TrackingMore API

Downloads

169

Readme

TrackingMore-sdk-nodejs

node.js SDK for TrackingMore API

Contact: [email protected]

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

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

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

Testing

npm run test or npm test

Error handling

Simply add a try-catch block

// 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

const params = {'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

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))
Get tracking results of multiple trackings.

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))
Create multiple trackings (Max. 40 tracking numbers create in one call).

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))
Update a tracking by ID.

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))
Delete a tracking by ID.

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))
Retrack expired tracking by ID.

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))

Air Waybill

Create an air waybill.

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))

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 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: [email protected]. 500 |512 | ServerError | Server error. Please contact us: [email protected]. 500 |513 | ServerError | Server error. Please contact us: [email protected].