{"id":4825,"date":"2018-09-14T15:24:15","date_gmt":"2018-09-14T15:24:15","guid":{"rendered":"https:\/\/zappysys.com\/blog\/?p=4825"},"modified":"2026-03-11T07:08:28","modified_gmt":"2026-03-11T07:08:28","slug":"import-amazon-mws-data-power-bi","status":"publish","type":"post","link":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/","title":{"rendered":"How to Import Amazon MWS data in Power BI"},"content":{"rendered":"<h2>Introduction<\/h2>\n<div class=\"su-note\"  style=\"border-color:#e2dec9;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#fcf8e3;border-color:#ffffff;color:#8a6d3b;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<strong><span style=\"vertical-align: text-bottom;font-size: 0.86em;\">\u26a0\ufe0f<\/span> Deprecation Notice: MWS API is deprecated<\/strong><br \/>\nAmazon&#8217;s MWS (Marketplace Web Service) is being deprecated and <strong>replaced by the newer AWS Selling Partner API (SP-API).<\/strong> For a more robust and secure integration, we <strong>recommend<\/strong> using our <strong><a href=\"\/api\/integration-hub\/amazon-selling-partner-connector\/\">AWS Selling Partner (SP-API) Connector<\/a>.<\/strong> As Amazon is phasing out MWS functionality and eventually plans to fully deprecate it.<br \/>\n<\/div><\/div>\n<p><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1632 alignleft\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png\" alt=\"\" width=\"97\" height=\"97\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png 505w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration-150x150.png 150w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration-300x300.png 300w\" sizes=\"(max-width: 97px) 100vw, 97px\" \/><\/a>In our previous blog we saw how to <a href=\"https:\/\/zappysys.com\/blog\/howto-import-json-rest-api-power-bi\/\">call REST API in Power BI<\/a> to import data from JSON based REST API services. Now let&#8217;s continue on that and learn how to import Amazon MWS data in Power BI <strong>using XML driver<\/strong>. To learn more about how to consume <strong>Amazon MWS data<\/strong> in ETL using SSIS <a href=\"https:\/\/zappysys.com\/blog\/call-amazon-mws-api-using-ssis-marketplace-web-service\/\" target=\"_blank\" rel=\"noopener\">check this article<\/a>.<\/p>\n<p>We will read data from Amazon MWS API using ZappySys XML Driver which is part of <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/\" target=\"_blank\" rel=\"noopener\">ODBC PowerPack<\/a>.<\/p>\n<h2><\/h2>\n<h2>Requirements<\/h2>\n<ol>\n<li>Active Amazon Seller Account needed (Make sure you have <strong>Professional Plan or higher<\/strong> (around $39\/month) to call Amazon MWS API)<\/li>\n<li>You are already <a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/dev_guide\/DG_Registering.html#DG_Registering__RegisteringAsADeveloper\" target=\"_blank\" rel=\"noopener\">registered as a Developer<\/a> and you obtained AWS Access Key \/ Secret Key and Seller ID (i.e. Merchant ID) (see next section)<\/li>\n<li>Download and <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/download\/\" target=\"_blank\" rel=\"noopener\">Install ODBC PowerPack<\/a><\/li>\n<li>You will also need <a href=\"https:\/\/powerbi.microsoft.com\/en-us\/desktop\/\" target=\"_blank\" rel=\"noopener\">Power BI Desktop (FREE)<\/a> installed<\/li>\n<\/ol>\n<h2>About Amazon MWS \/ API<\/h2>\n<p>If you want to sell something on Amazon you can use their e-commerce platform with some monthly fee. You can setup your entire online store \/ inventory using admin interface.<\/p>\n<p>Amazon Marketplace Web Service (Amazon MWS) is an integrated web service API that helps Amazon sellers to programmatically exchange data on listings, orders, payments, reports, and more. Using these API you can read or write data from your Seller account and integrate it inside your own Systems (e.g. Reporting \/ ETL \/ BI tools).<\/p>\n<div class=\"su-note\"  style=\"border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#fff8b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">NOTE: Amazon MWS may allow only certain number of requests per minute depending which API you calling so you might want to use each call wisely. We will suggest you various techniques throughout this article so you can avoid errors so read each section carefully. You can find Throttling information on API help page itself (<a href=\"https:\/\/docs.developer.amazonservices.com\/en_IT\/orders-2013-09-01\/Orders_ListOrders.html\" target=\"_blank\" rel=\"noopener\">like this one<\/a>\u00a0see throttling section. Also <a href=\"https:\/\/docs.developer.amazonservices.com\/en_IT\/dev_guide\/DG_Throttling.html\">this one<\/a>).<\/div><\/div>\n<h2>Obtain MWS API Access Key \/ Secret and Seller ID<\/h2>\n<p>Very first thing to call any MWS API is to obtain Access Key, Secret Key and Seller ID (i.e. Merchant ID). To obtain this you first have to <a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/dev_guide\/DG_Registering.html\" target=\"_blank\" rel=\"noopener\">register a developer<\/a>.<\/p>\n<p>Here is where to look for your Merchant ID and Key \/ Secret.\u00a0 Here is direct link to <a href=\"https:\/\/sellercentral.amazon.com\/gp\/account-manager\/home.html\/ref=xx_userperms_dnav_userperms\" target=\"_blank\" rel=\"noopener\">User Permissions<\/a> page.<\/p>\n<div id=\"attachment_4843\" style=\"width: 997px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/obtain-amazon-mws-developer-aws-access-key-secret-key-sellerid.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4843\" class=\"size-full wp-image-4843\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/obtain-amazon-mws-developer-aws-access-key-secret-key-sellerid.png\" alt=\"How to get Amazon MWS developer keys and know your Merchant ID (i.e. Seller ID)\" width=\"987\" height=\"422\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/obtain-amazon-mws-developer-aws-access-key-secret-key-sellerid.png 987w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/obtain-amazon-mws-developer-aws-access-key-secret-key-sellerid-300x128.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/obtain-amazon-mws-developer-aws-access-key-secret-key-sellerid-768x328.png 768w\" sizes=\"(max-width: 987px) 100vw, 987px\" \/><\/a><p id=\"caption-attachment-4843\" class=\"wp-caption-text\">How to get Amazon MWS developer keys and know your Merchant ID (i.e. Seller ID)<\/p><\/div>\n<h2>Getting Started<\/h2>\n<p>Now let&#8217;s look at step by step instructions on how to call Amazon MWS API and then import into Power BI. In below steps we will use\u00a0\u00a0<a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys ODBC PowerPack<\/a>\u00a0so make sure it&#8217;s installed first.<\/p>\n<h3>Using ScratchPad to Test\u00a0Amazon MWS API<\/h3>\n<p>Each MWS API has set of required and optional parameters. You can refer each API page for details. For example\u00a0<a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/products\/Products_ListMatchingProducts.html\" target=\"_blank\" rel=\"noopener\">ListMatchingProducts<\/a> API which we will use as an example. To make MWS API testing \/ learning easy, Amazon provides\u00a0online testing tool called <a href=\"https:\/\/mws.amazonservices.com\/scratchpad\/index.html\" target=\"_blank\" rel=\"noopener\">MWS ScratchPad<\/a>. We will use this tool to craft API requests and use that information in ODBC driver SQL queries and later import data in Power BI.<\/p>\n<ol>\n<li>Open\u00a0<a href=\"https:\/\/mws.amazonservices.com\/scratchpad\/index.html\" target=\"_blank\" rel=\"noopener\">MWS ScratchPad<\/a>\u00a0 by vising <strong>https:\/\/mws.amazonservices.com\/scratchpad\/index.html<\/strong><\/li>\n<li>Select <strong>Products<\/strong>\u00a0API category and pick\u00a0<strong>ListMatchingProducts<\/strong> API<\/li>\n<li>Enter your <strong>SellerID<\/strong> (i.e. Merchant ID), Developer AccessKey (i.e. <strong>AWSAccessKeyId<\/strong>) and <strong>Secret Key<\/strong> we obtained in the previous section. Enter MarketId (e.g. <strong>ATVPDKIKX0DER<\/strong> for USA Market) and other parameters as below and Click Submit to see response.\n<div id=\"attachment_4844\" style=\"width: 800px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-scratchpad-online-testing-tool.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4844\" class=\"size-full wp-image-4844\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-scratchpad-online-testing-tool.png\" alt=\"Using Amazon MWS ScratchPad (API Testing Tool - Created by Amazon)\" width=\"790\" height=\"500\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-scratchpad-online-testing-tool.png 790w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-scratchpad-online-testing-tool-300x190.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-scratchpad-online-testing-tool-768x486.png 768w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><\/a><p id=\"caption-attachment-4844\" class=\"wp-caption-text\">Using Amazon MWS ScratchPad (API Testing Tool &#8211; Created by Amazon)<\/p><\/div><\/li>\n<li>Click on the <strong>Response Details<\/strong> Tab to extract some important information we will use for ODBC configuration. Notice attributes in red rectangles. They are the ones which we will need in the POST request Body. ZappySys Drivers supply many common parameters automatically but any API endpoint specific parameter must be supplied in the Request Body. For example you dont have to supply <b>SignatureVersion, Timestamp, Signature or SignatureMethod<\/b>\n<div id=\"attachment_4847\" style=\"width: 933px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-response-scratchpad-listmatchingproducts-example.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4847\" class=\"size-full wp-image-4847\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-response-scratchpad-listmatchingproducts-example.png\" alt=\"Calling Amazon MWS API in Scratchpad Testing Tool (Response Details Tab) - ListMatchingProducts Example\" width=\"923\" height=\"527\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-response-scratchpad-listmatchingproducts-example.png 923w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-response-scratchpad-listmatchingproducts-example-300x171.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-response-scratchpad-listmatchingproducts-example-768x439.png 768w\" sizes=\"(max-width: 923px) 100vw, 923px\" \/><\/a><p id=\"caption-attachment-4847\" class=\"wp-caption-text\">Calling Amazon MWS API in Scratchpad Testing Tool (Response Details Tab) &#8211; ListMatchingProducts Example<\/p><\/div><\/li>\n<\/ol>\n<p>This API requires Market ID parameter so enter it as per your Market where you selling. For example USA marketplaceid =\u00a0ATVPDKIKX0DER. You can lookup correct MarketplaceId by <a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/dev_guide\/DG_Endpoints.html\" target=\"_blank\" rel=\"noopener\">checking this help (endpoints \/ marketplaces)<\/a>.<\/p>\n<h3>Create ODBC DSN Connection for MWS API \/ Test Query<\/h3>\n<p>Once you have necessary details to call your Amazon MWS API, we can create ODBC DSN which will be used as a reusable connection for MWS API data access in apps like Power BI.<\/p>\n<p>So let&#8217;s get started.<\/p>\n<ol>\n<li>In your start menu search for <strong>ODBC<\/strong>\u00a0and select <strong>Data Source (64 bit)<\/strong>:\u00a0 If you need to access DSN by Service or scheduled Job then make sure you choose 64-bit DSN if caller App is 64 bit App.\n<div id=\"attachment_2827\" style=\"width: 403px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/open-ODBC-Data-souce-administrator.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2827\" class=\"wp-image-2827 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/open-ODBC-Data-souce-administrator.png\" alt=\"Open odbc\" width=\"393\" height=\"531\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/open-ODBC-Data-souce-administrator.png 393w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/open-ODBC-Data-souce-administrator-222x300.png 222w\" sizes=\"(max-width: 393px) 100vw, 393px\" \/><\/a><p id=\"caption-attachment-2827\" class=\"wp-caption-text\">Open odbc data source<\/p><\/div><\/li>\n<li>Use the User DSN page and press<strong> Add.\u00a0<\/strong>For DSN access by Service account or automated jobs which runs under different user, choose System DSN Tab, Make sure You create DSN for correct Bitness (i.e. for 64bit Apps create 64 Bit DSN)\n<div id=\"attachment_2765\" style=\"width: 600px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/add-new-data-source-odbc-administrator.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2765\" class=\"wp-image-2765 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/add-new-data-source-odbc-administrator.png\" alt=\"New Data source\" width=\"590\" height=\"423\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/add-new-data-source-odbc-administrator.png 590w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/add-new-data-source-odbc-administrator-300x215.png 300w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/a><p id=\"caption-attachment-2765\" class=\"wp-caption-text\">Add new data source<\/p><\/div><\/li>\n<li>Select <strong>ZappySys XML Driver<\/strong>\u00a0and click Finish. Amazon MWS API is XML format so we selected XML driver however you can choose JSON or CSV Driver instead of XML if you dealing with JSON format.\n<div id=\"attachment_3255\" style=\"width: 470px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/04\/xml-driver-ssrs.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3255\" class=\"size-full wp-image-3255\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/04\/xml-driver-ssrs.png\" alt=\"Add new ZappySys XML Driver (For XML File \/ SOAP API)\" width=\"460\" height=\"349\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/04\/xml-driver-ssrs.png 460w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/04\/xml-driver-ssrs-300x228.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/a><p id=\"caption-attachment-3255\" class=\"wp-caption-text\">Add new ZappySys XML Driver (For XML \/ SOAP API)<\/p><\/div><\/li>\n<li>Once you see Driver Configuration UI window open, enter the following settings<\/li>\n<li>ODBC DSN name (e.g. ZS &#8211; Amazon MWS API Connection)<\/li>\n<li>Enter MWS API Service URL as below. Notice that we added \/Products\/2011-10-01 (This was extracted from previous section). You can check <a href=\"https:\/\/docs.developer.amazonservices.com\/en_ES\/dev_guide\/DG_Endpoints.html\" target=\"_blank\" rel=\"noopener\">full list of Amazon MWS Endpoints here<\/a>. Because we are connecting to USA region we will use below URL.\n<pre class=\"\">https:\/\/mws.amazonservices.com\/Products\/2011-10-01<\/pre>\n<\/li>\n<li>Select <strong>OAuth<\/strong> from the Connection dropdown and Click <strong>Configure Settings<\/strong><\/li>\n<li>On the Connection UI, Select OAuth Provider\u00a0<strong>Amazon Market Web Service (MWS)<\/strong><\/li>\n<li>Enter your API <strong>Access Key<\/strong> and <strong>Secret Key<\/strong> (obtained <a href=\"https:\/\/sellercentral.amazon.com\/gp\/account-manager\/home.html\/ref=xx_userperms_dnav_userperms\" target=\"_blank\" rel=\"noopener\">from here<\/a>)<\/li>\n<li>Your connection will look like below.\n<div id=\"attachment_4850\" style=\"width: 667px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-odbc-driver-connection.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4850\" class=\"size-full wp-image-4850\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-odbc-driver-connection.png\" alt=\"ODBC Connection Credentials for Amazon MWS API (Access Key, Secret Key, URL Endpoint)\" width=\"657\" height=\"570\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-odbc-driver-connection.png 657w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-odbc-driver-connection-300x260.png 300w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><\/a><p id=\"caption-attachment-4850\" class=\"wp-caption-text\">ODBC Connection Credentials for Amazon MWS API (Access Key, Secret Key, URL Endpoint)<\/p><\/div><\/li>\n<li>Also configure Retry options to handle API limit reached error when you call API too often. For Amazon MWS we get Status code 503 when request is throttled so lets narrow down on which error we want to retry.\n<div id=\"attachment_7156\" style=\"width: 599px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/http-retry-settings-oauth-connection.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7156\" class=\"size-full wp-image-7156\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/http-retry-settings-oauth-connection.png\" alt=\"Retry Options\" width=\"589\" height=\"429\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/http-retry-settings-oauth-connection.png 589w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/http-retry-settings-oauth-connection-300x219.png 300w\" sizes=\"(max-width: 589px) 100vw, 589px\" \/><\/a><p id=\"caption-attachment-7156\" class=\"wp-caption-text\">Retry Options<\/p><\/div><\/li>\n<li>Click OK to save OAuth Connection UI to go back to main UI<\/li>\n<li>Now let&#8217;s use some information we gathered from the previous section (Using Scraptchpad Test).<\/li>\n<li>Select <strong>POST<\/strong> for HTTP Request Method<\/li>\n<li>Enter Body as below (<strong>Change last parameter with your own SellerID<\/strong> and if needed change your <a href=\"https:\/\/docs.developer.amazonservices.com\/en_ES\/dev_guide\/DG_Endpoints.html\" target=\"_blank\" rel=\"noopener\">MarketPlaceId<\/a> too if its not USA)\n<pre class=\"lang:default decode:true\">Action=ListMatchingProducts&amp;MarketplaceId=ATVPDKIKX0DER&amp;Query=harry%20potter%20dvd&amp;SellerId=ZZZZZ-YOUR-SELLER-ID-ZZZZZ<\/pre>\n<\/li>\n<li>Click on Select Filter to select correct node (in our case it will be Product node as below.\n<pre class=\"\">$.ListMatchingProductsResponse.ListMatchingProductsResult.Products.Product[*]<\/pre>\n<\/li>\n<li>Now Go to Throttling Tab and enter some delay (e.g. <strong>enter 20000 for 20sec delay after each request<\/strong>). This will slow down API calls so we don&#8217;t face errors about API Limit reached.<\/li>\n<li>You can also consider enabling <strong>Data Caching<\/strong> for MWS API as below to avoid API throttling \/ rate exceeded error.\u00a0Change Cache Mode to <strong>Cache All<\/strong> (Use Cache for Metadata + Data Requests)<br \/>\n<div class=\"su-note\"  style=\"border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#fff8b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">NOTE: MWS may allow only certain number of requests per minute so you might want to use each call wisely. You can find Throttling information on API help page itself (<a href=\"https:\/\/docs.developer.amazonservices.com\/en_IT\/orders-2013-09-01\/Orders_ListOrders.html\" target=\"_blank\" rel=\"noopener\">like this one<\/a>\u00a0see throttling section. Also <a href=\"https:\/\/docs.developer.amazonservices.com\/en_IT\/dev_guide\/DG_Throttling.html\">this one<\/a>).<\/div><\/div>\n<div id=\"attachment_5146\" style=\"width: 414px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/10\/zappysys-odbc-caching-options.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5146\" class=\"size-full wp-image-5146\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/10\/zappysys-odbc-caching-options.png\" alt=\"Enable Caching Options for Metadata \/ Data for ZappySys ODBC Drivers\" width=\"404\" height=\"362\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/10\/zappysys-odbc-caching-options.png 404w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/10\/zappysys-odbc-caching-options-300x269.png 300w\" sizes=\"(max-width: 404px) 100vw, 404px\" \/><\/a><p id=\"caption-attachment-5146\" class=\"wp-caption-text\">Enable Caching Options for Metadata \/ Data for ZappySys ODBC Drivers<\/p><\/div><\/li>\n<li>Now goto Preview Tab and click on Green Play button to test query\n<div id=\"attachment_4854\" style=\"width: 818px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/read-amazon-mws-data-sql-query-preview-zapysys-odbc-xml-api-driver.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4854\" class=\"size-full wp-image-4854\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/read-amazon-mws-data-sql-query-preview-zapysys-odbc-xml-api-driver.png\" alt=\"Query Amazon MWS API using ZappySys XML Driver - Preview UI\" width=\"808\" height=\"770\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/read-amazon-mws-data-sql-query-preview-zapysys-odbc-xml-api-driver.png 808w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/read-amazon-mws-data-sql-query-preview-zapysys-odbc-xml-api-driver-300x286.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/read-amazon-mws-data-sql-query-preview-zapysys-odbc-xml-api-driver-768x732.png 768w\" sizes=\"(max-width: 808px) 100vw, 808px\" \/><\/a><p id=\"caption-attachment-4854\" class=\"wp-caption-text\">Query Amazon MWS API using ZappySys XML Driver &#8211; Preview UI<\/p><\/div><\/li>\n<li>That&#8217;s it. We have successfully tested first query to read data from Amazon MWS API<\/li>\n<\/ol>\n<h3>Caching Metadata and Using in SQL Query<\/h3>\n<p>We talked briefly about Data Caching but still there will be a time you will face such errors. So lets do another safeguard to reduce total API requests for MWS. <a href=\"https:\/\/zappysys.com\/blog\/caching-metadata-odbc-drivers-performance\/\" target=\"_blank\" rel=\"noopener\">Check this article<\/a> to learn about Caching and META Clause in SQL.<\/p>\n<p>Here are high level steps to Use predefined Schema File so Driver doesn&#8217;t call API request to guess metadata.<\/p>\n<ol>\n<li>Go to ODBC Preview window and write desired query you like to use. Click <strong>Preview Button<\/strong> to see sample data<\/li>\n<li>Now click <strong>Save Metadata<\/strong> of query which we can use later. <strong>Save to File<\/strong> in our case (name as <strong>mws-query-meta.txt<\/strong> ).\n<div id=\"attachment_5138\" style=\"width: 553px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/10\/odbc-driver-generate-metadata.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5138\" class=\"size-full wp-image-5138\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/10\/odbc-driver-generate-metadata.png\" alt=\"Create Metadata for ODBC Driver Query - ZappySys API Drivers\" width=\"543\" height=\"526\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/10\/odbc-driver-generate-metadata.png 543w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/10\/odbc-driver-generate-metadata-300x291.png 300w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><\/a><p id=\"caption-attachment-5138\" class=\"wp-caption-text\">Create Metadata for ODBC Driver Query &#8211; ZappySys API Drivers<\/p><\/div><\/li>\n<li>Now change our query as below\n<pre class=\"lang:tsql decode:true\">SELECT \r\n ......\r\n ......\r\nFROM xxxxxxxxx\r\nWITH (META='c:\\somefolder\\mws-query-meta.txt')<\/pre>\n<\/li>\n<li>That&#8217;s it. Use query like above when we import Amazon MWS data in Power BI in the next section.<\/li>\n<\/ol>\n<h3>Import Amazon MWS data in Power BI (List Orders Example)<\/h3>\n<p>Now it&#8217;s time to load our data in Power BI and create reports.<\/p>\n<ol>\n<li>Open Power BI Desktop and select the option <strong>Get data<\/strong>\n<div id=\"attachment_2830\" style=\"width: 802px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/Get-data-Power-bi-desktop.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2830\" class=\"wp-image-2830 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/Get-data-Power-bi-desktop.png\" alt=\"Get data using power bi\" width=\"792\" height=\"335\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/Get-data-Power-bi-desktop.png 792w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/Get-data-Power-bi-desktop-300x127.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/Get-data-Power-bi-desktop-768x325.png 768w\" sizes=\"(max-width: 792px) 100vw, 792px\" \/><\/a><p id=\"caption-attachment-2830\" class=\"wp-caption-text\">Get data in power bi<\/p><\/div><\/li>\n<li>Get Data will allow adding the ZappySys ODBC driver. Go to <strong>Other<\/strong> and select <strong>ODBC.<\/strong>\n<div id=\"attachment_2835\" style=\"width: 617px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/power-bi-odbc-other-data-source.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2835\" class=\"size-full wp-image-2835\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/power-bi-odbc-other-data-source.png\" alt=\"select odbc using power bi\" width=\"607\" height=\"635\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/power-bi-odbc-other-data-source.png 607w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/power-bi-odbc-other-data-source-287x300.png 287w\" sizes=\"(max-width: 607px) 100vw, 607px\" \/><\/a><p id=\"caption-attachment-2835\" class=\"wp-caption-text\">select odbc in power bi<\/p><\/div><\/li>\n<li>Now it&#8217;s time to import data. Basically, there are two modes to import data. <strong>Table Mode<\/strong> and <strong>Query Mode<\/strong>. Query mode is the most common way.\u00a0<strong>Select your DSN<\/strong> and click <strong>Advanced Option<\/strong> to <strong>enter custom SQL<\/strong> Query to Import your MWS API data. You can use ODBC DSN Data sources Preview tool to generate SQL Query. For example you can enter query to import Orders for specified date range. We have added some pagination attributes which we will cover in the next section. Click OK to continue.\n<pre class=\"lang:tsql decode:true\">SELECT * FROM $\r\nWITH(\r\n\t ElementsToTreatAsArray='Order'\r\n\t,Src='https:\/\/mws.amazonservices.com\/Orders\/2013-09-01'\r\n\t,Filter='$.ListOrders[$tag$]Response.ListOrders[$tag$]Result.Orders.Order[*]'\r\n\t,RequestData='Action=ListOrders[$tag$]&amp;SellerId=A1xxxxxxxxxxxxx&amp;CreatedAfter=2018-09-01T04%3A00%3A00Z&amp;MarketplaceId.Id.1=ATVPDKIKX0DER'\r\n\t,RequestMethod='POST'\r\n\t,NextUrlAttributeOrExpr='$.ListOrders[$tag$]Response.ListOrders[$tag$]Result.NextToken'\r\n\t,NextUrlSuffix='&amp;NextToken=&lt;%nextlink_encoded%&gt;'\r\n\t,HasDifferentNextPageInfo='True'\r\n\t,EnablePageTokenForBody='True'\r\n\t,PagePlaceholders='body=|ByNextToken;filter=|ByNextToken'\r\n\t,WaitTimeMs=300 -- API throttling for pagination\r\n\t--Uncomment Caching Line to Speedup API calls and Avoid API Limit. Power BI issues many API calls behind the scene\r\n\t--,CachingMode='All',CacheStorage='File',CacheEntryTtl=120,CacheFileLocation='c:\\temp\\mws-orders.cache'\r\n\t--,DataConnectionType='OAuth'\r\n\t--,ScopeSeparator='{space}'\r\n\t--,ServiceProvider='AmazonMWS'\r\n\t--,ClientId='AKIAIWxxxxxxxxxxxxx' --Skip this to use DSN credentials\r\n\t--,ClientSecret='AKIAIWxxxxxxxxxxxxx' --Skip this to use DSN credentials\r\n\t--,UseCustomApp='True'\t\r\n)\r\n--Uncomment below if you are using Schema file for cached metadata\r\n--WITH (META='c:\\somefolder\\mws-query-meta.txt')<\/pre>\n<div class=\"mceTemp\"><\/div>\n<\/li>\n<li>Use above query for example and paste in Query editor while you Import Amazon MWS data.\n<div id=\"attachment_3946\" style=\"width: 952px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/06\/power-bi-import-soap-api-xml-web-service-advanced-options-sql.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3946\" class=\"size-full wp-image-3946\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/06\/power-bi-import-soap-api-xml-web-service-advanced-options-sql.png\" alt=\"Enter custom SQL to load SOAP Web Service Data in Power BI (ZappySys XML Driver)\" width=\"942\" height=\"713\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/06\/power-bi-import-soap-api-xml-web-service-advanced-options-sql.png 942w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/06\/power-bi-import-soap-api-xml-web-service-advanced-options-sql-300x227.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/06\/power-bi-import-soap-api-xml-web-service-advanced-options-sql-768x581.png 768w\" sizes=\"(max-width: 942px) 100vw, 942px\" \/><\/a><p id=\"caption-attachment-3946\" class=\"wp-caption-text\">Enter custom SQL to load SOAP Web Service Data in Power BI (ZappySys XML Driver)<\/p><\/div><\/li>\n<li>On the next screen select <strong>Windows Authentication<br \/>\n<\/strong><\/p>\n<div id=\"attachment_4860\" style=\"width: 732px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/connect-amazon-mws-data-power-bi-windows-authentication.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4860\" class=\"size-full wp-image-4860\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/connect-amazon-mws-data-power-bi-windows-authentication.png\" alt=\"Select Authentication for Amazon MWS connection in Power BI data load\" width=\"722\" height=\"391\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/connect-amazon-mws-data-power-bi-windows-authentication.png 722w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/connect-amazon-mws-data-power-bi-windows-authentication-300x162.png 300w\" sizes=\"(max-width: 722px) 100vw, 722px\" \/><\/a><p id=\"caption-attachment-4860\" class=\"wp-caption-text\">Select Authentication for Amazon MWS connection in Power BI data load<\/p><\/div><\/li>\n<li>Once data is imported you can use dataset to build your dashboard\n<div id=\"attachment_4859\" style=\"width: 1211px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/load-amazon-mws-data-in-power-bi-dataset-report.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4859\" class=\"size-full wp-image-4859\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/load-amazon-mws-data-in-power-bi-dataset-report.png\" alt=\"Load Amazon MWS data in Power BI - Create Amazon Sales Dashboard\" width=\"1201\" height=\"609\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/load-amazon-mws-data-in-power-bi-dataset-report.png 1201w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/load-amazon-mws-data-in-power-bi-dataset-report-300x152.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/load-amazon-mws-data-in-power-bi-dataset-report-768x389.png 768w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/load-amazon-mws-data-in-power-bi-dataset-report-1024x519.png 1024w\" sizes=\"(max-width: 1201px) 100vw, 1201px\" \/><\/a><p id=\"caption-attachment-4859\" class=\"wp-caption-text\">Load Amazon MWS data in Power BI &#8211; Create Amazon Sales Dashboard<\/p><\/div><\/li>\n<\/ol>\n<h2>Using Pagination in Amazon MWS API calls<\/h2>\n<p>Now let&#8217;s look at how to query certain API which allows paginated response. Pagination is <a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/dev_guide\/DG_NextToken.html\" target=\"_blank\" rel=\"noopener\">fully explained here<\/a>. Certain APIs like ListOrders , ListOrderItems, ListInboundShipments, ListInventorySupply, GetFullfillmentOrder and few more supports Pagination.<\/p>\n<p>When you call Paginated response next request changes Action with <strong>ByNextToken<\/strong> suffix. For example to get orders call <a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/orders-2013-09-01\/Orders_ListOrders.html\" target=\"_blank\" rel=\"noopener\">ListOrders<\/a> and next request will be <a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/orders-2013-09-01\/Orders_ListOrdersByNextToken.html\" target=\"_blank\" rel=\"noopener\">ListOrdersByNextToken<\/a><\/p>\n<p>MWS API has multiple pagination patterns so based on which action you calling you have to use correct SQL parameters.<\/p>\n<div class=\"su-note\"  style=\"border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">Amazon MWS API has strict throttling limits so make sure you call API accordingly. Calling same API too fast may result in throttling error. You can use <strong>WaitTimeMs<\/strong> option to wait after each API call so you do face throttling limit. Refer to MWS API help pages to see exact limit. <\/div><\/div>\n<h3>Using NextToken for Pagination (ListOrders Example)<\/h3>\n<p>Many MWS API returns NextToken attribute in the response which you can pass in the body of next request until no more NextToken found in the response.<\/p>\n<p>Check below example query for\u00a0<a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/orders-2013-09-01\/Orders_ListOrders.html\" target=\"_blank\" rel=\"noopener\">ListOrders<\/a> API. We have enabled pagination by supplying few extra parameters in our original SQL Query.<\/p>\n<pre class=\"lang:tsql decode:true\">SELECT * FROM $\r\nWITH(\r\n\t ElementsToTreatAsArray='Order'\r\n\t,Src='https:\/\/mws.amazonservices.com\/Orders\/2013-09-01'\r\n\t,Filter='$.ListOrders[$tag$]Response.ListOrders[$tag$]Result.Orders.Order[*]'\r\n\t,RequestData='Action=ListOrders[$tag$]&amp;SellerId=A10JBWAX563WMC&amp;CreatedAfter=2018-09-01T04%3A00%3A00Z&amp;MarketplaceId.Id.1=ATVPDKIKX0DER'\r\n\t,RequestMethod='POST'\r\n\t,NextUrlAttributeOrExpr='$.ListOrders[$tag$]Response.ListOrders[$tag$]Result.NextToken'\r\n\t,NextUrlSuffix='&amp;NextToken=&lt;%nextlink_encoded%&gt;'\r\n\t,WaitTimeMs=300 -- slow down to avoid throttling\r\n\t,HasDifferentNextPageInfo='True'\r\n\t,EnablePageTokenForBody='True'\r\n\t,PagePlaceholders='body=|ByNextToken;filter=|ByNextToken'\r\n\t--,DataConnectionType='OAuth'\r\n\t--,ScopeSeparator='{space}'\r\n\t--,ServiceProvider='AmazonMWS'\r\n\t--,ClientId='AKIxxxxxx'\r\n\t--,ClientSecret='AKIxxxxxx'\r\n\t--,UseCustomApp='True'\t\r\n)\r\n--Uncomment below if you are using Schema file for cached metadata \r\n--WITH (META='c:\\somefolder\\mws-query-meta.txt')<\/pre>\n<p>&nbsp;<\/p>\n<h3>Using NextToken with operations that return HasNext \/\u00a0MoreResultsAvailable<\/h3>\n<p>Some API has attribute which tells you to stop pagination (e.g. HasNext). Check below example query for\u00a0<a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/reports\/Reports_GetReportRequestList.html\">GetReportRequestList<\/a>. We have enabled pagination by supplying few extra parameters in SQL Query.<\/p>\n<pre class=\"lang:tsql decode:true\">SELECT * FROM $\r\nWITH(\r\n\t ElementsToTreatAsArray='Product,ReportRequestInfo'\r\n\t,Src='https:\/\/mws.amazonservices.com'\r\n\t--,DataConnectionType='OAuth'\r\n\t--,ScopeSeparator='{space}'\r\n\t--,ServiceProvider='AmazonMWS'\r\n\t--,ClientId='Axxxxxxxxxxxxxx' --This will come from connection if you comment\r\n\t--,ClientSecret='Bxxxxxxxxxxxxxxxxx' --This will come from connection you comment\r\n\t--,UseCustomApp='True'\r\n\t,Filter='$.GetReportRequestList[$tag$]Response.GetReportRequestList[$tag$]Result.ReportRequestInfo[*]'\r\n\t,RequestData='Action=GetReportRequestList[$tag$]&amp;Merchant=A10xxxxxxxxxxxxxxxx'\r\n\t,RequestMethod='POST'\r\n\t,NextUrlAttributeOrExpr='$.GetReportRequestList[$tag$]Response.GetReportRequestList[$tag$]Result.NextToken'\r\n\t,NextUrlEndIndicator='false'\r\n\t,StopIndicatorAttributeOrExpr='$.GetReportRequestList[$tag$]Response.GetReportRequestList[$tag$]Result.HasNext'\r\n\t,NextUrlSuffix='&amp;NextToken=&lt;%nextlink_encoded%&gt;'\r\n\t,HasDifferentNextPageInfo='True'\r\n\t,EnablePageTokenForBody='True'\r\n\t,PagePlaceholders='body=|ByNextToken;filter=|ByNextToken'\r\n)\r\n--Uncomment below if you are using Schema file for cached metadata \r\n--WITH (META='c:\\somefolder\\mws-query-meta.txt')<\/pre>\n<p>Some API calls return slightly different response so rather than HasNext attribute you will see\u00a0MoreResultsAvailable. In that case change\u00a0StopIndicatorAttributeOrExpr property to use\u00a0MoreResultsAvailable property.<\/p>\n<h3>Properties you need to change for pagination<\/h3>\n<p>Now let&#8217;s look at properties which need to be changed to support pagination.<\/p>\n<div class=\"su-table su-table-alternate\">\n<table style=\"border-collapse: collapse;width: 100%;height: 154px\" border=\"1\">\n<tbody>\n<tr style=\"height: 22px\">\n<td style=\"width: 14.5161%;height: 22px\">Property<\/td>\n<td style=\"width: 85.4839%;height: 22px\">Description<\/td>\n<\/tr>\n<tr style=\"height: 66px\">\n<td style=\"width: 14.5161%;height: 66px\">Src<\/td>\n<td style=\"width: 85.4839%;height: 66px\">Change this to correct URL. Look at Scratchpad Response Details Tab and Findout first line after POST and before &#8220;?&#8221; . e.g.\u00a0\/Orders\/2013-09-01\u00a0 this will be used in your URL.<br \/>\n<strong>Example:\u00a0<\/strong><br \/>\nhttps:\/\/mws.amazonservices.com\/Orders\/2013-09-01<\/td>\n<\/tr>\n<tr style=\"height: 22px\">\n<td style=\"width: 14.5161%;height: 22px\">Body (i.e. RequestData)<\/td>\n<td style=\"width: 85.4839%;height: 22px\">Scratchpad shows HTTP POST section. You can copy that and remove\u00a0 System supplied parameters and then arrange all in one line to form your Body for request.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">POST \/Orders\/2013-09-01?AWSAccessKeyId=AKxxxxxxxxxx\r\n  &amp;Action=ListOrders\r\n  &amp;SellerId=A10zzzzzzz\r\n  &amp;SignatureVersion=2\r\n  &amp;Timestamp=2018-09-17T21%3A35%3A57Z\r\n  &amp;Version=2013-09-01\r\n  &amp;Signature=3GigipfRsQgzzzzzzzzzzzzzs%3D\r\n  &amp;SignatureMethod=HmacSHA256<\/pre>\n<p>Above HTTP POST can be used as below for your Body in ZappySys Driver. Rest of the parameters are automatically supplied by system. See special placeholder named [$tag$] this gets replaced at runtime when you set\u00a0<strong>EnablePageTokenForBody=True<\/strong> and <strong>HasDifferentNextPageInfo=True<\/strong><\/p>\n<pre class=\"lang:default decode:true\">Action=ListOrders[$tag$]&amp;SellerId=A10zzzzzzz&amp;CreatedAfter=2018-09-01T04%3A00%3A00Z<\/pre>\n<\/td>\n<\/tr>\n<tr style=\"height: 22px\">\n<td style=\"width: 14.5161%;height: 22px\">Filter<\/td>\n<td style=\"width: 85.4839%;height: 22px\">Change this parameter according to XML structure in the response.<br \/>\nFor example: If you see below response (first xml) in Scratchpad then your Filter will be<br \/>\n<strong>$.ListOrdersResponse.ListOrdersResult.Orders.Order[*]<\/strong><br \/>\nto enable pagination refer to <a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/orders-2013-09-01\/Orders_ListOrdersByNextToken.html\" target=\"_blank\" rel=\"noopener\">Sample listed here<\/a> (click Example response at the bottom of that page). In second response and onwards your Filter should be below (See Bold Part).<br \/>\n$ListOrders<strong>ByNextToken<\/strong>Response.ListOrders<strong>ByNextToken<\/strong>Result.Orders.Order[*]However in Driver we <strong>replace ByNextToken<\/strong> with <strong>[$tag$]<\/strong>. Like below. Using [$tag$] will automatically pick up the correct filter based on page number. You must set HasDifferentNextPageInfo=True to use [$tag$] feature.<strong>$.ListOrders[$tag$]Response.ListOrders[$tag$]Result.Orders.Order[*]<\/strong>Example of <strong>first page response<\/strong><\/p>\n<pre class=\"lang:default decode:true \">&lt;?xml version=\"1.0\"?&gt;\r\n&lt;ListOrdersResponse xmlns=\"https:\/\/mws.amazonservices.com\/\r\n    Orders\/2013-09-01\"&gt;\r\n    &lt;ListOrdersResult&gt;\r\n        &lt;NextToken&gt;2YgYW55IxxxxxxxxxxxxVyZS4=&lt;\/NextToken&gt;\r\n        &lt;LastUpdatedBefore&gt;2017-02-25T18%3A10%3A21.687Z&lt;\/LastUpdatedBefore&gt;\r\n        &lt;Orders&gt;\r\n            &lt;Order&gt; ....... &lt;\/Order&gt;\r\n            &lt;Order&gt; ....... &lt;\/Order&gt;\r\n            &lt;Order&gt; ....... &lt;\/Order&gt;\r\n        &lt;\/Orders&gt;\r\n    &lt;\/ListOrdersResult&gt;\r\n&lt;\/ListOrdersResponse&gt;<\/pre>\n<p>Example of <strong>next page response<\/strong><\/p>\n<pre class=\"lang:default decode:true\">&lt;?xml version=\"1.0\"?&gt;\r\n&lt;ListOrdersByNextTokenResponse xmlns=\"https:\/\/mws.amazonservices.com\/\r\n    Orders\/2013-09-01\"&gt;\r\n    &lt;ListOrdersByNextTokenResult&gt;\r\n        &lt;NextToken&gt;2YgYW55IxxxxxxxxxxxxVyZS4=&lt;\/NextToken&gt;\r\n        &lt;LastUpdatedBefore&gt;2017-02-25T18%3A10%3A21.687Z&lt;\/LastUpdatedBefore&gt;\r\n        &lt;Orders&gt;\r\n            &lt;Order&gt; ....... &lt;\/Order&gt;\r\n            &lt;Order&gt; ....... &lt;\/Order&gt;\r\n            &lt;Order&gt; ....... &lt;\/Order&gt;\r\n        &lt;\/Orders&gt;\r\n    &lt;\/ListOrdersResult&gt;\r\n&lt;\/ListOrdersResponse&gt;<\/pre>\n<\/td>\n<\/tr>\n<tr style=\"height: 22px\">\n<td style=\"width: 14.5161%;height: 22px\">NextUrlAttributeOrExpr<\/td>\n<td style=\"width: 85.4839%;height: 22px\">This property defines which attributes indicate Token for next page. You can use this token in Body of next request (see\u00a0NextUrlSuffix and\u00a0EnablePageTokenForBody). You must set\u00a0EnablePageTokenForBody=true to use Extracted token in Body.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 14.5161%\">StopIndicatorAttributeOrExpr<\/td>\n<td style=\"width: 85.4839%\">Some APIs like\u00a0 <a href=\"https:\/\/docs.developer.amazonservices.com\/en_US\/reports\/Reports_GetReportRequestList.html\">GetReportRequestList<\/a>\u00a0stop pagination based on HasNext attribute value. Use this property to extract HasNext from response by supplying correct Filter expression. You also need to set\u00a0NextUrlEndIndicator property which defines static value which indicates the last page.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 14.5161%\">NextUrlSuffix<\/td>\n<td style=\"width: 85.4839%\">This is used to create a string for NextToken attribute for next page request. If you want to just append extracted token to Body then you dont have to set this but in our case, we have to use &amp;NextToken=EncodedValueOfExtractedToken so we have used\u00a0<strong>&amp;NextToken=&lt;%nextlink_encoded%&gt;<\/strong> expression.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 14.5161%\">PagePlaceholders<\/td>\n<td style=\"width: 85.4839%\">This property contains [$tag$] values for first page and next pages. You can define tags for filter, body or header. Each pair must be pipe delimited. First value or pair is [$tag$]\u00a0 for first request and second value of the pair is [$tag$] for any next request afterwards. Our first request use blank value for [$tag$].<br \/>\nExample:\u00a0\u00a0<strong>PagePlaceholders=&#8217;body=|ByNextToken;filter=|ByNextToken&#8217;<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 14.5161%\">HasDifferentNextPageInfo<\/td>\n<td style=\"width: 85.4839%\">Set to True &#8211; This enables use of [$tag$] inside body, filter, headers to use different values of first request and second onwards requests.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 14.5161%\">EnablePageTokenForBody<\/td>\n<td style=\"width: 85.4839%\">Set to True &#8211; This enables use of [$tag$] inside body to use different RequestBody values of first request and second onwards requests.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Here is the preview of MWS API query output with Pagination Attributes.<\/p>\n<div id=\"attachment_4855\" style=\"width: 818px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-pagination-example.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4855\" class=\"size-full wp-image-4855\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-pagination-example.png\" alt=\"Amazon MWS API Pagination Example - Preview SQL Query Result\" width=\"808\" height=\"660\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-pagination-example.png 808w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-pagination-example-300x245.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/amazon-mws-api-pagination-example-768x627.png 768w\" sizes=\"(max-width: 808px) 100vw, 808px\" \/><\/a><p id=\"caption-attachment-4855\" class=\"wp-caption-text\">Amazon MWS API Pagination Example &#8211; Preview SQL Query Result<\/p><\/div>\n<h2><\/h2>\n<h2>Import data from MWS Custom Reports (Inventory Report Example)<\/h2>\n<p>Now lets look at how to extract data from <a href=\"https:\/\/docs.developer.amazonservices.com\/en_UK\/reports\/Reports_ReportType.html\" target=\"_blank\" rel=\"noopener\">Custom Report API<\/a>\u00a0(You must need ODBC PowerPack <strong>v1.1.1<\/strong> or higher). However reading data from Reports not single step process because report generation is Job style API. Which means you send report request and wait\u00a0 until its done. Once Report ready you have to read in CSV format or XML. Some Reports only available in CSV format.\u00a0<a href=\"https:\/\/docs.developer.amazonservices.com\/en_UK\/reports\/Reports_Overview.html\" target=\"_blank\" rel=\"noopener\">Check this post<\/a> to understand how complex it can be to get data. We will make it simple for you to understand this in 3 steps. Basically calling reports requires minimum 3 API calls (see below)<\/p>\n<ol>\n<li>Create a new report request &#8211; Cal\u00a0<a href=\"https:\/\/docs.developer.amazonservices.com\/en_UK\/reports\/Reports_RequestReport.html\" target=\"_blank\" rel=\"noopener\">RequestReport<\/a>\u00a0API . It returns <strong>ReportRequestId<\/strong> (You can use it in the next step)<\/li>\n<li>Check Report Status see its done &#8211; Call <a href=\"https:\/\/docs.developer.amazonservices.com\/en_UK\/reports\/Reports_GetReportRequestList.html\" target=\"_blank\" rel=\"noopener\">GetReportRequestList<\/a>\u00a0API (Pass <strong>ReportRequestId<\/strong> got in the previous step to get data for only one Report request we care). Keep checking Report Status every few seconds until you get <strong>_DONE_<\/strong> status in response.<\/li>\n<li>Read Report Data &#8211; Call <a href=\"https:\/\/docs.developer.amazonservices.com\/en_UK\/reports\/Reports_GetReport.html\" target=\"_blank\" rel=\"noopener\">GetReport<\/a>. This API call returns CSV or XML data. So use correct Driver for this step. If CSV data is returned then we must use CSV Driver rather than XML Driver.<\/li>\n<\/ol>\n<p>Now lets see how to get this 3 steps done in Power BI. In this example, We will get Inventory by calling\u00a0<strong>_GET_MERCHANT_LISTINGS_DATA_<\/strong> report type.<\/p>\n<ol>\n<li>Create a directory c:\\temp<\/li>\n<li>Create new <strong>ZappySys XML Driver DSN<\/strong>\u00a0(User DSN) using same steps we described before. Lets name this DSN as <strong>ZAPPY-MWS-API-XML<\/strong><\/li>\n<li>Create new <strong>ZappySys CSV Driver DSN<\/strong> \u00a0(User DSN) using same steps we described before (Except the Driver Type should be <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/odbc-csv-rest-api-driver\/\" target=\"_blank\" rel=\"noopener\">ZappySys CSV Driver<\/a>). Lets name this DSN as\u00a0<strong>ZAPPY-MWS-API-CSV<\/strong><\/li>\n<li>Once you done with ODBC DSN Setup open or create new Power BI Project.<\/li>\n<li>Click on Create Source &gt; from Blank Query\n<div id=\"attachment_6955\" style=\"width: 233px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-new-data-source-from-query.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6955\" class=\"size-full wp-image-6955\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-new-data-source-from-query.png\" alt=\"Power BI - Create New Data source from Query (M Script)\" width=\"223\" height=\"487\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-new-data-source-from-query.png 223w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-new-data-source-from-query-137x300.png 137w\" sizes=\"(max-width: 223px) 100vw, 223px\" \/><\/a><p id=\"caption-attachment-6955\" class=\"wp-caption-text\">Power BI &#8211; Create New Data source from Query (M Script)<\/p><\/div><\/li>\n<li>When Query Editor Shows up click on Advanced Editor and paste below code (Its <a href=\"https:\/\/docs.microsoft.com\/en-us\/powerquery-m\/power-query-m-reference\">Power BI M Language<\/a>). If you are unsure how to write Power BI check <a href=\"https:\/\/docs.microsoft.com\/en-us\/powerquery-m\/quick-tour-of-the-power-query-m-formula-language\" target=\"_blank\" rel=\"noopener\">this tutorial<\/a>.<br \/>\nReplace MarketPlaceId and Seller ID in the script (i.e.\u00a0A1xxxxxx and\u00a0A2xxxxxx ). See we are using\u00a0<strong>ReportType=_GET_MERCHANT_LISTINGS_DATA_<\/strong>\u00a0 but you can use any valid report ID <a href=\"https:\/\/docs.developer.amazonservices.com\/en_UK\/reports\/Reports_RequestReport.html\" target=\"_blank\" rel=\"noopener\">from here<\/a>. You can also pass other optional parameter available for each report Type (e.g. StartDate and EndDate)<\/p>\n<div id=\"attachment_6956\" style=\"width: 826px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-query-editor-m-language-expression.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6956\" class=\"size-full wp-image-6956\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-query-editor-m-language-expression.png\" alt=\"Edit Power BI Query Script - Use custom M Language Script to import data from ODBC or other Relational\" width=\"816\" height=\"625\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-query-editor-m-language-expression.png 816w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-query-editor-m-language-expression-300x230.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-query-editor-m-language-expression-768x588.png 768w\" sizes=\"(max-width: 816px) 100vw, 816px\" \/><\/a><p id=\"caption-attachment-6956\" class=\"wp-caption-text\">Edit Power BI Query Script &#8211; Use custom M Language Script to import data from ODBC or other Relational<\/p><\/div>\n<p><strong>Power BI M Script (New Driver) &#8211; Import MWS Custom Report in Power BI<br \/>\n<\/strong><\/p>\n<pre class=\"lang:c# decode:true  \">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\/\/ Change _GET_MERCHANT_LISTINGS_DATA_ to something else if you need different report type (all 3 steps) -- https:\/\/docs.developer.amazonservices.com\/en_US\/reports\/Reports_ReportType.html\r\n\/\/ Replace MarketplaceId in all 3 steps (i.e for USA use ATVPDKIKX0DER) --https:\/\/docs.developer.amazonservices.com\/en_US\/dev_guide\/DG_Endpoints.html\r\n\/\/ Replace SellerId in all 3 steps\r\n\/\/ Remove or Change CreatedAfter in first step (or use CreatedBefore parameter instread of CreatedAfter)\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\r\nlet\r\n    sql=\"SELECT s3.* FROM $\r\nWITH(\r\nSrc='https:\/\/mws.amazonservices.com\/Reports\/2009-01-01',RequestMethod='POST'\r\n,RequestData='Action=RequestReport&amp;ReportType=_GET_MERCHANT_LISTINGS_DATA_&amp;MarketplaceId=ATVPDKIKX0DER&amp;SellerId=Axxxxxxxxxx&amp;CreatedAfter=2017-12-31T04%3A00%3A00Z'\r\n,IncludeParentColumns='False'\r\n,EnableRawOutputModeSingleRow='True'\r\n,RawOutputFilterExpr='\/\/*[local-name()=\"\"ReportRequestId\"\"]' \r\n,RawOutputDataRowTemplate='{ReportRequestId:\"\"[$1]\"\"}' \r\n,RawOutputExtractMode='Xml' \r\n,WaitTimeMs=5000\r\n,Meta='[{\"\"Name\"\": \"\"ReportRequestId\"\",\"\"Type\"\": \"\"Int64\"\"}]'\r\n,Alias='s1'\r\n\r\n,Join1_alias='s2'\t\r\n,Join1_Src='https:\/\/mws.amazonservices.com\/Reports\/2009-01-01',Join1_RequestMethod='POST'\r\n,Join1_RequestData='Action=GetReportRequestList&amp;ReportRequestIdList.Id.1=[$s1.ReportRequestId$]&amp;MarketplaceId=ATVPDKIKX0DER&amp;SellerId=Axxxxxxxxxx'\r\n,Join1_EnableRawOutputModeSingleRow='True'\r\n,Join1_RawOutputFilterExpr='\/\/*[local-name()=\"\"ReportProcessingStatus\"\"]||\/\/*[local-name()=\"\"GeneratedReportId\"\"]' \r\n,Join1_RawOutputDataRowTemplate='{ReportProcessingStatus:\"\"[$1]\"\",GeneratedReportId:\"\"[$2]\"\"}' \r\n,Join1_RawOutputExtractMode='Xml' \r\n,Join1_EnableStatusCheck='True', \r\n,Join1_StatucCheckMaxWaitSeconds=300,\r\n,Join1_StatucCheckIterationWaitSeconds=25,\r\n,Join1_StatusSuccessValue='_DONE_'\r\n,Join1_StatusFailedValue='_DONE_NO_DATA_|_CANCELLED_'\r\n\r\n,Join2_Alias='s3'\r\n,Join2_Src='https:\/\/mws.amazonservices.com\/Reports\/2009-01-01',Join2_RequestMethod='POST'\r\n,Join2_RequestData='Action=GetReport&amp;ReportId=[$s2.GeneratedReportId$]&amp;MarketplaceId=ATVPDKIKX0DER&amp;SellerId=Axxxxxxxxxx'\t\r\n,Join2_ColumnDelimiter='{TAB}'\r\n,Join2_ResponseCharset='Windows-1252'\t \r\n,Join2_EnableStatusCheck='False' \r\n,Join2_EnableRawOutputModeSingleRow='False'\r\n)\",\r\n    Source = Odbc.Query(\"dsn=ZS-AMAZON-MWS-CSV\", sql)\r\nin\r\n    Source<\/pre>\n<p>&nbsp;<\/p>\n<p><strong><\/p>\n<p>Power BI M Script (Old Driver) &#8211; v1.1.2 or older<\/p>\n<p><\/strong>If you are using older version &#8211; v1.1.2 or older then use below script.<\/p>\n<pre class=\"lang:default decode:true\">\/*\r\n All Copy Rights Reserved - ZappySys LLC. Feel free to share this snippet as long as you retain copyrights notice. https:\/\/zappysys.com\r\n Description:  This snippet will call Amazon MWS API to generate Inventory Report (Its multi step process - Job Style API call. First 2 calls gets XML data and Last call CSV data)\r\n*\/\r\n\r\nlet\r\n    \/\/NOTE: In Power BI M Language... each declare is separated by comma... \r\n    \/\/variable can be any type.. string, number, table, list , record, function reference. More info: https:\/\/docs.microsoft.com\/en-us\/powerquery-m\/power-query-m-reference\r\n    \/* \r\n    let \r\n        var1=expression, var2=expression,  ... varN=expression\r\n    in\r\n        varN   \/\/return some variable\r\n    *\/\r\n\r\n    \/\/define some common variables\r\n\r\n    MarketplaceId=\"A1xxxxxx\",\r\n    SellerId=\"A2xxxxxxxxxx\",\r\n\r\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    \/*Step-1 : Send new report request  - Must use XML Driver *\/\r\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\r\n    Step1Sql=\"SELECT ReportRequestId FROM $\r\nWITH(\r\n    --Src='c:\\temp\\reportrequest.txt'\r\n    Src='https:\/\/mws.amazonservices.com\/Reports\/2009-01-01'\r\n\t--,ElementsToTreatAsArray='Product'\r\n\t,Filter='$.RequestReportResponse.RequestReportResult.ReportRequestInfo'\r\n\t,RequestData='Action=RequestReport&amp;ReportType=_GET_MERCHANT_LISTINGS_DATA_&amp;MarketplaceId=\" &amp; MarketplaceId &amp; \"&amp;SellerId=\" &amp; SellerId &amp; \"'\r\n\t,RequestMethod='POST'\r\n\t,WaitTimeMs='300'\r\n\t,IncludeParentColumns='False'\r\n\t,CachingMode='All'\r\n\t,CacheStorage='File'\r\n\t,CacheFileLocation='c:\\temp\\mws-step1.cache'\r\n\t,CacheEntryTtl=300\r\n\t,Meta='[{\"\"Name\"\": \"\"ReportRequestId\"\",\"\"Type\"\": \"\"Int64\"\"}]'\r\n)\",\r\n    Source1 = Odbc.Query(\"dsn=ZAPPY-MWS-API-XML\", Step1Sql),\r\n    ReportRequestId= Source1{0}[ReportRequestId],\r\n    \r\n    \/\/NOTE: Technically we need to implement status check loop Wait for few seconds before \r\n    \/\/Increase this if you get ERROR in 3rd step\r\n    BlankTextForDelay = Function.InvokeAfter(()=&gt;\"\", #duration(0,0,0,15)), \/\/define delay - You must use it somewhere inorder to invoke delay\r\n\r\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    \/*Step-2 : Get report id - once report is done  - Must use XML Driver *\/\r\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    Step2Sql=BlankTextForDelay &amp; \"SELECT *  FROM $\r\nWITH(\r\n    --Src='c:\\temp\\report-status.xml'\r\n    Src='https:\/\/mws.amazonservices.com\/Reports\/2009-01-01'\r\n\t,ElementsToTreatAsArray='ReportRequestInfo'\r\n\t,Filter='$.GetReportRequestListResponse.GetReportRequestListResult.ReportRequestInfo'\r\n\t,RequestData='Action=GetReportRequestList&amp;ReportRequestIdList.Id.1=\" &amp;  ReportRequestId &amp; \"&amp;MarketplaceId=\" &amp; MarketplaceId &amp; \"&amp;SellerId=\" &amp; SellerId &amp; \"'\r\n\t,RequestMethod='POST'\r\n\t,WaitTimeMs='300'\r\n\t,IncludeParentColumns='False'\r\n\t,CachingMode='All'\r\n\t,CacheStorage='File'\r\n\t,CacheFileLocation='c:\\temp\\mws-step2.cache'\r\n\t,CacheEntryTtl=15\r\n\t,Meta='[{\"\"Name\"\": \"\"ReportProcessingStatus\"\",\"\"Type\"\": \"\"String\"\", Length: 100},{\"\"Name\"\": \"\"GeneratedReportId\"\",\"\"Type\"\": \"\"Int64\"\"}]'\r\n)\",    \r\n    Source2 = Odbc.Query(\"dsn=ZAPPY-MWS-API-XML\", Step2Sql),\r\n    ReportId= Source2{0}[GeneratedReportId],\r\n\r\n\r\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    \/*Step-3 : Get report data in CSV format - Must use CSV Driver *\/\r\n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    Step3Sql=\"SELECT * FROM $\r\nWITH(\r\n       --Src='c:\\temp\\inventory.csv.txt'\r\n\t Src='https:\/\/mws.amazonservices.com\/Reports\/2009-01-01'\r\n\t,RequestData='Action=GetReport&amp;ReportId=\" &amp;  ReportId &amp; \"&amp;MarketplaceId=\" &amp; MarketplaceId &amp; \"&amp;SellerId=\" &amp; SellerId &amp; \"'\r\n\t,RequestMethod='POST'\r\n\t,WaitTimeMs='300'\r\n\t,ColumnDelimiter='{TAB}'\r\n\t,CachingMode='All'\r\n\t,CacheStorage='File'\r\n\t,CacheFileLocation='c:\\temp\\mws-step3.cache'    \r\n\t,ResponseCharset='Windows-1252'\t    \r\n\t)\",    \r\n    Source3 = Odbc.Query(\"dsn=AMAZON-MWS-CSV\", Step3Sql)\r\n\r\nin\r\n    Source3  \/\/return Source3 (i.e. Table type variable)<\/pre>\n<p>&nbsp;<\/li>\n<li>Once done <strong>click OK<\/strong>.<\/li>\n<li>You may be prompted few times to trust each Query we defined in M Script above. Also you may be prompted to select DSN Credentials (Just Select <strong>Windows Credentials<\/strong>)\n<div id=\"attachment_6957\" style=\"width: 592px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-native-database-query-warning.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6957\" class=\"size-full wp-image-6957\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-native-database-query-warning.png\" alt=\"Power BI - Run Native Database Query Prompt\" width=\"582\" height=\"602\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-native-database-query-warning.png 582w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-native-database-query-warning-290x300.png 290w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/a><p id=\"caption-attachment-6957\" class=\"wp-caption-text\">Power BI &#8211; Run Native Database Query Prompt<\/p><\/div><\/li>\n<li>If you get prompted to select DSN Credentials then select as below (Click <strong>Windows<\/strong>).\n<div id=\"attachment_4860\" style=\"width: 732px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/connect-amazon-mws-data-power-bi-windows-authentication.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-4860\" class=\"size-full wp-image-4860\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/connect-amazon-mws-data-power-bi-windows-authentication.png\" alt=\"Select Authentication for Amazon MWS connection in Power BI data load\" width=\"722\" height=\"391\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/connect-amazon-mws-data-power-bi-windows-authentication.png 722w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/connect-amazon-mws-data-power-bi-windows-authentication-300x162.png 300w\" sizes=\"(max-width: 722px) 100vw, 722px\" \/><\/a><p id=\"caption-attachment-4860\" class=\"wp-caption-text\">Select Authentication for Amazon MWS connection in Power BI data load<\/p><\/div><\/li>\n<li>After few seconds (Depending on Delay we define in Script &#8211; default 15 sec) you will see data loaded.<\/li>\n<li>Once data is loaded click Close &amp; Apply and it will close the query editor and we will see main designer where you can see Dataset and Fields we just created.\n<div id=\"attachment_6958\" style=\"width: 1013px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-amazon-mws-save-query-close-apply.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6958\" class=\"size-full wp-image-6958\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-amazon-mws-save-query-close-apply.png\" alt=\"Loading Amazon MWS Reports data in Power BI (List Inventory Example using M Script)\" width=\"1003\" height=\"633\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-amazon-mws-save-query-close-apply.png 1003w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-amazon-mws-save-query-close-apply-300x189.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/power-bi-amazon-mws-save-query-close-apply-768x485.png 768w\" sizes=\"(max-width: 1003px) 100vw, 1003px\" \/><\/a><p id=\"caption-attachment-6958\" class=\"wp-caption-text\">Loading Amazon MWS Reports data in Power BI (List Inventory Example using M Script)<\/p><\/div><\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>In this article, we saw how to build sales report by reading data from your Amazon Seller Account. We used simple SQL queries with ZappySys XML Driver to pull data from Amazon MWS API.\u00a0<a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/\">ZappySys ODBC PowerPack<\/a> makes it super easy to consume data from virtually any API (JSON \/ XML or CSV Web Services), no coding required. <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/download\/\">Download here<\/a> to get started with ZappySys ODBC drivers.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In our previous blog we saw how to call REST API in Power BI to import data from JSON based REST API services. Now let&#8217;s continue on that and learn how to import Amazon MWS data in Power BI using XML driver. To learn more about how to consume Amazon MWS data in ETL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1632,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[276,335,278],"tags":[151,279,7],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>How to Import Amazon MWS data in Power BI | ZappySys Blog<\/title>\r\n<meta name=\"description\" content=\"Learn how to import Amazon MWS data in Power BI dashboard using ZappySys XML Driver.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"How to Import Amazon MWS data in Power BI | ZappySys Blog\" \/>\r\n<meta property=\"og:description\" content=\"Learn how to import Amazon MWS data in Power BI dashboard using ZappySys XML Driver.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/\" \/>\r\n<meta property=\"og:site_name\" content=\"ZappySys Blog\" \/>\r\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ZappySys\/\" \/>\r\n<meta property=\"article:published_time\" content=\"2018-09-14T15:24:15+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2026-03-11T07:08:28+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"505\" \/>\r\n\t<meta property=\"og:image:height\" content=\"505\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"ZappySys\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/zappysys\/\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ZappySys\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"19 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/\",\"url\":\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/\",\"name\":\"How to Import Amazon MWS data in Power BI | ZappySys Blog\",\"isPartOf\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png\",\"datePublished\":\"2018-09-14T15:24:15+00:00\",\"dateModified\":\"2026-03-11T07:08:28+00:00\",\"author\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82\"},\"description\":\"Learn how to import Amazon MWS data in Power BI dashboard using ZappySys XML Driver.\",\"breadcrumb\":{\"@id\":\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#primaryimage\",\"url\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png\",\"contentUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png\",\"width\":505,\"height\":505},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/zappysys.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Import Amazon MWS data in Power BI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zappysys.com\/blog\/#website\",\"url\":\"https:\/\/zappysys.com\/blog\/\",\"name\":\"ZappySys Blog\",\"description\":\"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zappysys.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82\",\"name\":\"ZappySys\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g\",\"caption\":\"ZappySys\"},\"sameAs\":[\"http:\/\/www.zappysys.com\/\",\"https:\/\/www.facebook.com\/ZappySys\/\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/zappysys\/\"],\"url\":\"https:\/\/zappysys.com\/blog\/author\/admin\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Import Amazon MWS data in Power BI | ZappySys Blog","description":"Learn how to import Amazon MWS data in Power BI dashboard using ZappySys XML Driver.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/","og_locale":"en_US","og_type":"article","og_title":"How to Import Amazon MWS data in Power BI | ZappySys Blog","og_description":"Learn how to import Amazon MWS data in Power BI dashboard using ZappySys XML Driver.","og_url":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/","og_site_name":"ZappySys Blog","article_author":"https:\/\/www.facebook.com\/ZappySys\/","article_published_time":"2018-09-14T15:24:15+00:00","article_modified_time":"2026-03-11T07:08:28+00:00","og_image":[{"width":505,"height":505,"url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png","type":"image\/png"}],"author":"ZappySys","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/zappysys\/","twitter_misc":{"Written by":"ZappySys","Est. reading time":"19 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/","url":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/","name":"How to Import Amazon MWS data in Power BI | ZappySys Blog","isPartOf":{"@id":"https:\/\/zappysys.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#primaryimage"},"image":{"@id":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#primaryimage"},"thumbnailUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png","datePublished":"2018-09-14T15:24:15+00:00","dateModified":"2026-03-11T07:08:28+00:00","author":{"@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82"},"description":"Learn how to import Amazon MWS data in Power BI dashboard using ZappySys XML Driver.","breadcrumb":{"@id":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#primaryimage","url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png","contentUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/10\/amazon-mws-api-integration.png","width":505,"height":505},{"@type":"BreadcrumbList","@id":"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-power-bi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zappysys.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Import Amazon MWS data in Power BI"}]},{"@type":"WebSite","@id":"https:\/\/zappysys.com\/blog\/#website","url":"https:\/\/zappysys.com\/blog\/","name":"ZappySys Blog","description":"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zappysys.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82","name":"ZappySys","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g","caption":"ZappySys"},"sameAs":["http:\/\/www.zappysys.com\/","https:\/\/www.facebook.com\/ZappySys\/","https:\/\/twitter.com\/https:\/\/twitter.com\/zappysys\/"],"url":"https:\/\/zappysys.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/4825"}],"collection":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/comments?post=4825"}],"version-history":[{"count":32,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/4825\/revisions"}],"predecessor-version":[{"id":11867,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/4825\/revisions\/11867"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media\/1632"}],"wp:attachment":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media?parent=4825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/categories?post=4825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/tags?post=4825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}