node-canadapost

0.2.0 • Public • Published

node-canadapost

Build Status Dependency Status devDependency Status version license

A Node wrapper for Canada Post APIs

Installation

$ npm install node-canadapost

Initialization

var CanadaPost = require('node-canadapost');
var canadapost = CanadaPost(config)

** Note: ** Configuration object MUST contain your API username and password, optional parameters include customernumber and contractid.

API

#getServiceOutageInfo(callback[err, results])

This will call the Service Outage API from Canada Post, and return a object representation of their response as parsed by xml2js.

#isServiceDown(callback[err, result])

This sums up what you really want to know from #getServiceOutageInfo. Barring some sort of error, this will give you a true/false answer if the service endpoint is down.

#getShippingRates(params, callback[err, result])

This function will use the parameters provided to obtain the most accurate shipping rates for your shipment. Mandatory parameters include Parcel Characteristics (Height, Length, Weight, and Width), the Origin Postal Code (Canadian), and the shipment's destination (One of: 'domestic', 'united-states', or 'international').

Package Sidebar

Install

npm i node-canadapost

Weekly Downloads

2

Version

0.2.0

License

MIT

Last publish

Collaborators

  • davidjamesthedj