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 🙏

© 2026 – Pkg Stats / Ryan Hefner

shipwire-node-client

v1.0.7

Published

Node.js client library for the Shipwire API

Readme

Shipwire API Client for Node.js

Build Status Coverage Status Dependency Status devDependency Status Contributions welcome License

Getting Started

Installation

// using NPM
$ npm install --save shipwire-node-client

// using Yarn
$ yarn add shipwire-node-client

Constructor

const Shipwire = require('shipwire-node-client')({
  username: '<username>',
  password: '<password>',
  beta: false
});

// you could also create the token yourself and send that in instead
const Shipwire = require('shipwire-node-client')({
  token: new Buffer.from('<username>:<password>').toString('base64'),
  beta: true
});

The Shipwire constructor takes an object with up to four fields:

  • token - Authentication method - a base64-encoding of your Shipwire username:password string. This is your username, followed by a colon (:), followed by your password.
  • username - Authentication method - requires password as well - your Shipwire username
  • password - Authentication method - requires username as well - your Shipwire password
  • beta - Defaults to false - determines whether the host will be api.beta.shipwire.com (if beta evaluates to true) or api.shipwire.com (if beta evaluates to false)

If a valid authentication method is not passed in, an error will be thrown.

API

Syntax

Each Shipwire API endpoint can be accessed through the Shipwire object returned by the constructor. The syntax is

Shipwire.<resource>.<method>(<params>)

For example, to retrieve a list of returns the appropriate call would be:

Shipwire.returns.list(); // this method needs no params

Parameters

All endpoints can take parameters and many require them. The parameters an endpoint accepts are first a series of strings that will be matched to create the path (more below). The last parameter may be an Info object, which describes the querystring and the body of the request.

const Info = {
  body: {...}, // the body to send with the request
  pdf: Boolean, // determines whether to accept a pdf response. defaults to False
  query: {...} // the query field will be querystringified and appended to the path
};

The Info object is optional in some cases. If included, it can have as few as 0 and as many as all of the fields shown above.

Path Replacement

All parameters sent to a method, except for the last one if it is an object, will be interpreted as strings for the purpose of path replacement. Shipwire endpoints can require specific ID(s) to complete: /api/v3/orders/:id, the endpoint for retrieving a specific order, requires an order ID in the path. When this endpoint is called, all string parameters will be substituted in for required IDs in the path in the order provided.

// will call '/api/v3/orders/order_id'
Shipwire.orders.get('order_id');

// will call '/api/v3/orders/order_id' and ignore 
// 'Simon' and 'Garfunkel' since there is only 1 thing in the path to replace
Shipwire.orders.get('order_id', 'Simon', 'Garfunkel');

Promises

All endpoints return a promise.

const Info = {
  body: {
    orderNo: "foobar1",
    externalId: "rFooBar1",
    vendorId: "567"
  },
  query: {
    extra: "information",
    for: "querystring"
  }
};

// will call '/api/v3/orders/id_of_order?extra=information&for=querystring'
Shipwire.orders.modify('id_of_order', Info).then(res => {
  console.log(res);
}).catch(err => {
  console.error(err);
});

Resources and Methods

Contributing

If you like this project, we'd love to have your help. Contributing doesn't necessarily mean writing code though. You can also help out by:

  • Opening issues on bugs you find or new features you'd like to see
  • Joining discussion on issues and pull requests
  • Helping write documentation i.e. fleshing out the Methods

Updating NPM

Generally, the workflow for updating the NPM package is as follows:

  1. (Optional) Open an issue and describe what you will be trying to fix: a specific bug or a new feature
  2. Clone the repo to your local machine
  3. Create a new branch (pick a name that clearly describes the intent)
  4. Commit changes to the new branch and push to origin
  5. Open a pull request with a clear description of the change - allow some time for feedback
  6. Once there's a general consensus, merge the PR into master and update the npm package as needed

To Do

  • Handle (throw errors on) empty tokens in constructor