Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bizon/mws-sdk

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bizon/mws-sdk

SDK for Amazon Marketplace Web Services

  • 3.9.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-53.33%
Maintainers
1
Weekly downloads
 
Created
Source

mws-sdk CircleCI

SDK for Amazon Marketplace Web Services

npm version codecov dependencies Status XO code style

Getting started

npm install --save @bizon/mws-sdk

Usage

const MWSClient = require('@bizon/mws-sdk')

const client = new MWSClient({
  accessKeyId: '', // defaults to process.env.MWS_ACCESS_KEY_ID
  secretAccessKey: '', // defaults to process.env.MWS_SECRET_ACCESS_KEY
  sellerId: '',
  mwsToken: '',
  mwsRegion: ''
})

Region and Marketplaces

The MWS documentation defines a list of regions and marketplaces available in each region.

The marketplaces in a region do not all share a common API endpoint, so this library defines a new concept of MWS region, based on the API endpoint. Here’s the list of the available MWS regions:

Generic MWS regions:

RegionAPI EndpointName
namws.amazonservices.comNorth America
eumws-eu.amazonservices.comEurope
femws-fe.amazonservices.comFar East

Country specific MWS regions:

RegionAPI EndpointName
camws.amazonservices.caCanada
mxmws.amazonservices.com.mxMexico
aemws.amazonservices.aeUnited Arab Emirates
inmws.amazonservices.inIndia
jpmws.amazonservices.jpJapan
aumws.amazonservices.com.auAustralia

This library also allows to specify a list of marketplaces (either 2 letter country codes or Marketplaces IDs) so you can restrict API calls to your marketplace participations:

const client = new MWSClient({
  accessKeyId: '',
  secretAccessKey: '',
  sellerId: '',
  mwsToken: '',
  marketplaces: [
    'A1F83G8C2ARO7P', // UK
    'fr'
  ]
})

Keep in mind that the specified marketplaces will have to be in the same MWS region, otherwise an error will be thrown.

Error handling

Whenever the MWS API returns a non 200 HTTP status, a MWSError will be thrown. Use error.body to inspect the contents of the error, and error.response to access the raw HTTP response.

const {MWSError} = '@bizon/mws-sdk'

try {
  const result = await client.products.getLowestPricedOffersForSku({
    marketplaceId: 'A1F83G8C2ARO7P',
    sellerSku: 'some-sku',
    itemCondition: 'new'
  })
} catch (error) {
  if (error instanceof MWSError) {
    console.log(error.body) // This will contain the parsed XML body
    console.log(error.response.statusCode)
  }
}

API

Finances

listFinancialEvents
const result = await client.finances.listFinancialEvents({
  // Options
})

Options:

NameTypeDefault
maxResultsPerPageNumber100
amazonOrderIdString
financialEventGroupIdString
postedAfterDate
postedBeforeDate
nextTokenString
listFinancialEventGroups
const result = await client.finances.listFinancialEventGroups({
  // Options
})

Options:

NameTypeDefault
maxResultsPerPageNumber100
financialEventGroupStartedAfterDate
financialEventGroupStartedBeforeDate
nextTokenString

FulfillmentInboundShipment

getBillOfLading
const result = await client.fulfillmentInboundShipment.getBillOfLading({
  // Options
})

Options:

NameTypeDefault
shipmentIdString
listInboundShipments
const result = await client.fulfillmentInboundShipment.listInboundShipments({
  // Options
})

Options:

NameTypeDefault
shipmentStatusListArray<String>
shipmentIdListArray<String>
lastUpdatedAfterDate
lastUpdatedBeforeDate
nextTokenString
listInboundShipmentItems
const result = await client.fulfillmentInboundShipment.listInboundShipmentItems({
  // Options
})

Options:

NameTypeDefault
shipmentIdArray<String>
lastUpdatedAfterDate
lastUpdatedBeforeDate
nextTokenString

FulfillmentInventory

listInventorySupply
const result = await client.fulfillmentInventory.listInventorySupply({
  // Options
})

Options:

