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

node-shipstation

v0.1.3

Published

Simplify nodeJS integration with shipstation

Downloads

322

Readme

node-shipstation

A small node module that helps integrate your application with shipstation. There are still several API endpoints with shipstation that are not implemented. Feel free to fork and make pull requests, or add issues as you please.

Install

npm install node-shipstation

Usage

After having installed it, simply require it, set it up with your own apiKey and apiSecret, and start calling methods!

var shipstationAPI = require('node-shipstation');
var shipstation = new shipstationAPI(
  'apiKey',
  'apiSecret');

shipstation.callMethods();

Functions and responses

| Functions | Returns to callback | Explanation | | ---------------- | ---------------- | ---------------- | | get (link, options, callback) | callback(err, res, body) | Base function for using get on shipstation API. Can be used if non-implemented API call needed. | | put (link, data, callback) | callback(err, res, body)| Base function for using put on shipstation API. Can be used if non-implemented API call needed. | | post (link, data, callback) | callback(err, res, body) | Base function for using post on shipstation API. Can be used if non-implemented API call needed. | | del (link, options, callback) | callback(err, res, body) | Base function for using delete on shipstation API. Can be used if non-implemented API call needed. | | addAccount (account, callback) | callback(err, res, body) | Registers a new account and generates an apiKey and apiSecret. account | | getTags (callback) | callback(err, res, body) | Gets all tags in the account. | | getCarriers ([options], callback) | callback(err, res, body) | Gets all carriers. | | getCarrier (carrier_code, callback) | callback(err, res, body) | Gets a carrier by carrier_code. | | addFunds ({carrierCode, amount}, callback) | callback(err, res, body) | Adds the specified amount of funds to the carrier by carrier_code. | | getPackages (carrierCode, callback) | callback(err, res, body) | Gets all packages for the carrier by carrier_code. | | getServices (carrierCode, callback) | callback(err, res, body) | Gets all services for the carrier by carrier_code. | | getCustomers ([options], callback) | callback(err, res, body) | Gets all customers. | | getCustomer (id, callback) | callback(err, res, body) | Gets a customer by id. | | getOrders ([options], callback) | callback(err, res, body) | Gets all orders. options | | getOrdersByTag ({orderStatus, tagId}, callback) | callback(err, res, body) | Gets all orders with the specified orderStatus and tagId. | | getOrder (id, callback) | callback(err, res, body) | Gets an order by id. | | addOrder (order, callback) | callback(err, res, body) | Adds an order. order | | updateOrder (id, changes, callback) | callback(err, res, body) | Updates an order with the changes passed to the method. | | deleteOrder (id, callback) | callback(err, res, body) | Deletes an order by id. | | setOrderHold ({orderId, holdUntilDate}, callback) | callback(err, res, body) | Sets a hold on the specified order until the specified date string. | | setLabelForOrder (label, callback) | callback(err, res, body) | Sets the label for the specified order. label | | setOrderShipped (details, callback) | callback(err, res, body) | Sets the specified order as shipped. details | | addTagToOrder ({orderId, tagId}, callback) | callback(err, res, body) | Adds the specified tag to the specified order. | | removeTagFromOrder ({orderId, tagId}, callback) | callback(err, res, body) | Removes the specified tag from the specified order. | | getProducts ([options], callback) | callback(err, res, body) | Gets all products. | | getProduct (id, callback) | callback(err, res, body) | Gets a product by id. | | getShipments ([options], callback) | callback(err, res, body) | Gets all shipments. | | addShippingLabel (label, callback) | callback(err, res, body) | Creates a shipping label/shipment. label | | getShippingRates (request, callback) | callback(err, res, body) | Gets shipping rates for the specified request. request | | voidShippingLabel (id, callback) | callback(err, res, body) | Voids the specified shipping label/shipment. | | getStores ([options], callback) | callback(err, res, body) | Gets all stores. | | getStore (id, callback) | callback(err, res, body) | Gets a store by id. | | updateStore (id, store, callback) | callback(err, res, body) | Updates the specified store. store | | getStoreRefreshStatus (id, callback) | callback(err, res, body) | Gets the specified store's refresh status | | refreshStore (id, callback) | callback(err, res, body) | Refreshes the specified store | | deactivateStore (id, callback) | callback(err, res, body) | Deactivates the specified store | | reactivateStore (id, callback) | callback(err, res, body) | Reactivates the specified store | | getMarketplaces (callback) | callback(err, res, body) | Lists the marketplaces that can be integrated with ShipStation. | | getWarehouses ([options], callback) | callback(err, res, body) | Get all warehouses. | | getWarehouse (id, callback) | callback(err, res, body) | Gets a warehouse by id. | | updateWarehouse (id, warehouse, callback) | callback(err, res, body) | Updates the specified warehouse. warehouse| | addWarehouse (warehouse, callback) | callback(err, res, body) | Adds a new warehouse. warehouse|

Helpers

node-shipstation has a few helpers that make it easier to make several different requests for the same target using chaining. Check the example below to see one in action. Operations will not be run in the order they are chained in

| Helper | Methods | |---------------|--------------------------------------| | carrier(id) | addFunds(amount, callback) packages(callback) services(callback) | | order(id) | get(callback) delete(callback) hold(date, callback) update({changes}, callback) addTag(tagId, callback) removeTag(tagId, callback) shipped(data, callback) label(data, callback) | | store(id) | update(data, callback) status(callback) refresh(callback) deactivate(callback) reactivate(callback) |

Examples

Getting An Order

shipstation.getOrder(12345, function(err, res, body){
  if(err) throw err;
  console.log('Got order');
  console.log(body);
});

Marking an Order Shipped

var orderShipped = {
  orderId: 12345,
  carrierCode: 'express_1',
  shipDate: '02/10/2015',
  trackingNumber: 'ZLU2342323',
  notifyCustomer: false,
  notifySalesChannel: false
}

shipstation.setOrderShipped(orderShipped, function(err, res, body){
  //Handle the callback.
});

Tag manipulation with Order Helper

var handler = function(err, res, body){
	console.log(body);
};

shipstation.order(12345)
	.addTag(9432, handler)
	.addTag(9554, handler)
	.removeTag(1233, handler);