Home Reference Source

Function

Static Public Summary
public

async callEndpoint(name: string, callOptions: object, opt: object): any

Call a known endpoint at MWS, returning the raw data from the function.

public

getLowestPricedOffersForASIN

public

Call MWS ListMarketplaceParticipations, return parsed results

public

async getMatchingProductForId(options: Object): Product[]

Returns a list of products and their attributes, based on a list of ASIN, GCID, SellerSKU, UPC, EAN, ISBN, or JAN values

public

async getReport(options: object): Array | object

Returns the contents of a report

public

async getReportList(options: {}): *

TODO: write documentation for getReportList

public

async getReportListAll(options: {}): *

TODO: write documentation for getReportListAll (or see comment on getReportListByNextToken)

public

async getReportListByNextToken(options: *): *

TODO: write documentation for getReportListByNextToken (or just roll getReportList and getReportListByNextToken into the same wrapper) (that wrapper might be getReportListAll, and just rename it)

public

async getReportRequestList(options: object, ReportRequestIdList: string[], ReportTypeList: string[], ReportProcessingStatusList: string[], MaxCount: number, RequestedFromDate: Date, RequestedToDate: Date): GetReportRequestListResult[]

Returns a list of report requests that you can use to get the ReportRequestId for a report After calling requestReport, you should call this function occasionally to see if/when the report has been processed.

public

init(config: object): mws-simple

Initialize mws-advanced with your MWS access keys, merchantId, optionally authtoken, host, port If accessKeyId, secretAccessKey, and/or merchantId are not provided, they will be read from the environment variables MWS_ACESS_KEY, MWS_SECRET_ACCESS_KEY, and MWS_MERCHANT_ID respectively

public

async listFinancialEvents(options: object): object

public

async listInventorySupply(options: object): {nextToken: string, supplyList: object[]}

Return information about the availability of a seller's FBA inventory

public

async listOrderItems(AmazonOrderId: string): OrderItemList

Returns order items based on the AmazonOrderId that you specify.

public

async listOrders(options: object): object

Return orders created or updated during a specific time frame see https://docs.developer.amazonservices.com/en_UK/orders-2013-09-01/Orders_ListOrders.html At least ONE of the search options (and maybe more depending on which ones you select) must be specified.

public

async requestAndDownloadReport(ReportType: *, file: *, reportParams: {}): *

TODO: Document requestAndDownloadReport

public

async requestReport(options: object, MarketplaceId: string[]): ReportRequestInfo

Request a report from MWS Many optional parameters may be required by MWS! Read ReportType for specifics!

Static Public

public async callEndpoint(name: string, callOptions: object, opt: object): any source

import {callEndpoint} from 'mws-advanced/lib/callEndpoint.js'

Call a known endpoint at MWS, returning the raw data from the function. Parameters are transformed and validated according to the rules defined in lib/endpoints

Params:

NameTypeAttributeDescription
name string

name of MWS API function to call

callOptions object
  • optional

named hash object of the parameters to pass to the API

opt object
  • optional

options for callEndpoint

opt.noFlatten boolean
  • optional

do not flatten results

opt.returnRaw boolean
  • optional

return only the raw data (may or may not be flattened)

opt.saveRaw string
  • optional

filename to save raw data to (may or may not be flattened)

opt.saveParsed string
  • optional