NameTypeDefault
sellerSkusArray<String>
queryStartDateTimeDate
responseGroupString
marketplaceIdString
nextTokenString

Orders

getOrders
const result = await client.orders.getOrders({
  // Options
})

Options:

NameTypeDefault
amazonOrderIdsArray<String>
listOrders
const result = await client.orders.listOrders({
  // Options
})

Options:

NameTypeDefault
createdAfterDate
createdBeforeDate
lastUpdatedAfterDate
lastUpdatedBeforeDate
orderStatusString
marketplaceIdArray<String>Selected region’s marketplaces
fulfillmentChannelString
paymentMethodString
buyerEmailString
sellerOrderIdString
maxResultsPerPageNumber100
tfmShipmentStatusString
nextTokenString
listOrderItems
const result = await client.orders.listOrderItems({
  // Options
})

Options:

NameTypeDefault
amazonOrderIdString
nextTokenString

Products

listMatchingProducts
const result = await client.products.listMatchingProducts({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
queryString
queryContextIdString
getMatchingProduct
const result = await client.products.getMatchingProduct({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
asinListArray<String>
getMatchingProductForId
const result = await client.products.getMatchingProductForId({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
idTypeString
idListArray<String>
getMyPriceForAsin
const result = await client.products.getMyPriceForAsin({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
asinListArray<String>
itemConditionString
getMyPriceForSku
const result = await client.products.getMyPriceForSku({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
sellerSkuListArray<String>
itemConditionString
getLowestPricedOffersForAsin
const result = await client.products.getLowestPricedOffersForAsin({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
asinString
itemConditionString
getLowestPricedOffersForSku
const result = await client.products.getLowestPricedOffersForSku({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
sellerSkuString
itemConditionString

Reports

requestReport
const result = await client.reports.requestReport({
  // Options
})

Options:

NameTypeDefault
reportTypeString
startDateDate
endDateDate
marketplacesArray<String>
reportOptionsString
getReportRequestList
const result = await client.reports.getReportRequestList({
  // Options
})

Options:

NameTypeDefault
reportRequestIdListArray<String>
reportTypeListArray<String>
reportProcessingStatusListArray<String>
maxCountNumber100
requestedFromDateDate
requestedToDateDate
nextTokenString
getReportList
const result = await client.reports.getReportList({
  // Options
})

Options:

NameTypeDefault
maxCountNumber100
reportTypeListArray<String>
acknowledgedBoolean
reportRequestIdListArray<String>
availableFromDateDate
availableToDateDate
nextTokenString
getReport
const result = await client.reports.getReport({
  // Options
})

Options:

NameTypeDefault
reportIdString
formatEnum[raw, base64]

Sellers

listMarketplaceParticipations
const result = await client.sellers.listMarketplaceParticipations({
  // Options
})

Options:

NameTypeDefault
nextTokenString

Subscriptions

registerDestination
const result = await client.subscriptions.registerDestination({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
sqsQueueUrlString
deregisterDestination
const result = await client.subscriptions.deregisterDestination({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
sqsQueueUrlString
sendTestNotificationToDestination
const result = await client.subscriptions.sendTestNotificationToDestination({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
sqsQueueUrlString
createSubscription
const result = await client.subscriptions.createSubscription({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
sqsQueueUrlString
isEnabledBooleantrue
notificationTypeString
deleteSubscription
const result = await client.subscriptions.deleteSubscription({
  // Options
})

Options:

NameTypeDefault
marketplaceIdString
sqsQueueUrlString
notificationTypeString
parseNotification
const result = await client.subscriptions.parseNotification('<any-xml />')

Options: Takes an XML string. The following notifications are supported:

  • Test
  • AnyOfferChanged
  • FeedProcessingFinished
  • ReportProcessingFinished

Common

All entities except reports support a getServiceStatus method to retrieve the API status.

License

MIT

Miscellaneous

    ╚⊙ ⊙╝
  ╚═(███)═╝
 ╚═(███)═╝
╚═(███)═╝
 ╚═(███)═╝
  ╚═(███)═╝
   ╚═(███)═╝

Keywords

FAQs

Package last updated on 29 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc