newgistics

1.1.3 • Public • Published

newgistics

node.js wrapper for making calls to the Newgistics Fulfillment API

Installation

npm install newgistics

XML conversion

XML attributes are marked with the @ tag, while body attributes are marked with the # tag. For example,

<Name id="12345">Lou</Name>

would convert to

{
	Name: {
		'@': { id: '12345' },
		'#': 'Lou'
	}
}

All requests/responses are JS objects.

Usage

Important note: The outermost collection identifier is not required. Your API key provided by Newgistics is required. Environment options are 'production' and 'staging'.

var newgistics = require('newgistics');

var gateway = newgistics.connect({
    environment: newgistics.Environments.staging,
    apiKey: '12421412121255115221512521'
});

Posting a new shipment

var orderData =  {
    Order: {
    	   '@': { orderID: '12345' },
	   	CustomerInfo: {
			FirstName: 'Lou',
			LastName: 'Seal',
			Address1: '24 Willie Mays Plaza',
			City: 'San Francisco',
			State: 'CA',
			Zip: '94107',
			Country: 'USA',
			Email: 'louseal@sfgiants.com'
		},
		OrderDate: '11/10/2013',
		Items: {
			Item: [
				{
					SKU: '1000',
					Qty: '1'
			    }
			 ]
		}
	}
}

gateway.shipments.post(orderData, function(err, res) {
	// ...
});

Searching for an existing shipment

gateway.shipments.search({ id: 100001 }, function(err, res) {
			   // ...
});

TODO - add support for remaining Newgistics API routes

Licensed under the BSD license.

Dependents (0)

Package Sidebar

Install

npm i newgistics

Weekly Downloads

3

Version

1.1.3

License

BSD

Last publish

Collaborators

  • smcgary
  • exhaze
  • dcosgrove