1.2.4 • Published 3 years ago

mws-client v1.2.4

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

npm.io npm.io npm.io

GitHub Actions workflows status

Build workflow status Publish workflow status

CodeClimate

npm.io npm.io npm.io


Installation

npm i mws-client

API documentation

Modules

ModuleDescription
mws-clientCreates a new client to communicate with MWS API

Classes

NameDescription
SectionA section of MWS API. Note: all sections and associated endpoints are generated automatically when instanciating a new client

Typedefs

NameDescription
MWSResponseResponse received from MWS API
OptionsOptions for the new MWS client instanciation
MWSMWS client

mws-client

Creates a new client to communicate with MWS API

Returns: MWS - MWS client

ParamTypeDescription
optsOptionsOptions to be passed to instanciate a new client

Example

const MWS = require('mws-client')({
  AWSAccessKeyId: process.env.YOUR_AWS_ACCESS_KEY,
  SellerId: process.env.YOUR_SELLER_ID,
  MWSAuthToken: process.env.YOUR_MWS_AUTH_TOKEN
})

Section

A section of MWS API. Note: all sections and associated endpoints are generated automatically when instanciating a new client

Kind: global class

Section.endpoint(opts)

Send a request to the given endpoint

Kind: static method of Section
Returns: MWSResponse - Response received from MWS API

ParamTypeDescription
optsObjectParameters for the API call. See here for details regarding parameters for every endpoints. Note: list parameters are not supporting Array type yet. You will have to build them in the same way as they appear in the query string of the signed request to MWS API (i.e. param.1=foo&param.2=bar)

Example

// retrieves inventory from given date for the German marketplace
const list = await MWS.fulfillmentInventory.listInventorySupply({
  QueryStartDateTime: new Date(d).toISOString(),
  ResponseGroup: 'Basic',
  _marketplace: 'DE'
})

// retrieve status of the fullfillmentInventory API for the German marketplace
const status = await MWS.fulfillmentInventory.getServiceStatus({ _marketplace: 'DE' })

MWSResponse

Response received from MWS API

Kind: global typedef
Properties

NameTypeDescription
headersObjectHeaders of the response received from the MWS API. Those are typical Headers as you would find in the Fetch API.
statusnumberResponse status code
bodyObjectParsed body from MWS API response

Options

Options for the new MWS client instanciation

Kind: global typedef
Properties

NameTypeDefaultDescription
AWSAccessKeyIdstringAWS access key ID
MWSAuthTokenstringMWS authentication token
SellerIdstringSeller ID
[SignatureVersion]string'2'Signature version used for signing to request URL
[SignatureMethod]string'HmacSHA256'Signature method used for signing to request URL
[userAgent]string'kaskadi-mws-client/VERSION (Language=node.js)'User agent used when sending request
[parserType]string'xml'Parser used for the response received from MWS. Accepted values: 'xml', 'text'

MWS

MWS client

Kind: global typedef
Properties

NameTypeDescription
SectionSectionMWS API section

Notes

Throttling

This client does not include throttling handling. The reason being that our internal implementation uses Lambda functions which are not persistent and therefore instantiate a new client at each function call. This makes a throttling handled via client irrelevant since multiple clients may be instantiated in a short period of time (or even in parallel) to call the same endpoint which leads to a client throttling state not reflecting the actual throttling state of the MWS API.

We encourage you to implement your own throttling handling in your infrastructure so that it fits your implementation. You can refer to MWS API documentation for more information on this.

Reminder: response headers are exposed via the mws-client return value so you may use those to handle an hourly capped endpoint.

Client implementation

This client uses signed requests to communicate with the MWS API. See docs here and there for more details.

Available sections & endpoints

All items listed here point to the MWS API docs

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago