newegg-marketplace

1.0.3 • Public • Published

NPM

David David Travis npm Join the chat at https://gitter.im/node-newegg-marketplace/Lobby Gratipay

Newegg Marketplace API Client

This library implements the different endpoints as described by Newegg's developer guide and exposes them to you, the developer. The entire library was generated by parsing the developer guide PDF, you can see the tools I created to do this in the dev-utils folder.

You can find a reference containing each method implemented by this library in API.md. This shows you what to use in this library to perform a certain action from the API documentation.

Please Note

All this library does is wrap the requests and expose functions that (can make) your code prettier and more readable. It does not error check or validate to any of the standards as the Newegg developer guide provides, nor does it do formatting (outside of URL parameters) for the data you're giving to Newegg.

Timeout

Query timeout is 15s by default, you can customize this by passing your own ms for the timeout as a 4th parameter in the constructor.

Failover

This plugin will handle failover, per 8.2. Failover Endpoints for API Service in the developer guide. You can disable this functionality by passing a 5th parameter, false, when constructing NeweggMarketplaceAPI. Failover functionality isn't smart, it works per request.

Example

const NeweggMarketplaceAPI = require('newegg-marketplace');
 
const Marketplace = new NeweggMarketplaceAPI('A006', '727ddc0678f4d115bd544aff46bc15634', '1B6B1383-01D1-4A1E-BA53-05DECE9BD765');
 
Marketplace.SellerMgmt
  .SellerStatusCheck('contentmgmt')
  .then(console.log)
  .catch(console.error);
 
Marketplace.ContentMgmt
  .GetManufacturer({
    OperationType: 'GetManufacturerRequest',
    RequestBody: {
      PageIndex: 1,
      PageSize: 10,
      RequestCriteria: {},
    },
  })
  .then(console.log)
  .catch(console.error);

Additional Notes

Errors are your friend!

Newegg returns very descriptive errors. If you can't figure out how to format the data in a request, refer to the error you're getting. You should be able to solve your issue.

Wrong JSON Documentation in the Newegg Marketplace API Developer Guide

The current documentation has some errors and at times you'll be forced to go over the XML version of a request in order to figure out how to do the JSON version of the request. Note, even though the request body "requires" the "NeweggAPIRequest" element, you actually need to exclude it in the JSON, it only needs to be there for the XML.

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay

Package Sidebar

Install

npm i newegg-marketplace

Weekly Downloads

0

Version

1.0.3

License

MIT

Last publish

Collaborators

  • zikeji