node-shipping-canadapost
v1.0.0
Published
CanadaPost API for Node.JS
Downloads
5
Readme
Node Shipping CanadaPost
Install
npm i node-shipping-canadapost
Usage
Init
import CanadaPostAPI from 'node-shipping-canadapost';
const cp = new CanadaPostAPI({
environment: 'sandbox', // or production
platform: 'platform ID',
contract: 'contract number', // or null
customer: 'customer number',
user: 'user'
password: 'password'
});
Get artifacts
cp.artifacts({
url: 'https://XX/ers/artifact/0456cd17e32a0039/3584/0'
}, cb)
Get token
cp.token({ }, cb)
Get info
cp.info({
token: '94a3dc50a581cc41b1f6d6'
}, cb)
Get customers
cp.customers({ }, cb)
Get manifest
cp.manifest({
url: 'https://XX/rs/1234567/1234567/manifest/123456789012345678'
}, cb)
Get options
cp.options({
code: 'https://XX/rs/1234567/1234567/manifest/123456789012345678'
}, cb)
Pickups
See params here
// Check pickup availability
cp.pickupAvailability(params, cb)
// Create
cp.cancelPickup(params, cb)
// Create pickup
cp.pickup(params, cb)
Rates
See params here
// Create
cp.rates(params, cb)
Discover services
cp.services({
country: 'US',
origin: '32703',
destination: '32703',
contract: '' // or null
}, cb)
Shipments
See params here
cp.create(params, cb)