UNPKG

mws-zodane-advanced

Version:

fixed throtal resend

106 lines (95 loc) 7.99 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <base data-ice="baseUrl" href="../"> <title data-ice="title">Manual | mws-advanced</title> <link type="text/css" rel="stylesheet" href="css/style.css"> <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css"> <script src="script/prettify/prettify.js"></script> <script src="script/manual.js"></script> </head> <body class="layout-container manual-root" data-ice="rootContainer"> <header> <a href="./">Home</a> <a href="identifiers.html">Reference</a> <a href="source.html">Source</a> <div class="search-box"> <span> <img src="./image/search.png"> <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span> </span> <ul class="search-result"></ul> </div> </header> <nav class="navigation" data-ice="nav"><div class="manual-toc-root"> <div data-ice="manual"> <ul class="manual-toc"> <li data-ice="manualNav" class="indent-h1" data-link="manual/getting-started.html"><a href="manual/getting-started.html" data-ice="link">Getting Started</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/getting-started.html"><a href="manual/getting-started.html#prerequisites" data-ice="link">Prerequisites</a></li> <li data-ice="manualNav" class="indent-h3" data-link="manual/getting-started.html"><a href="manual/getting-started.html#getting-your-mws-credentials" data-ice="link">Getting your MWS credentials</a></li> <li data-ice="manualNav" class="indent-h3" data-link="manual/getting-started.html"><a href="manual/getting-started.html#official-mws-api-documentation" data-ice="link">Official MWS API documentation</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/getting-started.html"><a href="manual/getting-started.html#installation" data-ice="link">Installation</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/getting-started.html"><a href="manual/getting-started.html#creating-the-connection-to-mws" data-ice="link">Creating the connection to MWS</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/getting-started.html"><a href="manual/getting-started.html#calling-mws-advanced-apis" data-ice="link">Calling mws-advanced APIs</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/getting-started.html"><a href="manual/getting-started.html#calling-mws-apis-directly" data-ice="link">Calling MWS APIs directly</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/getting-started.html"><a href="manual/getting-started.html#using-your-api-access-for-a-different-amazon-seller--authtoken-" data-ice="link">Using your API access for a different Amazon Seller (authToken)</a></li> </ul> </div> <div data-ice="manual"> <ul class="manual-toc"> <li data-ice="manualNav" class="indent-h1" data-link="manual/usage.html"><a href="manual/usage.html" data-ice="link">Usage</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/usage.html"><a href="manual/usage.html#basic-usage" data-ice="link">Basic Usage</a></li> <li data-ice="manualNav" class="indent-h3" data-link="manual/usage.html"><a href="manual/usage.html#async-await-example" data-ice="link">async/await Example</a></li> <li data-ice="manualNav" class="indent-h3" data-link="manual/usage.html"><a href="manual/usage.html#promises-example" data-ice="link">Promises Example</a></li> <li data-ice="manualNav" class="indent-h3" data-link="manual/usage.html"><a href="manual/usage.html#example-of-passing-parameters-in-as-an-object" data-ice="link">Example of passing parameters in as an object</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/usage.html"><a href="manual/usage.html#obtaining-marketplace-values" data-ice="link">Obtaining Marketplace Values</a></li> <li data-ice="manualNav" class="indent-h2" data-link="manual/usage.html"><a href="manual/usage.html#advanced-usage" data-ice="link">Advanced Usage</a></li> <li data-ice="manualNav" class="indent-h3" data-link="manual/usage.html"><a href="manual/usage.html#using-an-authtoken-to-operate-on-someone-else--39-s-mws-account" data-ice="link">Using an authToken to operate on someone else&apos;s MWS account</a></li> <li data-ice="manualNav" class="indent-h3" data-link="manual/usage.html"><a href="manual/usage.html#report-processing" data-ice="link">Report Processing</a></li> </ul> </div> </div> </nav> <div class="content" data-ice="content"><div class="github-markdown" data-ice="content"><h1 id="usage">Usage</h1><h2 id="basic-usage">Basic Usage</h2><p>It is expected that you will use either async/await or Promise syntax to operate the mws-advanced API.</p> <h3 id="async-await-example">async/await Example</h3><pre><code><code class="source-code prettyprint">const marketplaces = (async () =&gt; await mws.getMarketplaces())(); console.log(marketplaces);</code> </code></pre><h3 id="promises-example">Promises Example</h3><pre><code><code class="source-code prettyprint">mws.getMarketplaces().then(marketplaces =&gt; { console.log(marketplaces); });</code> </code></pre><p>Most mws-advanced functions will require at least one, if not several, parameters to function correctly. Most, if not all, parameters will be passed in as an object:</p> <h3 id="example-of-passing-parameters-in-as-an-object">Example of passing parameters in as an object</h3><pre><code><code class="source-code prettyprint">const getLastSevenDaysOrders = async () =&gt; { const startDate = new Date(); startDate.setDate(startDate.getDate() - 7); return await mws.listOrders({ CreatedAfter: startDate, MarketplaceId: [ &apos;A2ZV50J4W1RKNI&apos; ], }); };</code> </code></pre><h2 id="obtaining-marketplace-values">Obtaining Marketplace Values</h2><p>One of the first things you should probably do after calling init, is figure out what marketplace(s) you want your calls to operate on. Many of the MWS calls accept either a &quot;MarketplaceId&quot; string parameter to operate on a single marketplace, or a &quot;MarketplaceIdList&quot; Array parameter to provide operation across multiple marketplaces simultaneously.</p> <p>You can do this by calling <a href="./manual/./function/index.html#static-function-getMarketplaces/">getMarketplaces</a>. You probably want to store the values returned by this call somewhere for future use.</p> <p>See also <a href="https://docs.developer.amazonservices.com/en_US/reports/Reports_UsingMultipleMarketplaces.html">Using multiple marketplaces</a> in the Amazon MWS documentation.</p> <h2 id="advanced-usage">Advanced Usage</h2><h3 id="using-an-authtoken-to-operate-on-someone-else--39-s-mws-account">Using an authToken to operate on someone else&apos;s MWS account</h3><p>See <a href="./manual/./manual/getting-started.html#using-your-api-access-for-a-different-amazon-seller--authtoken-">Using your API access for a different Amazon Seller</a></p> <h3 id="report-processing">Report Processing</h3><p>A large document can be written on Report Processing, and probably will in the future. For right now, please see the official MWS documentation: <a href="http://docs.developer.amazonservices.com/en_UK/reports/Reports_Overview.html">Reports Overview</a></p> <p>Also, please note that the reporting functions are currently mostly just stubs, and will likely undergo significant changes, as we use them, and discover where they are lacking.</p> </div> </div> <footer class="footer"> Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.0.4)</span><img src="./image/esdoc-logo-mini-black.png"></a> </footer> <script src="script/search_index.js"></script> <script src="script/search.js"></script> <script src="script/pretty-print.js"></script> <script src="script/inherited-summary.js"></script> <script src="script/test-summary.js"></script> <script src="script/inner-link.js"></script> <script src="script/patch-for-local.js"></script> </body> </html>