filename to save final parsed data to (not compatible with returnRaw, since parsing won't happen)

Return:

any

Results of the call to MWS

public async getLowestPricedOffersForASIN(options: object): LowestPricedOffers source

import {getLowestPricedOffersForASIN} from 'mws-advanced/lib/get-lowest-priced-offers.js'

getLowestPricedOffersForASIN

Calls GetLowestPricedOffersForASIN, reformats results, and returns the data

Params:

NameTypeAttributeDescription
options object

see https://docs.developer.amazonservices.com/en_UK/products/Products_GetLowestPricedOffersForASIN.html

options.MarketplaceId string

Marketplace ID to search

options.ASIN string

ASIN to search for

options.ItemCondition string

Listing Condition: New, Used, Collectible, Refurbished, Club

public async getMarketplaces(): MarketDetail source

import {getMarketplaces} from 'mws-advanced/lib/get-marketplaces.js'

Call MWS ListMarketplaceParticipations, return parsed results

Return:

MarketDetail

Example:

const marketplaces = (async () => await mws.getMarketplaces())();
(async function() {
   const result = await mws.getMarketplaces();
   console.log(result);
})();

public async getMatchingProductForId(options: Object): Product[] source

import {getMatchingProductForId} from 'mws-advanced/lib/get-matching-product.js'

Returns a list of products and their attributes, based on a list of ASIN, GCID, SellerSKU, UPC, EAN, ISBN, or JAN values

Params:

NameTypeAttributeDescription
options Object

see https://docs.developer.amazonservices.com/en_UK/products/Products_GetMatchingProductForId.html

options.MarketplaceId string

Identifier for marketplace (see getMarketplaces)

options.IdType string

Type of lookup to perform: ASIN, GCID, SellerSKU, UPC, EAN, ISBN, JAN

options.IdList string[]

List of codes to perform lookup on

Return:

Product[]

public async getReport(options: object): Array | object source

import {getReport} from 'mws-advanced/lib/reports.js'

Returns the contents of a report

Params:

NameTypeAttributeDescription
options object

Options to pass to GetReport

options.ReportId string

Report number from @see GetReportList or GeneratedReportId from @see GetReportRequestListResult

Return:

Array | object

Contents of the report to return (format may vary WIDELY between different reports generated, see ReportType)

public async getReportList(options: {}): * source

import {getReportList} from 'mws-advanced/lib/reports.js'

TODO: write documentation for getReportList

Params:

NameTypeAttributeDescription
options {}
  • optional
  • default: {}

Return:

*

public async getReportListAll(options: {}): * source

import {getReportListAll} from 'mws-advanced/lib/reports.js'

TODO: write documentation for getReportListAll (or see comment on getReportListByNextToken)

Params:

NameTypeAttributeDescription
options {}
  • optional
  • default: {}

Return:

*

public async getReportListByNextToken(options: *): * source

import {getReportListByNextToken} from 'mws-advanced/lib/reports.js'

TODO: write documentation for getReportListByNextToken (or just roll getReportList and getReportListByNextToken into the same wrapper) (that wrapper might be getReportListAll, and just rename it)

Params:

NameTypeAttributeDescription
options *

Return:

*

public async getReportRequestList(options: object, ReportRequestIdList: string[], ReportTypeList: string[], ReportProcessingStatusList: string[], MaxCount: number, RequestedFromDate: Date, RequestedToDate: Date): GetReportRequestListResult[] source

import {getReportRequestList} from 'mws-advanced/lib/reports.js'

Returns a list of report requests that you can use to get the ReportRequestId for a report After calling requestReport, you should call this function occasionally to see if/when the report has been processed.

Params:

NameTypeAttributeDescription
options object
  • optional

Options to pass to GetReportRequestList

ReportRequestIdList string[]
  • optional

List of report request IDs @see requestReport

ReportTypeList string[]
  • optional

List of Report Types @see REQUEST_REPORT_TYPES

ReportProcessingStatusList string[]
  • optional

List of Report Processing Status @see REPORT_PROCESSING_STATUS_TYPES

MaxCount number
  • optional
  • default: 10

Maximum number of report requests to return, max is 100

RequestedFromDate Date
  • optional
  • default: 90-days-past

Oldest date to search for

RequestedToDate Date
  • optional
  • default: Now

Newest date to search for

public init(config: object): mws-simple source

Initialize mws-advanced with your MWS access keys, merchantId, optionally authtoken, host, port If accessKeyId, secretAccessKey, and/or merchantId are not provided, they will be read from the environment variables MWS_ACESS_KEY, MWS_SECRET_ACCESS_KEY, and MWS_MERCHANT_ID respectively

Params:

NameTypeAttributeDescription
config object

Contains your MWS Access Keys/Tokens and options to configure the API

config.accessKeyId string
  • optional
  • default: process.env.MWS_ACCESS_KEY

Your MWS Access Key

config.secretAccessKey string
  • optional
  • default: process.env.MWS_SECRET_ACCESS_KEY

Your MWS Secret Access Key

config.merchantId string
  • optional
  • default: process.env.MWS_MERCHANT_ID

Your MWS Merchant ID

config.authToken string
  • optional

If making a call for a third party account, the Auth Token provided for the third party account

config.region string
  • optional
  • default: 'NA'

One of the Amazon regions as specified in https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html

config.host string
  • optional
  • default: 'mws.amazonservices.com'

Set MWS host server name, see https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html

config.port number
  • optional
  • default: 443

Set MWS host port

Return:

mws-simple

The mws-simple instance used to communicate with the API

Example:

const mws = MWS.init({ region: 'NA', accessKeyId: '1234', secretAccessKey: '2345', merchantId: '1234567890' });
const mws = MWS.init({ region: 'EU', accessKeyId, ... });
const mws = MWS.init({ authToken: 'qwerty', accessKeyId, ...});
const mws = MWS.init({ host: 'alternate-mws-server.com', accessKeyId, ... });

public async listFinancialEvents(options: object): object source

import {listFinancialEvents} from 'mws-advanced/lib/list-financial-events.js'

https://docs.developer.amazonservices.com/en_UK/finances/Finances_ListFinancialEvents.html

Params:

NameTypeAttributeDescription
options object
options.MaxResultsPerPage number

Maximum number of results to return (1 <=> 100)

options.AmazonOrderId string

An order number to search for

options.FinancialEventGroupId string

Type of Financial Event to search for

options.PostedAfter Date

When to search for events after

options.PostedBefore Date

When to search for events prior to

Return:

object

public async listInventorySupply(options: object): {nextToken: string, supplyList: object[]} source

import {listInventorySupply} from 'mws-advanced/lib/list-inventory-supply.js'

Return information about the availability of a seller's FBA inventory

Params:

NameTypeAttributeDescription
options object
options.SellerSkus String[]

A list of SKUs for items to get inventory info for

options.QueryStartDateTime Date

Date to begin searching at

options.ResponseGroup string

'Basic' = Do not include SupplyDetail, 'Detailed' = Do

options.MarketplaceId string

Marketplace ID to search

Return:

{nextToken: string, supplyList: object[]}

public async listOrderItems(AmazonOrderId: string): OrderItemList source

import {listOrderItems} from 'mws-advanced/lib/list-order-items.js'

Returns order items based on the AmazonOrderId that you specify.

If you've pulled a list of orders using @see ListOrders, or have order identifiers stored in some other fashion, then to find out what items are actually on the orders, you will need to call ListOrderItems to obtain details about the items that were ordered. The ListOrders call does not give you any information about the items, except how many of them have shipped or not shipped.

If an Order is in the Pending state, ListOrderItems will not return any pricing or promotion information. Once an order has left the Pending state, the following items will be returned:

ItemTax, GiftWrapPrice, ItemPrice, PromotionDiscount, GiftWrapTax, ShippingTax, ShippingPrice, ShippingDiscount

Params:

NameTypeAttributeDescription
AmazonOrderId string

3-7-7 Amazon Order ID formatted string

Return:

OrderItemList

public async listOrders(options: object): object source

import {listOrders} from 'mws-advanced/lib/list-orders.js'

Return orders created or updated during a specific time frame see https://docs.developer.amazonservices.com/en_UK/orders-2013-09-01/Orders_ListOrders.html At least ONE of the search options (and maybe more depending on which ones you select) must be specified. Error messages may or may not return information on what parameters you are missing. If you are having trouble, see the official parameter documentation above.

Params:

NameTypeAttributeDescription
options object
options.MarketplaceId string[]

Array of Marketplace IDs to search @see MWS_MARKETPLACES

options.CreatedAfter Date
  • optional

Select orders created at or after the given Date

options.CreatedBefore Date
  • optional

Select orders created at or before the given Date

options.LastUpdatedAfter Date
  • optional

Select orders updated at or after the given Date

options.LastUpdatedBefore Date
  • optional

Select orders updated at or before the given Date

options.OrderStatus string
  • optional

OrderStatus, see MWS doc page

options.FulfillmentChannel string
  • optional

AFN for Amazon fulfillment, MFN for merchant

options.PaymentMethod string
  • optional

All, COD, CVS, Other

options.BuyerEmail string
  • optional

Search for orders with given Email address

options.SellerOrderId string
  • optional

Specified seller order ID

options.MaxResultsPerPage string
  • optional
  • default: 100

Max number of results to return, 1 <=> 100

options.TFMShipmentStatus string
  • optional

See MWS doc page

Return:

object

public async requestAndDownloadReport(ReportType: *, file: *, reportParams: {}): * source

import {requestAndDownloadReport} from 'mws-advanced/lib/reports.js'

TODO: Document requestAndDownloadReport

Params:

NameTypeAttributeDescription
ReportType *
file *
reportParams {}
  • optional
  • default: {}

Return:

*

public async requestReport(options: object, MarketplaceId: string[]): ReportRequestInfo source

import {requestReport} from 'mws-advanced/lib/reports.js'

Request a report from MWS Many optional parameters may be required by MWS! Read ReportType for specifics!

Params:

NameTypeAttributeDescription
options object
options.ReportType string

Type of Report to Request @see REQUEST_REPORT_TYPES

options.StartDate Date
  • optional

Date to start report

options.EndDate Date
  • optional

Date to end report at

options.ReportOptions object
  • optional

Reports may have additional options available. Please see the ReportType official docs

MarketplaceId string[]
  • optional

Array of marketplace IDs to generate reports covering