<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>XML File / SOAP API Driver Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 11 Mar 2026 07:08:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.4</generator>

<image>
	<url>https://zappysys.com/blog/wp-content/uploads/2023/01/cropped-zappysys-symbol-large-32x32.png</url>
	<title>XML File / SOAP API Driver Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Download AdWords report using Google Ads API, ODBC, and XML Driver</title>
		<link>https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 24 Oct 2019 13:49:00 +0000</pubDate>
				<category><![CDATA[ODBC Drivers]]></category>
		<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[ads]]></category>
		<category><![CDATA[AdWords]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[xml driver]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=8244</guid>

					<description><![CDATA[<p>Introduction In the previous article, we learned how to get data from AdWords in SSIS and basically control your AdWords account programmatically, outside the dashboard. In this one, we will continue on how to download AdWords report by using Google Ads API, ODBC, and ZappySys XML Driver. Let&#8217;s not waste our time and cut to [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/">Download AdWords report using Google Ads API, ODBC, and XML Driver</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<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;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/google-ads-connector/">API Connector for Google AdWords</a> which makes it much simpler to <strong>Read/Write Google AdWords Data in SSIS/ODBC</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).<br />
</div></div>
<p>In the previous article, we learned <a href="https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/" target="_blank" rel="noopener">how to get data from AdWords </a><a href="https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/" target="_blank" rel="noopener">in SSIS</a> and basically control your AdWords account programmatically, outside the dashboard. In this one, we will continue on how to download AdWords report by using Google Ads API, ODBC, and ZappySys XML Driver. Let&#8217;s not waste our time and cut to the chase!</p>
<h2>Prerequisites</h2>
<ol>
<li><a href="http://ads.google.com" target="_blank" rel="noopener">Google Ads</a> account up and running.</li>
<li><a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> installed.</li>
</ol>
<h2>Step-by-Step &#8211; Download AdWords report</h2>
<h3>Get Developer Token</h3>
<p>The first important step to access any Google Ads Account is to request a developer token. <a href="https://developers.google.com/adwords/api/docs/guides/first-api-call" target="_blank" rel="noopener">Click this link</a> for step by step information. Watch a short video to get an overview of the entire process to access data via API.</p>
<h3>Get Client Customer Id</h3>
<p>Login into a <em><strong>non-manager</strong></em> account at <a href="https://ads.google.com" target="_blank" rel="noopener">https://ads.google.com</a> and get your Client Customer Id:</p>
<div id="attachment_8247" style="width: 594px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-clientCustomerId.png" rel="attachment wp-att-8247"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-8247" class="wp-image-8247 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-clientCustomerId.png" alt="" width="584" height="341" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-clientCustomerId.png 584w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-clientCustomerId-300x175.png 300w" sizes="(max-width: 584px) 100vw, 584px" /></a><p id="caption-attachment-8247" class="wp-caption-text">Getting Google Ads (formerly AdWords) Client Customer Id</p></div>
<p>Copy it to a notepad, we will use it later.</p>
<h3>Open ODBC Data Sources Manager</h3>
<div class="content_block" id="custom_post_widget-8248">Search for "odbc" in your start menu and click on ODBC (64 bits). If you can't find this then you can also go to <span class="lang:default highlight:0 decode:true crayon-inline">Start Menu &gt; ZappySys &gt; ODBC PowerPack &gt; Click on ODBC Data Sources (64-Bit)</span>.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/odbc-data-source-64-bits.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/03/odbc-data-source-64-bits.png" alt="Open ODBC Data Source" />
</a>
<p class="wp-caption-text">Open ODBC Data Source</p>

</div></div>
<h3>Create ODBC Data Source based on ZappySys XML Driver</h3>
<div class="content_block" id="custom_post_widget-8251">Select tab <em>User DSN</em> if you want to create a data source only for your user, or select System DSN to create a data source for all users or for OS services (e.g. SQL Server Agent):
<div class="wp-caption alignnone">
<img decoding="async" class="alignnone size-full wp-image-8252" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-create-xml-driver-based-dsn.png" alt="" width="657" height="486" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-create-xml-driver-based-dsn.png 657w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-create-xml-driver-based-dsn-300x222.png 300w" sizes="(max-width: 657px) 100vw, 657px" />
<p class="wp-caption-text">Creating ZappySys XML Driver based data source</p>
</div></div>
<h3>Configure authentication in the ODBC data source</h3>
<p>Let&#8217;s authenticate first:</p>
<ol>
<li>Select <strong>OAuth</strong> in <em>Connection Type</em> property.</li>
<li>Click <strong>Click to Configure</strong> link.</li>
<li>In <em>OAuth Provider</em> property select <strong>Google</strong>.</li>
<li>Then either select <strong>Use Default OAuth App</strong> or <strong>Use Custom OAuth App</strong>. For the latter, you will need to create a <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/#Step-By-Step_How_to_register_Google_OAuth_Application" target="_blank" rel="noopener">Google OAuth App yourself</a>. It&#8217;s perfectly safe to use the default application, but if your company policy does not allow it, you may consider creating it yourself.</li>
<li>In <em>Scopes</em> enter:<br />
<code>https://www.googleapis.com/auth/adwords</code></li>
<li>Then hit <strong>Generate Token</strong> and hit allow once asked.</li>
</ol>
<div id="attachment_8261" style="width: 666px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-oauth-configuration-getting-tokens.png"><img decoding="async" aria-describedby="caption-attachment-8261" class="wp-image-8261 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-oauth-configuration-getting-tokens.png" alt="" width="656" height="745" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-oauth-configuration-getting-tokens.png 656w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-oauth-configuration-getting-tokens-264x300.png 264w" sizes="(max-width: 656px) 100vw, 656px" /></a><p id="caption-attachment-8261" class="wp-caption-text">Download AdWords report &#8211; Configuring authentication in ODBC data source</p></div>
<h3>Proceed with HTTP request configuration</h3>
<p>Then go on with configuring the data source:</p>
<div id="attachment_8260" style="width: 711px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration.png" rel="attachment wp-att-8260"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8260" class="wp-image-8260 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration.png" alt="" width="701" height="702" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration.png 701w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration-300x300.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-8260" class="wp-caption-text">Configuring HTTP request in ODBC data source to download an AdWords report</p></div>
<ol>
<li>Give your data source a name</li>
<li>Then input this URL to download the report:<br />
<code>https://adwords.google.com/api/adwords/reportdownload/v201809</code><br />
If the above URL does not work, <a href="https://developers.google.com/adwords/api/docs/guides/reporting#http_request_url" target="_blank" rel="noopener">get the working one from Google&#8217;s documentation</a>.</li>
<li>Input <strong>POST</strong> as <em>HTTP Request Method</em>.</li>
<li>In Body enter this text:<br />
<code>__rdxml=&lt;reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201809"&gt;<br />
&lt;selector&gt;<br />
&lt;fields&gt;CampaignId&lt;/fields&gt;<br />
&lt;fields&gt;Impressions&lt;/fields&gt;<br />
&lt;fields&gt;Clicks&lt;/fields&gt;<br />
&lt;fields&gt;Cost&lt;/fields&gt;<br />
&lt;predicates&gt;<br />
&lt;field&gt;CampaignStatus&lt;/field&gt;<br />
&lt;operator&gt;IN&lt;/operator&gt;<br />
&lt;values&gt;ENABLED&lt;/values&gt;<br />
&lt;values&gt;PAUSED&lt;/values&gt;<br />
&lt;/predicates&gt;<br />
&lt;/selector&gt;<br />
&lt;reportName&gt;My Campaign Performance Report&lt;/reportName&gt;<br />
&lt;reportType&gt;CAMPAIGN_PERFORMANCE_REPORT&lt;/reportType&gt;<br />
&lt;dateRangeType&gt;LAST_7_DAYS&lt;/dateRangeType&gt;<br />
&lt;downloadFormat&gt;XML&lt;/downloadFormat&gt;<br />
&lt;/reportDefinition&gt;</code><br />
This will display the data of CAMPAIGN_PERFORMANCE_REPORT report (campaign Id, impressions, clicks, and cost) for the last 7 days, for all campaigns that are enabled or paused. Make sure to visit the <a href="https://developers.google.com/adwords/api/docs/guides/reporting#create_a_report_definition" target="_blank" rel="noopener">Google documentation page</a>, which contains the information about how to download a different kind of report, how to configure predicates, etc.</li>
<li>In <em>Body Content Type</em> property select <strong>Form (application/x-www-form-urlencoded) </strong>option.</li>
<li>In <em>HTTP Headers</em> enter your <strong>developerToken</strong> and <strong>clientCustomerId</strong> retrieved in previous steps.</li>
</ol>
<h3>Select data filter in ODBC data source</h3>
<p>Then hit <strong>Select Filter</strong> button and select <strong>row</strong> node, so that <em>Array Filter</em> is set to <strong>$.report.table.row[*]</strong></p>
<div id="attachment_8264" style="width: 662px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/download-adwords-report-using-google-api-and-odbc-the-filter/#main" rel="attachment wp-att-8264"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8264" class="wp-image-8264 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-filter.png" alt="" width="652" height="696" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-filter.png 652w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-filter-281x300.png 281w" sizes="(max-width: 652px) 100vw, 652px" /></a><p id="caption-attachment-8264" class="wp-caption-text">Filtering on AdWords report data</p></div>
<p>If asked whether you want to treat the <strong>row</strong> element as an array, click &#8220;yes&#8221;. You can also go to the <strong>Xml Array Handling</strong> tab and see if the element <strong>row</strong> is specified there.</p>
<h2>The Results</h2>
<p>To view the results press <strong>Preview</strong> tab and then click <strong>Preview Data</strong>:</p>
<div id="attachment_8266" style="width: 628px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-results-b.png" rel="attachment wp-att-8266"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8266" class="wp-image-8266 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-results-b.png" alt="" width="618" height="647" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-results-b.png 618w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-results-b-287x300.png 287w" sizes="(max-width: 618px) 100vw, 618px" /></a><p id="caption-attachment-8266" class="wp-caption-text">Previewing AdWords report data</p></div>
<p>Now you can use this data source and get the data into an <a href="https://zappysys.com/blog/import-json-excel-load-file-rest-api/#How_to_import_REST_API_data_to_Excel" target="_blank" rel="noopener">Excel sheet</a>, <a href="https://zappysys.com/blog/call-soap-api-power-bi-read-xml-web-service-data/#Import_XML_SOAP_Web_Service_in_Power_BI_Using_XML_Driver" target="_blank" rel="noopener">Power BI report</a>, <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-gateway/" target="_blank" rel="noopener">SQL Server</a> (would need to create a data source in <a href="https://zappysys.com/products/odbc-powerpack/data-gateway/" target="_blank" rel="noopener">ZappySys Data Gateway</a> instead) or <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-app-integration/" target="_blank" rel="noopener">elsewhere</a>.</p>
<h2>Reusing the data source</h2>
<p>If your client application supports, you can override data source settings, such as HTTP body, in SQL query using <strong>WITH</strong> clause. In that case, you won&#8217;t need to create multiple data sources for different kind of reports; e.g.:</p>
<p><code>SELECT * FROM $ (RequestData='@c:\files\report-definition.txt')</code></p>
<p><code>SELECT * FROM $ (RequestData='__rdxml=&lt;reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201809"&gt;<br />
&lt;selector&gt;<br />
&lt;fields&gt;CampaignId&lt;/fields&gt;<br />
&lt;fields&gt;Cost&lt;/fields&gt;<br />
&lt;/selector&gt;<br />
&lt;reportName&gt;My Campaign Performance Report&lt;/reportName&gt;<br />
&lt;reportType&gt;CAMPAIGN_PERFORMANCE_REPORT&lt;/reportType&gt;<br />
&lt;dateRangeType&gt;LAST_7_DAYS&lt;/dateRangeType&gt;<br />
&lt;downloadFormat&gt;XML&lt;/downloadFormat&gt;<br />
&lt;/reportDefinition&gt;')</code></p>
<p>Build a SQL query using the <strong>Query Builder</strong>:</p>
<div id="attachment_8267" style="width: 597px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8267" class="wp-image-8267 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-query-builder.png" alt="" width="587" height="373" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-query-builder.png 587w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-query-builder-300x191.png 300w" sizes="(max-width: 587px) 100vw, 587px" /><p id="caption-attachment-8267" class="wp-caption-text">Use Query Builder to construct SQL query and override data source properties</p></div>
<h2>Conclusion</h2>
<p>In this article, we learned how to download AdWords report using ODBC PowerPack and Google API. We created an ODBC data source based on XML Driver, then configured the OAuth authentication, HTTP request and data filtering without a single line of code. Then we previewed AdWords &#8220;Campaign Performance Report&#8221; data and finally, considered how to reuse the data source we created. Visit <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-app-integration/" target="_blank" rel="noopener">https://zappysys.com/blog/category/odbc-powerpack/odbc-app-integration/</a> for examples of how to integrate data sources based on ZappySys Drivers into applications.</p>
<h2>References</h2>
<p><a href="https://developers.google.com/adwords/api/docs/guides/reporting" target="_blank" rel="noopener">https://developers.google.com/adwords/api/docs/guides/reporting</a></p>
<p><a href="https://developers.google.com/adwords/api/docs/appendix/reports" target="_blank" rel="noopener">https://developers.google.com/adwords/api/docs/appendix/reports</a></p>
<p><a href="https://developers.google.com/adwords/api/docs/appendix/reports/campaign-performance-report" target="_blank" rel="noopener">https://developers.google.com/adwords/api/docs/appendix/reports/campaign-performance-report</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/">Download AdWords report using Google Ads API, ODBC, and XML Driver</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Pivot JSON and XML data using SSIS or ODBC Drivers</title>
		<link>https://zappysys.com/blog/pivot-json-xml-data-using-ssis-odbc-drivers/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 11 Sep 2019 21:36:09 +0000</pubDate>
				<category><![CDATA[JSON File / REST API Driver]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=7975</guid>

					<description><![CDATA[<p>Introduction In our previous post we saw various ways to transform JSON arrays. However there will be a time when your JSON / XML file wont have Array and you need to Pivot JSON Data. Sample JSON data file Here is a sample JSON file which we like to parse into rows and columns. Notice [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/pivot-json-xml-data-using-ssis-odbc-drivers/">Pivot JSON and XML data using SSIS or ODBC Drivers</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In our previous post we saw <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">various ways to transform JSON arrays</a>. However there will be a time when your JSON / XML file wont have Array and you need to Pivot JSON Data.</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Sample JSON data file</h2>
<p>Here is a sample JSON file which we like to parse into rows and columns. Notice how it is using values inside in property name. This pattern needs Pivot option usage described later in this article.</p><pre class="crayon-plain-tag">{
	"version": 1.0,
	"products": {
		"P001": {
			"name": "Product 1",
			"price": 10
		},
		"P002": {
			"name": "Product 2",
			"price": 11
		},
		"P003": {
			"name": "Product 3",
			"price": 12
		}
	}
}</pre><p>
If you like to play with real data then use below URL. This JSON has <strong>60MB</strong> worth of data for all Products offered on AWS.  And It has similar structure as above except many more attributes under <strong>products </strong>node.</p><pre class="crayon-plain-tag">https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/us-east-1/index.json</pre><p>
&nbsp;</p>
<h2>Using SSIS PowerPack to Pivot JSON data</h2>
<p>ZappySys offers powerful <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">XML</a> Connectors. Below section will describe how to Parse and Pivot JSON data or Pivot XML data. For demo purpose we will use JSON Source but steps are almost same for XML too.</p>
<h3>Step-By-Step JSON Pivot</h3>
<ol>
<li>First drag data flow from SSIS Toolbox and then double click data flow
<div style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="Drag SSIS Data Flow Task from Toolbox" width="460" height="155" /><p class="wp-caption-text">Drag SSIS Data Flow Task from Toolbox</p></div></li>
<li>Once Data flow designer is open, drag ZS JSON Source from SSIS Toolbox.
<div style="width: 551px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="Drag ZappySys JSON Source" width="541" height="144" /><p class="wp-caption-text">Drag ZappySys JSON Source</p></div></li>
<li>Now for demo we will use Hard coded JSON using Direct Value option as below. You can also enter URL or File path if you select Direct Path option.</li>
<li>Go to <strong>Pivot Columns to Rows</strong> Tab and check <strong>Enable Pivoting</strong> Option
<div id="attachment_7977" style="width: 691px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/09/pivot-json-xml-data-option.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7977" class="size-full wp-image-7977" src="https://zappysys.com/blog/wp-content/uploads/2019/09/pivot-json-xml-data-option.png" alt="Pivot JSON / XML Data option for ZappySys API Connectors / Drivers" width="681" height="120" srcset="https://zappysys.com/blog/wp-content/uploads/2019/09/pivot-json-xml-data-option.png 681w, https://zappysys.com/blog/wp-content/uploads/2019/09/pivot-json-xml-data-option-300x53.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a><p id="caption-attachment-7977" class="wp-caption-text">Pivot JSON / XML Data option for ZappySys API Connectors / Drivers</p></div></li>
<li>Now come back to <strong>Filter Options</strong> Tab here you can either browse Filter or enter by hand. <strong>If file is too large then enter by hand</strong>. For example in our case we will enter <pre class="crayon-plain-tag">$.products</pre>  because we like to to parse structure below that node. If you have nested hierarchy (i.e. products node under orders node and so on) then use dot to separate them e.g. <pre class="crayon-plain-tag">$.customer.orders.products</pre></li>
<li><strong>For very Large file</strong> you need to <strong>Un-check Include Parent Columns</strong> option else you will get OutOfMemory Exception</li>
<li>Now click Preview to see our data.
<div id="attachment_7976" style="width: 789px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-json-pivot-data-options.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7976" class="size-full wp-image-7976" src="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-json-pivot-data-options.png" alt="Pivot JSON Data using SSIS JSON Source" width="779" height="744" srcset="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-json-pivot-data-options.png 779w, https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-json-pivot-data-options-300x287.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-json-pivot-data-options-768x733.png 768w" sizes="(max-width: 779px) 100vw, 779px" /></a><p id="caption-attachment-7976" class="wp-caption-text">Pivot JSON Data using SSIS JSON Source</p></div>
<p>&nbsp;</li>
<li>Now you can connect your JSON / XML source to destination. See below example.
<div id="attachment_1578" style="width: 596px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1578" class="size-full wp-image-1578" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png" alt="SSIS Package Execution - Loading Google BigQuery Data into SQL Server" width="586" height="296" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png 586w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver-300x152.png 300w" sizes="(max-width: 586px) 100vw, 586px" /></a><p id="caption-attachment-1578" class="wp-caption-text">SSIS Package Execution &#8211;<br />Loading Google BigQuery Data into SQL Server</p></div></li>
</ol>
<h2>Using ODBC PowerPack to Pivot JSON data</h2>
<p>So far we talked how to use SSIS to read your JSON data and Pivot it but what if you want to consume JSON / XML / REST API data in some other App without doing ETL via SSIS?  Thats where <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> comes in picture. Its a collection of many drivers including <a href="https://zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/" target="_blank" rel="noopener">JSON Driver</a> and <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">XML Driver</a>.  You can also use <a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">Data Gateway Approach</a>, which allows T-SQL code to fetch JSON / XML data directly into SQL Server Table without any ETL / Programming.</p>
<p>Here is sample query you can run using JSON Driver or XML Driver</p><pre class="crayon-plain-tag">SELECT * FROM $
WITH(
	 Src='https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/us-east-1/index.json'
	,Filter='$.products'
	,IncludeParentColumns='False'
	,EnablePivot='True'
)</pre><p>
See below screenshot of JSON Driver Configuration to get idea.<br />
<strong>Note:</strong> Use above query rather than what is displayed in the Screenshot.</p>
<div id="attachment_4467" style="width: 883px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/call-rest-api-in-csharp-odbc-json-driver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4467" class="size-full wp-image-4467" src="https://zappysys.com/blog/wp-content/uploads/2018/06/call-rest-api-in-csharp-odbc-json-driver.png" alt="Using ODBC DSN in C# code to call REST API" width="873" height="598" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/call-rest-api-in-csharp-odbc-json-driver.png 873w, https://zappysys.com/blog/wp-content/uploads/2018/06/call-rest-api-in-csharp-odbc-json-driver-300x205.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/06/call-rest-api-in-csharp-odbc-json-driver-768x526.png 768w" sizes="(max-width: 873px) 100vw, 873px" /></a><p id="caption-attachment-4467" class="wp-caption-text">Using ODBC DSN in C# code to call REST API</p></div>
<p>&nbsp;</p>
<div id="attachment_6416" style="width: 766px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6416" class="size-full wp-image-6416" src="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png" alt="Preview / Generate Query in JSON Driver / XML Driver" width="756" height="432" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png 756w, https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query-300x171.png 300w" sizes="(max-width: 756px) 100vw, 756px" /></a><p id="caption-attachment-6416" class="wp-caption-text">Preview / Generate Query in JSON Driver / XML Driver</p></div>
<div class="content_block" id="custom_post_widget-7051">ZappySys ODBC Drivers built using ODBC standard which is widely adopted by industry for a long time. Which mean the majority of BI Tools / Database Engines / ETL Tools already there will support native / 3rd party ODBC Drivers. Below is the small list of most popular tools / programming languages our Drivers support. If your tool / programming language doesn't appear in the below list, which means we have not documented use case but as long as your tool supports ODBC Standard, our drivers should work fine.

&nbsp;

<img loading="lazy" decoding="async" class="" src="//zappysys.com/images/odbc-powerpack/odbc-powerpack-integration.jpg" alt="ZappySys ODBC Drivers for REST API, JSON, XML - Integrate with Power BI, Tableau, QlikView, QlikSense, Informatica PowerCenter, Excel, SQL Server, SSIS, SSAS, SSRS, Visual Studio / WinForm / WCF, Python, C#, VB.net, PHP. PowerShell " width="750" height="372" />
<table style="valign: top;">
<tbody>
<tr>
<td>
<p style="text-align: center;"><strong>BI / Reporting Tools
Integration</strong></p>
</td>
<td style="text-align: center;"><strong>ETL Tools
Integration
</strong></td>
<td style="text-align: center;"><strong>Programming Languages</strong>
<strong>Integration</strong></td>
</tr>
<tr>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/howto-import-json-rest-api-power-bi/" target="_blank" rel="noopener">Microsoft Power BI</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-tableau-read-json-soap-xml-csv/">Tableau</a></li>
 	<li><a href="https://zappysys.com/blog/read-rest-api-using-ssrs-reports-call-json-xml-web-service/" target="_blank" rel="noopener">SSRS (SQL Reporting Services)</a></li>
 	<li><a href="https://zappysys.com/blog/qlik-rest-connector-examples-read-json-xml-api/" target="_blank" rel="noopener">QlikView /Qlik Sense</a></li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-in-microstrategy-json-soap-xml/" target="_blank" rel="noopener">MicroStrategy</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-google-sheet-call-appscript-load-json-soap-xml-csv/" target="_blank" rel="noopener">Google Sheet</a></li>
 	<li><a href="https://zappysys.com/blog/import-json-excel-load-file-rest-api/" target="_blank" rel="noopener">Microsoft Excel</a></li>
 	<li><a href="https://zappysys.com/api/integration-hub/rest-api-connector/access?context=connector" target="_blank" rel="noopener">Microsoft Access</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/read-json-informatica-import-rest-api-json-file/" target="_blank" rel="noopener">Informatica PowerCenter</a> (Windows)</li>
 	<li>Informatica Cloud</li>
 	<li>SSIS (SQL Integration Services)</li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">SQL Server</a></li>
 	<li><a href="https://zappysys.com/blog/read-write-rest-api-data-in-talend-json-xml-soap/" target="_blank" rel="noopener">Talend Data Studio</a></li>
 	<li><a href="https://zappysys.com/blog/pentaho-read-rest-api-in-pentaho/" target="_blank" rel="noopener">Pentaho Kettle</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li>Visual Studio</li>
 	<li><a href="https://zappysys.com/blog/calling-rest-api-in-c/" target="_blank" rel="noopener">C#</a></li>
 	<li>C++</li>
 	<li><a href="https://zappysys.com/blog/connect-java-to-rest-api-json-soap-xml/" target="_blank" rel="noopener">JAVA</a></li>
 	<li><a href="https://zappysys.com/blog/set-rest-python-client/" target="_blank" rel="noopener">Python</a></li>
 	<li>PHP</li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-powershell-script-export-json-csv/" target="_blank" rel="noopener">PowerShell</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">T-SQL (Using Linked Server)</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
&nbsp;</div>
<h2>Advanced Pivot with Path / Search and Replace Option</h2>
<p>Now let&#8217;s look at an advanced scenario where you like to extract Pivot_Path (know where Pivoted Property came from). For that, you can download the latest version which providers IncludePivotPath and EnablePivotPathSearchReplace options as below.</p>
<p>As you can see in the below example let&#8217;s say you like to extract table names and view names if defined under &#8220;views&#8221; node.</p><pre class="crayon-plain-tag">{
  "table-1": {
      "views": {
        "view-tbl1-1": {},
        "view-tbl1-2": {}
    }
  },
  "table-2": {
      "views": {}
  },
  "table-3": {
      "views": {
        "view-tbl3-1": {}
    }
  }
}</pre><p>
&nbsp;</p>
<p>We set following</p>
<ul>
<li>On the Filter Options Tab<br />
Filter = <pre class="crayon-plain-tag">$..views</pre></li>
<li>on the Pivot Columns To Rows Tab<br />
Check Enable Pivoting<br />
Check Include_PivotPath<br />
Check Enable Pivot_Path search/replace<br />
Set Search for <pre class="crayon-plain-tag">(.*).views.(.*)--regex</pre>
Set Replace With <pre class="crayon-plain-tag">$1</pre></li>
</ul>
<div id="attachment_10406" style="width: 522px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/09/advanced-pivot-path-search-replace.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10406" class="size-full wp-image-10406" src="https://zappysys.com/blog/wp-content/uploads/2019/09/advanced-pivot-path-search-replace.png" alt="Advanced Pivot Option - Search and Replace Path" width="512" height="650" srcset="https://zappysys.com/blog/wp-content/uploads/2019/09/advanced-pivot-path-search-replace.png 512w, https://zappysys.com/blog/wp-content/uploads/2019/09/advanced-pivot-path-search-replace-236x300.png 236w" sizes="(max-width: 512px) 100vw, 512px" /></a><p id="caption-attachment-10406" class="wp-caption-text">Advanced Pivot Option &#8211; Search and Replace Path</p></div>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>In this particle we saw how to use some advanced options for XML/ JSON Source and ODBC Drivers. You can download respective product depending your usecase. For SSIS usecase <a href="https://zappysys.com/products/odbc-powerpack/">Download SSIS PowerPack</a> and for other ETL / Reporting app integration scenarios (i.e. Power BI, Informatica, SSRS , Excel, MS Access, SQL Server, JAVA, C# &#8230;.) <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">Download ODBC PowerPack</a>.</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/pivot-json-xml-data-using-ssis-odbc-drivers/">Pivot JSON and XML data using SSIS or ODBC Drivers</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Import SAP S/4HANA OData Service Data Into Ms Access via ODBC Driver</title>
		<link>https://zappysys.com/blog/import-sap-s-4hana-odata-service-data-ms-access-via-odbc-driver/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 27 Jul 2019 06:34:32 +0000</pubDate>
				<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[Reporting - Microsoft Access]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[hana]]></category>
		<category><![CDATA[ms access]]></category>
		<category><![CDATA[odata]]></category>
		<category><![CDATA[s/4hana]]></category>
		<category><![CDATA[sap]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=7506</guid>

					<description><![CDATA[<p>Introduction In our previous blog we saw how to read JIRA data in SQL Server. Now let’s learn how to Import SAP S/4HANA OData Service Data Into MS Access. SAP S/4HANA provides OData REST API interface to access data in your application using HTTP Protocol. We will use ODBC XML Driver to read SAP data and load [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/import-sap-s-4hana-odata-service-data-ms-access-via-odbc-driver/">Import SAP S/4HANA OData Service Data Into Ms Access via ODBC Driver</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction">Introduction</span></h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/SAP_S4HANA.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignleft wp-image-7491 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/07/SAP_S4HANA.png" alt="SAP S/4HANA" width="150" height="150" /></a></p>
<p>In our previous blog we saw how to <a href="https://zappysys.com/blog/load-jira-data-sql-server-odbc-call-rest-api/" target="_blank" rel="noopener">read JIRA data in SQL Server</a>. Now let’s learn how to Import SAP S/4HANA OData Service Data Into MS Access. SAP S/4HANA provides OData REST API interface to access data in your application using HTTP Protocol. We will use <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">ODBC XML Driver</a> to read SAP data and load into MS Access.</p>
<p>So, let’s get started.</p>
<div id="custom_post_widget-2523" class="content_block">
<h2></h2>
<h2></h2>
<h2><span id="Requirements">Requirements</span></h2>
<ol>
<li>A first requirement, make sure that Microsoft Access installed</li>
<li>Finally, make sure to have <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> installed.</li>
</ol>
</div>
<h2><span id="About_SAP_HANA_OData_REST_API_Service">About SAP HANA / OData REST API Service</span></h2>
<p>You can expose your SAP Data using ODATA REST API Service. Here is a <a href="https://www.erpworkbench.com/sap-webapps/segw-odata-gateway-service.htm" target="_blank" rel="noopener">good article</a> which shows how to expose data as OData Service.   For more information on SAP OData Service feature check this <a href="https://help.sap.com/doc/05d53b2d3bbb43d2ab5efa23829b2777/1610%20001/en-US/frameset.htm?ecaeea50ca692309e10000000a445394.html" target="_blank" rel="noopener">SAP help page</a>. If you are new to OData Standard then <a href="https://www.odata.org/getting-started/basic-tutorial/" target="_blank" rel="noopener">read here</a> to know more how OData can facilitate data extraction using HTTP REST API. If you need Sample XML based OData Service then use below test URLs.</p><pre class="crayon-plain-tag">https://services.odata.org/Northwind/Northwind.svc/
https://services.odata.org/Northwind/Northwind.svc/Customers
https://services.odata.org/Northwind/Northwind.svc/Orders
https://services.odata.org/Northwind/Northwind.svc/Invoices
https://services.odata.org/Northwind/Northwind.svc/Products</pre><p>
Now let’s look at how to read SAP Data using ODBC Driver. At this point we assume you have exposed your data as OData Endpoint.</p>
<h2><span id="Read_SAP_HANA_data_using_XML_Source">Read SAP S/4HANA data using XML Driver</span></h2>
<p>First let’s look at steps to configure XML Driver. We will read data from SAP S/4HANA OData Service and then in next section we will look at how to load data into MS Access or other target.</p>
<ol>
<li>First, <strong>Windows search</strong>, write <strong>ODBC</strong> and select the <strong>ODBC Data sources (32 bits)</strong>
<div id="attachment_2780" class="wp-caption aligncenter">
<div id="attachment_2780" style="width: 395px" class="wp-caption aligncenter"><a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2018/03/open-ODBC-Data-souce-administrator.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2780" class="wp-image-2780 size-full" src="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2018/03/open-ODBC-Data-souce-administrator.png?zoom=0.8999999761581421&amp;resize=385%2C520&amp;ssl=1" alt="Open ODBC Data source" width="385" height="520" /></a><p id="caption-attachment-2780" class="wp-caption-text">Open ODBC Data Source</p></div>
</div>
</li>
<li>As a second step, in ODBC Data source Administrator press the <strong>Add</strong> button.
<div id="attachment_2725" style="width: 600px" class="wp-caption aligncenter"><a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2018/03/add-ZappySys.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2725" class="wp-image-2725 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/add-ZappySys.png" alt="Add ZappySys" width="590" height="423" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/add-ZappySys.png 590w, https://zappysys.com/blog/wp-content/uploads/2018/03/add-ZappySys-300x215.png 300w" sizes="(max-width: 590px) 100vw, 590px" /></a><p id="caption-attachment-2725" class="wp-caption-text">Add ZappySys</p></div></li>
<li>In this step, create the new data source, select <strong>ZappySys XML Driver.</strong>
<div id="attachment_2772" style="width: 302px" class="wp-caption aligncenter"><a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2018/03/create-new-data-source-zappysys-json-driver.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2772" class="wp-image-2772 size-medium" src="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2018/03/create-new-data-source-zappysys-json-driver.png?zoom=0.8999999761581421&amp;resize=292%2C218&amp;ssl=1" alt="add new zappysys" width="292" height="217" /></a><p id="caption-attachment-2772" class="wp-caption-text">Add new zappysys xml driver</p></div></li>
<li>Now edit that XML data source to configure it. Enter your OData Service URL its typically like below. Replace 3 parts with your own value (i.e. replace {MY-INSTANCE},  {MY-PROJECT}, {MY-TABLE})<br />
<pre class="crayon-plain-tag">https://{MY-INSTANCE}/sap/opu/odata/sap/{MY-PROJECT}/{MY-TABLE}</pre>
For example if you are hosting SAP HANA in Cloud Instance then your URL may look like below<br />
<pre class="crayon-plain-tag">https://myXXXXXX-api.s4hana.ondemand.com/sap/opu/odata/sap/MyTestProject/PurchaseOrders</pre>
And create New ZS-HTTP connection in it select <a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/" target="_blank" rel="noopener">Basic Authentication</a> and enter your SAP HANA UserID / Password to call OData Service and select the desire filter.</p>
<div id="attachment_7497" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7497" class="wp-image-7497 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service-768x537.png" alt="XML Driver : SAP S/4HANA OData Service Configuration" width="720" height="503" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service-768x537.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service-300x210.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service.png 1019w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-7497" class="wp-caption-text">XML Driver : SAP S/4HANA OData Service Configuration</p></div></li>
<li>Now go to Data Format / Compression (Zip/GZip) tab and select Data Format as OData to get all the records.
<div id="attachment_7498" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7498" class="wp-image-7498 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format-768x446.png" alt="Data Format : Odata" width="720" height="418" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format-768x446.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format-300x174.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format.png 792w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-7498" class="wp-caption-text">Data Format : Odata</p></div></li>
<li>Finally, now using Query Builder and Code Generator we will generate the query and click on Preview the data.
<div id="attachment_6416" style="width: 766px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6416" class="wp-image-6416 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png" alt="odbc-json-driver-generate-quickbooks-query" width="756" height="432" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png 756w, https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query-300x171.png 300w" sizes="(max-width: 756px) 100vw, 756px" /></a><p id="caption-attachment-6416" class="wp-caption-text">Generate Query</p></div></li>
<li>That’s it we are ready to load SAP S/4HANA OData Service data to MS Access.</li>
</ol>
<h2>Load SAP S/4HANA OData Service in MS Access</h2>
<ol>
<li>In MS Access, go to <strong>External Data</strong> Ribbon and select <strong>New Data Source</strong> and select <strong>From Other Sources</strong> and <strong>ODBC Database</strong>.
<div id="attachment_5171" style="width: 1235px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/access-blank-database-import-data-from-odbc-database.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5171" class="wp-image-5171 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/10/access-blank-database-import-data-from-odbc-database.png" alt="Configuration in MS Access: Import Data From REST API" width="1225" height="572" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/access-blank-database-import-data-from-odbc-database.png 1225w, https://zappysys.com/blog/wp-content/uploads/2018/10/access-blank-database-import-data-from-odbc-database-300x140.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/10/access-blank-database-import-data-from-odbc-database-768x359.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/10/access-blank-database-import-data-from-odbc-database-1024x478.png 1024w" sizes="(max-width: 1225px) 100vw, 1225px" /></a><p id="caption-attachment-5171" class="wp-caption-text">A configuration in MS Access: Import Data From REST API</p></div></li>
<li>Select the Source and destination of the data, select <strong>Import the source data into a new table in the current database</strong> and press OK.
<div id="attachment_2726" class="wp-caption alignnone">
<div id="attachment_5172" style="width: 746px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-from-odbc.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5172" class="wp-image-5172 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-from-odbc.png" alt="Get External Data - ODBC Database" width="736" height="543" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-from-odbc.png 736w, https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-from-odbc-300x221.png 300w" sizes="(max-width: 736px) 100vw, 736px" /></a><p id="caption-attachment-5172" class="wp-caption-text">Get External Data &#8211; ODBC Database</p></div>
</div>
</li>
<li>Select your newly created JSON Driver Data Source and click<strong><strong><strong> OK.<br />
</strong></strong></strong></p>
<div id="attachment_5223" style="width: 455px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-data-sources-1.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5223" class="wp-image-5223 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-data-sources-1.png" alt="Get External Data - Select your newly created ODBC Data Source (JSON Driver)" width="445" height="395" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-data-sources-1.png 445w, https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-data-sources-1-300x266.png 300w" sizes="(max-width: 445px) 100vw, 445px" /></a><p id="caption-attachment-5223" class="wp-caption-text">Get External Data &#8211; Select your newly created ODBC Data Source (JSON Driver)</p></div>
<p>&nbsp;</li>
<li>Select tables from the list of tables in the Import Objects screen and click <strong><strong>OK.<br />
</strong></strong></p>
<div id="attachment_5174" style="width: 473px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-tables.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5174" class="wp-image-5174 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-tables.png" alt="Get External Data - Select tables from Import Objects Screen" width="463" height="452" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-tables.png 463w, https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-tables-300x293.png 300w" sizes="(max-width: 463px) 100vw, 463px" /></a><p id="caption-attachment-5174" class="wp-caption-text">Get External Data &#8211; Select tables from Import Objects Screen</p></div></li>
<li>Select <strong>Save Import Steps</strong> from the screen and click on <strong>Save Import</strong> button.
<div id="attachment_5175" style="width: 746px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-save-steps.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5175" class="wp-image-5175 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-save-steps.png" alt="Get External Data - Select Save Import Steps" width="736" height="576" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-save-steps.png 736w, https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-select-save-steps-300x235.png 300w" sizes="(max-width: 736px) 100vw, 736px" /></a><p id="caption-attachment-5175" class="wp-caption-text">Get External Data &#8211; Select Save Import Steps</p></div></li>
<li>That&#8217;s it If everything is OK, you will be able to see the data.
<div id="attachment_5176" style="width: 1353px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-imported.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5176" class="wp-image-5176 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-imported.png" alt="Data Imported Successfully in MS Access DB Table" width="1343" height="404" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-imported.png 1343w, https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-imported-300x90.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-imported-768x231.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/10/ms-access-get-external-data-imported-1024x308.png 1024w" sizes="(max-width: 1343px) 100vw, 1343px" /></a><p id="caption-attachment-5176" class="wp-caption-text">Data Imported Successfully in MS Access DB Table</p></div></li>
</ol>
<h2><span id="How_to_import_REST_API_data_to_Excel">How to link REST API data to Access</span></h2>
<p>The linking process is very similar to importing data into the Access table. Follow steps of the previous paragraph &#8211; <a href="#how-to-import-data">How to import REST API data to Access</a> &#8211; but on step 2 select the second option to create a <em><strong>linked table</strong></em><b><i> </i></b>instead. Then at last it&#8217;s asked to select a unique record identifier, don&#8217;t select anything:</p>
<div id="attachment_7445" style="width: 326px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7445" class="wp-image-7445 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/10/link-rest-api-data-to-access-table-using-zappysys-odbc-powerpack.png" alt="Link table approach - don't select unique record identifier" width="316" height="382" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/link-rest-api-data-to-access-table-using-zappysys-odbc-powerpack.png 316w, https://zappysys.com/blog/wp-content/uploads/2018/10/link-rest-api-data-to-access-table-using-zappysys-odbc-powerpack-248x300.png 248w" sizes="(max-width: 316px) 100vw, 316px" /><p id="caption-attachment-7445" class="wp-caption-text">Linked table approach &#8211; Don&#8217;t select a unique Record identifier</p></div>
<h2><span id="Step-by-Step_Import_REST_API_into_Power_BI">SAP S/4HANA Integration with Other BI Tools</span></h2>
<div class="content_block" id="custom_post_widget-7051">ZappySys ODBC Drivers built using ODBC standard which is widely adopted by industry for a long time. Which mean the majority of BI Tools / Database Engines / ETL Tools already there will support native / 3rd party ODBC Drivers. Below is the small list of most popular tools / programming languages our Drivers support. If your tool / programming language doesn't appear in the below list, which means we have not documented use case but as long as your tool supports ODBC Standard, our drivers should work fine.

&nbsp;

<img loading="lazy" decoding="async" class="" src="//zappysys.com/images/odbc-powerpack/odbc-powerpack-integration.jpg" alt="ZappySys ODBC Drivers for REST API, JSON, XML - Integrate with Power BI, Tableau, QlikView, QlikSense, Informatica PowerCenter, Excel, SQL Server, SSIS, SSAS, SSRS, Visual Studio / WinForm / WCF, Python, C#, VB.net, PHP. PowerShell " width="750" height="372" />
<table style="valign: top;">
<tbody>
<tr>
<td>
<p style="text-align: center;"><strong>BI / Reporting Tools
Integration</strong></p>
</td>
<td style="text-align: center;"><strong>ETL Tools
Integration
</strong></td>
<td style="text-align: center;"><strong>Programming Languages</strong>
<strong>Integration</strong></td>
</tr>
<tr>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/howto-import-json-rest-api-power-bi/" target="_blank" rel="noopener">Microsoft Power BI</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-tableau-read-json-soap-xml-csv/">Tableau</a></li>
 	<li><a href="https://zappysys.com/blog/read-rest-api-using-ssrs-reports-call-json-xml-web-service/" target="_blank" rel="noopener">SSRS (SQL Reporting Services)</a></li>
 	<li><a href="https://zappysys.com/blog/qlik-rest-connector-examples-read-json-xml-api/" target="_blank" rel="noopener">QlikView /Qlik Sense</a></li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-in-microstrategy-json-soap-xml/" target="_blank" rel="noopener">MicroStrategy</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-google-sheet-call-appscript-load-json-soap-xml-csv/" target="_blank" rel="noopener">Google Sheet</a></li>
 	<li><a href="https://zappysys.com/blog/import-json-excel-load-file-rest-api/" target="_blank" rel="noopener">Microsoft Excel</a></li>
 	<li><a href="https://zappysys.com/api/integration-hub/rest-api-connector/access?context=connector" target="_blank" rel="noopener">Microsoft Access</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/read-json-informatica-import-rest-api-json-file/" target="_blank" rel="noopener">Informatica PowerCenter</a> (Windows)</li>
 	<li>Informatica Cloud</li>
 	<li>SSIS (SQL Integration Services)</li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">SQL Server</a></li>
 	<li><a href="https://zappysys.com/blog/read-write-rest-api-data-in-talend-json-xml-soap/" target="_blank" rel="noopener">Talend Data Studio</a></li>
 	<li><a href="https://zappysys.com/blog/pentaho-read-rest-api-in-pentaho/" target="_blank" rel="noopener">Pentaho Kettle</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li>Visual Studio</li>
 	<li><a href="https://zappysys.com/blog/calling-rest-api-in-c/" target="_blank" rel="noopener">C#</a></li>
 	<li>C++</li>
 	<li><a href="https://zappysys.com/blog/connect-java-to-rest-api-json-soap-xml/" target="_blank" rel="noopener">JAVA</a></li>
 	<li><a href="https://zappysys.com/blog/set-rest-python-client/" target="_blank" rel="noopener">Python</a></li>
 	<li>PHP</li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-powershell-script-export-json-csv/" target="_blank" rel="noopener">PowerShell</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">T-SQL (Using Linked Server)</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
&nbsp;</div>
<div class="content_block" id="custom_post_widget-8935"><h2>Troubleshooting Errors</h2>
<p>While running in Access\Excel\other and reading data from DSN created with ODBC PowerPack, if you get this error "<strong>License type [ODBC_PP_TRIAL] not found or its expired</strong>"</p>

<p>Please refer to this article for the same:  <a href="https://zappysys.zendesk.com/hc/en-us/articles/360042521533-Troubleshooting-License-type-ODBC-PP-TRIAL-not-found-or-its-expired-error-in-Microsoft-Access" target="_blank" rel="noopener">Troubleshooting "License type [ODBC_PP_TRIAL] not found or its expired" error in Microsoft Access</a></p></div>
<h2><span id="Step-by-Step_Import_REST_API_into_Power_BI">Conclusion</span></h2>
<p>So in this blog, we learned how to Import SAP S/4HANA OData Service Data in Access using <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">ODBC XML / SOAP API Driver</a> in a very simple way. You can achieve many more functionalities with this tool. Check our blogs/articles on <strong><a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/" target="_blank" rel="noopener">XML File / REST API Driver</a> </strong>to find out what <em>this tool</em> is capable of more.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following links for more information about the use of SAP S/4HANA OData Service with our tools:</p>
<ul>
<li><a href="https://api.sap.com/" target="_blank" rel="noopener">SAP API Business Hub</a></li>
<li><strong>Landing Page</strong> for <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">ODBC XML / SOAP API Driver</a>, you can also find <a href="https://youtu.be/iwezz0Z3D4U" target="_blank" rel="noopener">Tutorial Video</a> here.</li>
<li><strong>Help File:</strong> Documentation of XML Driver.</li>
<li><strong>Blog/articles link</strong>: <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/" target="_blank" rel="noopener">https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/import-sap-s-4hana-odata-service-data-ms-access-via-odbc-driver/">Import SAP S/4HANA OData Service Data Into Ms Access via ODBC Driver</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Import SAP S/4HANA OData Service Data Into Sql Server via ODBC Driver</title>
		<link>https://zappysys.com/blog/import-sap-s-4hana-odata-service-sql-server/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 20 Jul 2019 10:01:04 +0000</pubDate>
				<category><![CDATA[ODBC Gateway]]></category>
		<category><![CDATA[T-SQL (SQL Server)]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[hana]]></category>
		<category><![CDATA[odbc]]></category>
		<category><![CDATA[s/4hana]]></category>
		<category><![CDATA[sap]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=7490</guid>

					<description><![CDATA[<p>Introduction In our previous blog we saw how to read JIRA data in SQL Server. Now let’s learn how to Import SAP S/4HANA OData Service Data Into Sql Server. SAP S/4HANA provides OData REST API interface to access data in your application using HTTP Protocol. We will use ODBC XML Driver to read SAP data and load [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/import-sap-s-4hana-odata-service-sql-server/">Import SAP S/4HANA OData Service Data Into Sql Server via ODBC Driver</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction">Introduction</span></h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/SAP_S4HANA.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignleft wp-image-7491 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/07/SAP_S4HANA.png" alt="SAP S/4HANA" width="150" height="150" /></a></p>
<p>In our previous blog we saw how to <a href="https://zappysys.com/blog/load-jira-data-sql-server-odbc-call-rest-api/" target="_blank" rel="noopener">read JIRA data in SQL Server</a>. Now let’s learn how to Import SAP S/4HANA OData Service Data Into Sql Server. SAP S/4HANA provides OData REST API interface to access data in your application using HTTP Protocol. We will use <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">ODBC XML Driver</a> to read SAP data and load into SQL Server.</p>
<p>So, let’s get started.</p>
<div id="custom_post_widget-2523" class="content_block">
<h2></h2>
<h2></h2>
<h2><span id="Requirements">Requirements</span></h2>
<ol>
<li>A first requirement will be to SQL Server Database Engine Installed</li>
<li>The second requirement will be SSMS installed</li>
<li>Finally, make sure to have <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> installed.</li>
</ol>
</div>
<h2><span id="About_SAP_HANA_OData_REST_API_Service">About SAP HANA / OData REST API Service</span></h2>
<p>You can expose your SAP Data using ODATA REST API Service. Here is a <a href="https://www.erpworkbench.com/sap-webapps/segw-odata-gateway-service.htm" target="_blank" rel="noopener">good article</a> which shows how to expose data as OData Service.   For more information on SAP OData Service feature check this <a href="https://help.sap.com/doc/05d53b2d3bbb43d2ab5efa23829b2777/1610%20001/en-US/frameset.htm?ecaeea50ca692309e10000000a445394.html" target="_blank" rel="noopener">SAP help page</a>. If you are new to OData Standard then <a href="https://www.odata.org/getting-started/basic-tutorial/" target="_blank" rel="noopener">read here</a> to know more how OData can facilitate data extraction using HTTP REST API. If you need Sample XML based OData Service then use below test URLs.</p><pre class="crayon-plain-tag">https://services.odata.org/Northwind/Northwind.svc/
https://services.odata.org/Northwind/Northwind.svc/Customers
https://services.odata.org/Northwind/Northwind.svc/Orders
https://services.odata.org/Northwind/Northwind.svc/Invoices
https://services.odata.org/Northwind/Northwind.svc/Products</pre><p>
Now let’s look at how to read SAP Data using ODBC Driver. At this point we assume you have exposed your data as OData Endpoint.</p>
<h2><span id="Read_SAP_HANA_data_using_XML_Source">Read SAP S/4HANA data using XML Driver</span></h2>
<p>First let’s look at steps to configure XML Driver. We will read data from SAP S/4HANA OData Service and then in next section we will look at how to load data into SQL Server or other target.</p>
<ol>
<li>To do this, first of all, we will open the ZappySys Data Gateway Configuration:
<div id="attachment_5283" style="width: 410px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5283" class="wp-image-5283 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png" alt="Open ZappySys Data Gateway" width="400" height="315" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png 400w, https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway-300x236.png 300w" sizes="(max-width: 400px) 100vw, 400px" /></a><p id="caption-attachment-5283" class="wp-caption-text">Open ZappySys Data Gateway</p></div></li>
<li>Add the Native &#8211; ZappySys XML Driver Data source.
<div id="attachment_5284" style="width: 568px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/zappysys-data-gateway-add-data-source.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5284" class="wp-image-5284 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/11/zappysys-data-gateway-add-data-source.png" alt="Add Gateway Data Source" width="558" height="533" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/zappysys-data-gateway-add-data-source.png 558w, https://zappysys.com/blog/wp-content/uploads/2018/11/zappysys-data-gateway-add-data-source-300x287.png 300w" sizes="(max-width: 558px) 100vw, 558px" /></a><p id="caption-attachment-5284" class="wp-caption-text">Add Gateway Data Source</p></div></li>
<li>Now edit that XML data source to configure it. Enter your OData Service URL its typically like below. Replace 3 parts with your own value (i.e. replace {MY-INSTANCE},  {MY-PROJECT}, {MY-TABLE})<br />
<pre class="crayon-plain-tag">https://{MY-INSTANCE}/sap/opu/odata/sap/{MY-PROJECT}/{MY-TABLE}</pre>
For example if you are hosting SAP HANA in Cloud Instance then your URL may look like below<br />
<pre class="crayon-plain-tag">https://myXXXXXX-api.s4hana.ondemand.com/sap/opu/odata/sap/MyTestProject/PurchaseOrders</pre>
And create New ZS-HTTP connection in it select <a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/" target="_blank" rel="noopener">Basic Authentication</a> and enter your SAP HANA UserID / Password to call OData Service and select the desire filter.</p>
<div id="attachment_7497" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7497" class="wp-image-7497 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service-768x537.png" alt="XML Driver : SAP S/4HANA OData Service Configuration" width="720" height="503" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service-768x537.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service-300x210.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-xml-driver-sap-hana-odata-service.png 1019w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-7497" class="wp-caption-text">XML Driver : SAP S/4HANA OData Service Configuration</p></div></li>
<li>Now go to Data Format / Compression (Zip/GZip) tab and select Data Format as OData to get all the records.
<div id="attachment_7498" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7498" class="wp-image-7498 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format-768x446.png" alt="Data Format : Odata" width="720" height="418" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format-768x446.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format-300x174.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/07/odbc-driver-select-odata-data-format.png 792w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-7498" class="wp-caption-text">Data Format : Odata</p></div></li>
<li>Finally, now using Query Builder and Code Generator we will generate the query.
<div id="attachment_6416" style="width: 766px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6416" class="wp-image-6416 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png" alt="odbc-json-driver-generate-quickbooks-query" width="756" height="432" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png 756w, https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query-300x171.png 300w" sizes="(max-width: 756px) 100vw, 756px" /></a><p id="caption-attachment-6416" class="wp-caption-text">Generate Query</p></div></li>
<li>That’s it we are ready to load SAP S/4HANA OData Service data to SQL Server.</li>
</ol>
<h2>Load SAP S/4HANA OData Service in MS SQL Server</h2>
<div class="content_block" id="custom_post_widget-6457">Once you configured the data source in Gateway, we can now setup Linked Server in SQL Server to query API data.
<ol style="margin-left: 10px;">
 	<li>Assuming you have installed SQL Server and SSMS. If not then get both for FREE from here: <a href="https://www.microsoft.com/en-us/sql-server/sql-server-editions-express" target="_blank" rel="noopener">Get SQL Server Express</a> and  <a href="https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms" target="_blank" rel="noopener">Get SSMS</a></li>
 	<li>Open SSMS and connect to SQL Server.</li>
 	<li>Go to Root &gt; Server Objects &gt; Linked Servers node. Right click and click <strong>New Linked Server...</strong>
<div class="wp-caption alignnone">

<a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2018/03/create-new-linked-server-ssms.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2018/03/create-new-linked-server-ssms.png?w=720&amp;ssl=1" alt="Add Linked Server in SQL Server" width="420" height="262" /></a>
<p class="wp-caption-text">Add Linked Server in SQL Server</p>

</div></li>
 	<li> Now enter the linked server name, select Provider as SQL Native Client</li>
 	<li>Enter data source as <strong><span class="lang:default decode:true crayon-inline">GatewayServerName, PORT_NUMBER</span></strong> where server name is where ZappySys Gateway is running (Can be same as SQL Server machine or remote machine). Default PORT_NUMBER is 5000 but confirm on Data gateway &gt; General tab in case its different.</li>
 	<li>Enter Catalog Name. This must match name from Data gateway Data sources grid &gt; Name column
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssms-sql-server-configure-linked-server-2.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssms-sql-server-configure-linked-server-2.png" alt="Configure Linked Server Provider, Catalog, Server, Port for ZappySys Data Gateway Connection" />
</a>
<p class="wp-caption-text">Configure Linked Server Provider, Catalog, Server, Port for ZappySys Data Gateway Connection</p>
</div>
<div style="color: #31708f;background-color: #d9edf7;border-color: #bce8f1;padding: 15px;margin-bottom: 20px;border: 1px solid transparent;border-radius: 4px;">
<strong>INFO:</strong><br/>
<ul>
    <li>
      For <strong>SQL Server 2012, 2014, 2016, 2017, and 2019</strong>, use the <em>SQL Server Native Client 11.0</em> as the Provider.
    </li>
    <li>
      For <strong>SQL Server 2022 or higher</strong>, use the <em>Microsoft OLE DB Driver for SQL Server</em> as the Provider.
    </li>
  </ul>
</div></li>
 	<li>Click on Security Tab and select last option "<strong>Be made using this security context</strong>". Enter your gateway user account here.</li>
<li>
        <p>Optional: Under the Server Options Tab, Enable <b>RPC</b> and <b>RPC Out</b> and Disable Promotion of Distributed Transactions<b>(MSDTC)</b>.</p>
		<div class="wp-caption alignnone">
			<img decoding="async" class="block margin-bottom-10 img-thumbnail" src="https://zappysys.com/blog/wp-content/uploads/2018/11/linked-server-options-rpc-msdtc.png" title="RPC and MSDTC Settings" alt="RPC and MSDTC Settings" />
			<p class="wp-caption-text">RPC and MSDTC Settings</p>
		</div>
        <hr />
        <p>
            You need to enable RPC Out if you plan to use <b><i>EXEC(...) AT [MY_LINKED_SERVER_NAME]</i></b> rather than OPENQUERY.
            <br />
            If don't enabled it, you will encounter the <i>'Server "MY_LINKED_SERVER_NAME" is not configured for RPC'</i> error.
        </p>
        <p>
            Query Example:
            <code class="sql">EXEC('Select * from Products') AT [MY_LINKED_SERVER_NAME]</code>
        </p>
        <hr />
        <p>
            If you plan to use <b><i>'INSERT INTO...EXEC(....) AT [MY_LINKED_SERVER_NAME]'</i></b> in that case you need to Disable Promotion of Distributed Transactions(MSDTC).
            <br />
            If don't disabled it, you will encounter the <i>'The operation could not be performed because OLE DB provider "SQLNCLI11/MSOLEDBSQL" for linked server "MY_LINKED_SERVER_NAME" was unable to begin a distributed transaction.'</i> error.
        </p>
        <p>
            Query Example:
<pre class="">Insert Into dbo.Products 
EXEC('Select * from Products') AT [MY_LINKED_SERVER_NAME]</pre>
        </p>
        <hr />
</li>
 	<li>Click OK to save Linked Server</li>
 	<li>In SSMS execute below SQL query to test your connectivity.
<pre class="">SELECT * FROM OPENQUERY( MY_LINKED_SERVER_NAME, 'SELECT * FROM $')</pre>
</li>
 	<li>Here is the preview after you run some REST API query in SQL Server. Notice that you can override default configuration by supplying <a href="https://zappysys.com/onlinehelp/odbc-powerpack/scr/json-odbc-driver-connectionstring.htm" target="_blank" rel="noopener">many parameters</a> in WITH clause (second query example in the screenshot).
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc_json_driver__api_query_data_in_mssqlserver.png" target="_blank" rel="noopener">
<img loading="lazy" decoding="async" width="750" height="354" class="wp-image-6455 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc_json_driver__api_query_data_in_mssqlserver.png" alt="odbc_json_driver_api_query_data_in_mssqlserver" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc_json_driver__api_query_data_in_mssqlserver.png 750w, https://zappysys.com/blog/wp-content/uploads/2019/01/odbc_json_driver__api_query_data_in_mssqlserver-300x142.png 300w" sizes="(max-width: 750px) 100vw, 750px" />
</a>
<p class="wp-caption-text">SSMS Output - Query REST API via Linked Server OPENQUERY statement (Connect to ZappySys Data Gateway)</p>

</div></li>
 	<li>You can wrap your queries inside View or wrap inside Stored procedure to parameterize. Here is an example of creating the view which calls REST API queries.
<pre class="lang:tsql decode:true">CREATE VIEW dbo.vw_MyAPICall_View 
AS 
/*Call REST API inside SQL Server View*/
SELECT * FROM OPENQUERY( MY_LINKED_SERVER_NAME , 'SELECT * FROM $');

GO
</pre>
</li>
 	<li>Notice in above approach if you parameterize Stored Procedure then <a href="https://zappysys.com/blog/create-csv-list-sql-server-table-columns-datatypes/" target="_blank" rel="noopener">check this article to understand Dynamic Metadata</a>.</li>
 	<li>Now let's insert API data into the new data table "tblMyAPiData" in the SQL server database. For that, we need to execute below SQL query.
<pre class="lang:tsql decode:true ">Select * into tblMyAPiData FROM OPENQUERY( MY_LINKED_SERVER_NAME , 'SELECT * FROM $')</pre>
<div class="wp-caption alignnone">

<a href="https://zappysys.com/blog/wp-content/uploads/2019/02/odbc_json_driver_insert_data_in_sql.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" width="681" height="571" class="wp-image-6469 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/02/odbc_json_driver_insert_data_in_sql.png" alt="odbc_json_driver_insert_data_in_sql" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/odbc_json_driver_insert_data_in_sql.png 681w, https://zappysys.com/blog/wp-content/uploads/2019/02/odbc_json_driver_insert_data_in_sql-300x252.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a>
<p class="wp-caption-text">Insert data into the new table</p>

</div></li>
 	<li>Let's insert and update records into the already created table <span class="lang:default decode:true crayon-inline">"tblMyAPiData"</span>
<ul>
 	<li>To do that first we need to insert the new API data into the <span class="lang:default decode:true crayon-inline">"#temp_tblMyAPiData"</span> temporary database table.</li>
 	<li>Now let's delete the old records from the database table which are updated.</li>
 	<li>At the last insert all new API data into the database table.</li>
 	<li>To do that, we need to query like below SQL queries.</li>
</ul>
<pre class="lang:default decode:true">SELECT * into #temp_tblMyAPiData FROM OPENQUERY(MY_LINKED_SERVER_NAME, 'SELECT * FROM $')

DELETE FROM [dbo].[tblMyAPiData] WHERE id in (SELECT id FROM #temp_tblMyAPiData)

INSERT INTO tblMyAPiData
SELECT * FROM #temp_tblMyAPiData</pre>
&nbsp;</li>
 	<li>In the upper step, we see how to insert and update new records. Now if you want to update particular fields records only then you need to query like this.
<pre class="lang:default decode:true">Update dbtbl_1
set dbtbl_1.field1 = dbtbl_2.field1,
    dbtbl_1.field2 = dbtbl_2.field2
FROM tblMyAPiData dbtbl_1
JOIN (SELECT * FROM OPENQUERY(MY_LINKED_SERVER_NAME, 'SELECT * FROM $')) dbtbl_2 on dbtbl_1.id=dbtbl_2.id</pre>
<div class="su-note-inner su-clearfix" style="background-color: #fff4b7;border-color: #fffdf1;color: #333333">
<blockquote>*NOTE: If you are getting error like : "<strong>Cannot resolve the collation conflict between “Latin1_General_CI_AI” and “SQL_Latin1_General_CP1_CI_AS” in the equal to operation</strong>" then you need to query like this :
<pre class="lang:default decode:true">Update dbtbl_1
set dbtbl_1.field1 = dbtbl_2.field1,
    dbtbl_1.field2 = dbtbl_2.field2
FROM tblMyAPiData dbtbl_1
JOIN (SELECT * FROM OPENQUERY(MY_LINKED_SERVER_NAME, 'SELECT * FROM $')) dbtbl_2 
on dbtbl_1.id=dbtbl_2.id 
<strong>COLLATE SQL_Latin1_General_CP1_CI_AS</strong></pre>
&nbsp;</blockquote>
</div></li>
</ol></div>
<h2>SAP S/4HANA Integration with Other BI Tools (Power BI, Excel, SSRS, MS Access&#8230;)</h2>
<div class="content_block" id="custom_post_widget-7051">ZappySys ODBC Drivers built using ODBC standard which is widely adopted by industry for a long time. Which mean the majority of BI Tools / Database Engines / ETL Tools already there will support native / 3rd party ODBC Drivers. Below is the small list of most popular tools / programming languages our Drivers support. If your tool / programming language doesn't appear in the below list, which means we have not documented use case but as long as your tool supports ODBC Standard, our drivers should work fine.

&nbsp;

<img loading="lazy" decoding="async" class="" src="//zappysys.com/images/odbc-powerpack/odbc-powerpack-integration.jpg" alt="ZappySys ODBC Drivers for REST API, JSON, XML - Integrate with Power BI, Tableau, QlikView, QlikSense, Informatica PowerCenter, Excel, SQL Server, SSIS, SSAS, SSRS, Visual Studio / WinForm / WCF, Python, C#, VB.net, PHP. PowerShell " width="750" height="372" />
<table style="valign: top;">
<tbody>
<tr>
<td>
<p style="text-align: center;"><strong>BI / Reporting Tools
Integration</strong></p>
</td>
<td style="text-align: center;"><strong>ETL Tools
Integration
</strong></td>
<td style="text-align: center;"><strong>Programming Languages</strong>
<strong>Integration</strong></td>
</tr>
<tr>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/howto-import-json-rest-api-power-bi/" target="_blank" rel="noopener">Microsoft Power BI</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-tableau-read-json-soap-xml-csv/">Tableau</a></li>
 	<li><a href="https://zappysys.com/blog/read-rest-api-using-ssrs-reports-call-json-xml-web-service/" target="_blank" rel="noopener">SSRS (SQL Reporting Services)</a></li>
 	<li><a href="https://zappysys.com/blog/qlik-rest-connector-examples-read-json-xml-api/" target="_blank" rel="noopener">QlikView /Qlik Sense</a></li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-in-microstrategy-json-soap-xml/" target="_blank" rel="noopener">MicroStrategy</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-google-sheet-call-appscript-load-json-soap-xml-csv/" target="_blank" rel="noopener">Google Sheet</a></li>
 	<li><a href="https://zappysys.com/blog/import-json-excel-load-file-rest-api/" target="_blank" rel="noopener">Microsoft Excel</a></li>
 	<li><a href="https://zappysys.com/api/integration-hub/rest-api-connector/access?context=connector" target="_blank" rel="noopener">Microsoft Access</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/read-json-informatica-import-rest-api-json-file/" target="_blank" rel="noopener">Informatica PowerCenter</a> (Windows)</li>
 	<li>Informatica Cloud</li>
 	<li>SSIS (SQL Integration Services)</li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">SQL Server</a></li>
 	<li><a href="https://zappysys.com/blog/read-write-rest-api-data-in-talend-json-xml-soap/" target="_blank" rel="noopener">Talend Data Studio</a></li>
 	<li><a href="https://zappysys.com/blog/pentaho-read-rest-api-in-pentaho/" target="_blank" rel="noopener">Pentaho Kettle</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li>Visual Studio</li>
 	<li><a href="https://zappysys.com/blog/calling-rest-api-in-c/" target="_blank" rel="noopener">C#</a></li>
 	<li>C++</li>
 	<li><a href="https://zappysys.com/blog/connect-java-to-rest-api-json-soap-xml/" target="_blank" rel="noopener">JAVA</a></li>
 	<li><a href="https://zappysys.com/blog/set-rest-python-client/" target="_blank" rel="noopener">Python</a></li>
 	<li>PHP</li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-powershell-script-export-json-csv/" target="_blank" rel="noopener">PowerShell</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">T-SQL (Using Linked Server)</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
&nbsp;</div>
<h2><span id="Step-by-Step_Import_REST_API_into_Power_BI">Conclusion</span></h2>
<p>So in this blog, we learned how to Import SAP S/4HANA OData Service Data in MS SQL Server using <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">ODBC XML / SOAP API Driver</a> in a very simple way. You can achieve many more functionalities with this tool. Check our blogs/articles on <strong>XML File / REST API Driver </strong><a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/">https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/</a> to find out what <em>this tool</em> is capable of more.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following links for more information about the use of SAP S/4HANA OData Service with our tools:</p>
<ul>
<li><a href="https://api.sap.com/" target="_blank" rel="noopener">SAP API Business Hub</a></li>
<li><strong>Landing Page</strong> for <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">ODBC XML / SOAP API Driver</a>, you can also find <a href="https://youtu.be/iwezz0Z3D4U" target="_blank" rel="noopener">Tutorial Video</a> here.</li>
<li><strong>Help File:</strong> Documentation of <a href="https://zappysys.com/onlinehelp/odbc-powerpack/index.htm#page=xml-odbc-driver-intro.htm" target="_blank" rel="noopener">XML Driver</a>.</li>
<li><strong>Blog/articles link</strong>: <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/" target="_blank" rel="noopener">https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/xml-soap-api-driver/</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/import-sap-s-4hana-odata-service-sql-server/">Import SAP S/4HANA OData Service Data Into Sql Server via ODBC Driver</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read Walmart API data in SSIS / ODBC</title>
		<link>https://zappysys.com/blog/read-walmart-api-data-ssis-odbc/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 10 Jul 2019 12:45:13 +0000</pubDate>
				<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[REST API]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS Logging Task]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[Task]]></category>
		<category><![CDATA[Token]]></category>
		<category><![CDATA[Walmart]]></category>
		<category><![CDATA[ZappySys]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=7380</guid>

					<description><![CDATA[<p>Introduction In this article, we will see how to read Walmart API data in SSIS and load into SQL Server. This blog mainly focuses on SSIS approach but steps mentioned to call Walmart APIs can be useful for any developer regardless of which programming language or toolset you use. Are you a Walmart.com Supplier or Marketplace [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-walmart-api-data-ssis-odbc/">How to read Walmart API data in SSIS / ODBC</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction">Introduction</span></h2>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-7381 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2019/07/Walmart-150x150.jpg" alt="" width="128" height="128" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/Walmart-150x150.jpg 150w, https://zappysys.com/blog/wp-content/uploads/2019/07/Walmart.jpg 200w" sizes="(max-width: 128px) 100vw, 128px" />In this article, we will see how to read Walmart API data in SSIS and load into SQL Server. This blog mainly focuses on SSIS approach but steps mentioned to call Walmart APIs can be useful for any developer regardless of which programming language or toolset you use.</p>
<p>Are you a Walmart.com Supplier or Marketplace Seller? Then you may need to <a href="https://developer.walmart.com/">click here</a> to visit the site that is focused on these profiles.</p>
<p>&nbsp;</p>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:</p>
<ol>
<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>Make sure <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>).</li>
<li>Credentials of Walmart API. Click <a href="https://developer.walmartlabs.com/" target="_blank" rel="noopener">here</a> to create API.</li>
</ol>
<h2>Components Mentioned in this article</h2>
<div class="su-table su-table-alternate">
<table style="height: 44px;width: 307px">
<tbody>
<tr style="height: 22px">
<td style="width: 1px;height: 22px"><img loading="lazy" decoding="async" class="alignnone size-medium_large" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/logging-task/ssis-logging-task.png" width="40" height="40" /></td>
<td style="width: 247px;height: 22px"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-logging-task.htm" target="_blank" rel="noopener">ZS Logging Task</a></td>
</tr>
<tr style="height: 22px">
<td style="height: 22px;width: 1px"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/SSIS-Json-Source-Adapter.png"><img loading="lazy" decoding="async" class="alignnone wp-image-3074" src="https://zappysys.com/blog/wp-content/uploads/2016/01/SSIS-Json-Source-Adapter.png" alt="" width="40" height="40" /></a></td>
<td style="height: 22px;width: 247px"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/json-source.htm" target="_blank" rel="noopener">JSON Source(REST API or File)</a></td>
</tr>
</tbody>
</table>
</div>
<h2><span id="What_is_WordPress">What is Walmart?</span></h2>
<p>Walmart is the world&#8217;s largest retailer, and the Walmart Open API provides access to our extensive product catalog, thus enabling digital distribution partners to earn substantial affiliate revenues from customer referrals.</p>
<h2><span id="Read_data_fromWordPressusing_SSIS_JSON_Source">Read Walmart API Data using SSIS JSON Source</span></h2>
<p>Let’s start with an example. We use SSIS JSON Source component to make the call to Walmart API, we will read Walmart data and load into SQL Server. First of All, Open Visual Studio and Create New SSIS Package Project.</p>
<h3><span id="Step-1_GetDynamic_Token_Configure_ZS-HTTP_Connection">Get Dynamic Token (Configure ZS-HTTP Connection)</span></h3>
<p>To get API response data using SOAP / REST API call, you need to get an API Token from your login request URL. Follow the steps mentioned below to get API Token:</p>
<ol>
<li>Now, Right Click on Connection Managers Window, and one Context menu appears for creating a new connection manager.
<div style="width: 740px" class="wp-caption aligncenter"><a href="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2018/07/ssis-connection-manager-create-new-connection-e1531164541889.png?w=730&amp;ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2018/07/ssis-connection-manager-create-new-connection-e1531164541889.png?w=730&amp;ssl=1" alt="Create a New HTTP Connection." width="730" height="444" /></a><p class="wp-caption-text">Create a New HTTP Connection.</p></div></li>
<li>Select ZS HTTP Connection Manager from the list of Connection Managers and, double-click on it or click on Add button to add a new Connection Manager. By Default, The created connection manager is of Package-Level. You can set Project Level Connection manager too If you want.
<div style="width: 597px" class="wp-caption aligncenter"><a href="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2018/07/ssis-connection-manager-select-http-connection-manager-to-add.png?w=587&amp;ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2018/07/ssis-connection-manager-select-http-connection-manager-to-add.png?w=587&amp;ssl=1" alt="Select ZS-HTTP Connection from SSIS Connection Manager." width="587" height="634" /></a><p class="wp-caption-text">Select ZS-HTTP Connection from SSIS Connection Manager.</p></div></li>
<li>In the SSIS ZS HTTP Connection Manager, Go to General Tab and Configure HTTP Connection Manager. Enter API URL, Set Credentials Type to Dynamic Token &#8211; Two-Step Auth, and configure some basic settings for the same. We used Login URL as just example but you can enter any valid API URL endpoint here. Actual Login URL goes on Dynamic Token Tab (see next step).<br />
<pre class="crayon-plain-tag">https://marketplace.walmartapis.com/v3/items?nextCursor=*&amp;offset=2000&amp;limit=20</pre>
<pre class="crayon-plain-tag">WM_SEC.ACCESS_TOKEN</pre>
<div id="attachment_7418" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7418" class="wp-image-7418 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token-768x521.png" alt="ZS HTTP Connection - Configure General Tab" width="720" height="488" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token-768x521.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token-300x203.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token.png 814w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-7418" class="wp-caption-text">ZS HTTP Connection &#8211; Configure General Tab</p></div></li>
<li>Now, In the Dynamic Token Tab do configure like below image. Please click <a href="https://developer.walmart.com/#/apicenter/marketPlace/latest#getToken" target="_blank" rel="noopener">here</a> to refer about Walmart API Token.<br />
<pre class="crayon-plain-tag">https://marketplace.walmartapis.com/v3/token</pre>
<pre class="crayon-plain-tag">grant_type=client_credentials</pre>
<pre class="crayon-plain-tag">Accept: application/json
Cache-Control: no-cache
WM_SVC.NAME: Walmart Marketplace
WM_QOS.CORRELATION_ID: TokenId_&lt;&lt;yyyy-MM-ddTHH:mm:ss.fffZ,FUN_GETDATE_UTC&gt;&gt;
Authorization: Basic &lt;&lt;[$userid$]:[$password$],FUN_BASE64ENC&gt;&gt;</pre>
<div id="attachment_7454" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token-configure.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7454" class="wp-image-7454 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token-configure-768x668.png" alt="ZS HTTP Connection - Dynamic Token Tab" width="720" height="626" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token-configure-768x668.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token-configure-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-http-connection-dynamic-token-configure.png 854w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-7454" class="wp-caption-text">ZS HTTP Connection &#8211; Dynamic Token Tab</p></div></li>
<li>On the <strong>Response Settings</strong> tab configure as below
<div id="attachment_7706" style="width: 598px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/wallmart-api-extract-token-from-response.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7706" class="size-full wp-image-7706" src="https://zappysys.com/blog/wp-content/uploads/2019/07/wallmart-api-extract-token-from-response.png" alt="Walmart API - Extract Token - Response Settings" width="588" height="383" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/wallmart-api-extract-token-from-response.png 588w, https://zappysys.com/blog/wp-content/uploads/2019/07/wallmart-api-extract-token-from-response-300x195.png 300w" sizes="(max-width: 588px) 100vw, 588px" /></a><p id="caption-attachment-7706" class="wp-caption-text">Walmart API &#8211; Extract Token &#8211; Response Settings</p></div>
<ol>
<li>Extract Mode = <strong>Extract from Body </strong></li>
<li>Expression Type = <strong>Json</strong></li>
<li>Response Content Filter = <pre class="crayon-plain-tag">$.access_token</pre></li>
</ol>
</li>
<li>Click on OK button to save HTTP Connection configure settings.</li>
</ol>
<p>That’s it we have successfully configured Connection for Walmart API in SSIS. In the next section, we will see how to use this connection and read various data from Walmart API.</p>
<h3><span id="Read_YouTube_Playlists_in_SSIS">Read Walmart API Data in SSIS</span></h3>
<p>Once we have done creating HTTP Connection Manager we can move forward to read Walmart API data inside Data Flow. So lets Configure SSIS JSON / REST API Source.</p>
<ol>
<li>Now, Drag and drop Data Flow Task from SSIS Toolbox in the currently open project and double click it to edit.<br />
<img class="yoast-text-mark" /></p>
<div style="width: 470px" class="wp-caption aligncenter"><a href="https://i0.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png?resize=460%2C155&amp;ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png?resize=460%2C155&amp;ssl=1" alt="Drag and Drop Data Flow Task." width="460" height="155" /></a><p class="wp-caption-text">Drag and Drop Data Flow Task.</p></div></li>
<li>Double click on the Data Flow task to see the Data Flow designer surface.</li>
<li>From the SSIS toolbox drag and drop JSON Source on the dataflow designer surface.
<div style="width: 551px" class="wp-caption aligncenter"><a href="https://i1.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png?w=720&amp;ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://i1.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png?w=720&amp;ssl=1" alt="Drag and Drop JSON Source(REST API or File)." width="541" height="144" /></a><p class="wp-caption-text">Drag and Drop JSON Source(REST API or File).</p></div></li>
<li>Double click JSON Source and enter the following URL as below.<br />
<pre class="crayon-plain-tag">https://marketplace.walmartapis.com/v3/items?nextCursor=*&amp;offset=2000&amp;limit=20</pre>
</li>
<li>Check Use Credentials and select existing HTTP connection we have created already it.</li>
<li>Enter Following HTTP Headers. If you prefer Raw edit .. Just click on Raw Edit (#6 in screenshot) and paste below headers. Make sure to replace <strong>YourClientIdGoesHere</strong> and <strong>YourSecretGoesHere</strong><br />
<pre class="crayon-plain-tag">Content-Type: application/xml
Accept: application/xml
Authorization: Basic &lt;&lt;YourClientIdGoesHere:YourSecretGoesHere,FUN_BASE64ENC&gt;&gt;
WM_SVC.NAME: Walmart Marketplace
WM_QOS.CORRELATION_ID: TokenId_&lt;&lt;yyyy-MM-ddTHH:mm:ss.fffZ,FUN_GETDATE_UTC&gt;&gt;</pre>
&nbsp;</li>
<li>Select Array Filter (ItemResponse node) or type $.ItemResponse[*]  as below.
<div id="attachment_7420" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-json-source-configure.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7420" class="wp-image-7420 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-json-source-configure-768x765.png" alt="ZS JSON Source - Configure" width="720" height="717" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-json-source-configure-768x765.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-json-source-configure-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-json-source-configure-300x300.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-json-source-configure.png 826w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-7420" class="wp-caption-text">ZS JSON Source &#8211; Configure</p></div></li>
<li>That&#8217;s it, you are ready to load Wallmart API Data into SQL Server and you can use more <a href="https://zappysys.com//onlinehelp/ssis-powerpack/index.htm#page=ssis-format-specifiers.htm" target="_blank" rel="noopener">ZappySys Destination</a> components.</li>
<li>For pagination call please click <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">here</a> for reference to this link.</li>
</ol>
<h3>Load Walmart API data into SQL Server</h3>
<div class="content_block" id="custom_post_widget-5617"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination</strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.</p>
<h3>Step 1: Add Upsert Destination to Data Flow</h3>
<ol>
<li>Drag and drop the <strong>Upsert Destination</strong> component from the SSIS Toolbox.</li>
<li>Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png" /></a>
<p class="wp-caption-text">SSIS - Data Flow - Drang and Drop Upsert Destination Component</p>
</div>
<h3>Step 2: Configure Target Connection</h3>
<ol>
<li>Double-click the <strong>Upsert Destination</strong> component to open the configuration window.</li>
<li>Under <strong>Connection</strong>, select an existing target connection or click <strong>NEW</strong> to create a new connection.
<ul>
<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.</li>
</ul>
</li>
</ol>
<h3>Step 3: Select or Create Target Table</h3>
<ol>
<li>In the <strong>Target Table</strong> dropdown, select the table where you want to load data.</li>
<li>Optionally, click <strong>NEW</strong> to create a new table based on the source columns.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png" /></a>
<p class="wp-caption-text">Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS</p>
</div>
<h3>Step 4: Map Columns</h3>
<ol>
<li>Go to the <strong>Mappings</strong> tab.</li>
<li>Click <strong>Auto Map</strong> to map source columns to target columns by name.</li>
<li>Ensure you <strong>check the Primary key column(s)</strong> that will determine whether a record is inserted or updated.</li>
<li>You can manually adjust the mappings if necessary.</li>
</ol>
 <div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination - Columns Mappings</p>
</div>
<h3>Step 5: Save Settings</h3>
<ul>
<li>Click <strong>OK</strong> to save the Upsert Destination configuration.</li>
</ul>
<h3>Step 6: Optional: Add Logging or Analysis</h3>
<ul>
<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.</li>
</ul>
<h3>Step 7: Execute the Package</h3>
<ul>
<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.</li>
</ul>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination Execution</p>
</div></div>
<h2>Walmart API integration using ODBC Driver (Power BI, Excel, MS Access)</h2>
<p>So far we have seen how to access Walmart API using SSIS. However there will be a time when you like to access API data inside other Apps using ODBC Driver. ZappySys Provides JSON/XML/CSV drivers for virtually any API including Walmart API. Here is how to access Walmart API using <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">XML ODBC Driver</a>.</p>
<ol>
<li>Type &#8220;ODBC&#8221; in Start menu. Open ODBC Data sources (64 bit)<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-data-sources-start-up-screen.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3992" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-data-sources-start-up-screen.png" alt="Open ODBC Data Sources from Startup menu" width="986" height="622" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-data-sources-start-up-screen.png 986w, https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-data-sources-start-up-screen-300x189.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-data-sources-start-up-screen-768x484.png 768w" sizes="(max-width: 986px) 100vw, 986px" /></a></li>
<li>Click Add on User DSN tab (if you need to use DSN under different Account &#8230;i.e. Service Account then click on System DSN Tab)</li>
<li>Select <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener"><strong>ZappySys XML Driver</strong></a></li>
<li>When New DSN UI shows up, Change DSN name to anything you like (e.g. WalmartAPI)</li>
<li>Click on <strong>Load ConnectionString</strong> button and enter below connection. Make sure to replace few things<br />
First <strong>######YourClientId#######</strong> with your own clientid<br />
Second <strong>######YourSecret#######</strong> with your own secret<br />
Third <strong>######Base64OfClientIdAndSecret#######</strong> with base64 encoded string of <pre class="crayon-plain-tag">clientId:Secret</pre>    (both separated with colon). You can use any site <a href="https://www.base64encode.org/" target="_blank" rel="noopener">like this one</a> to generate base64 string of your clientid and secret (seperated by &#8220;:&#8221;)<br />
<pre class="crayon-plain-tag">DRIVER={ZappySys XML Driver};
ElementsToTreatAsArray='ns2:ItemResponse';
DataPath='https://marketplace.walmartapis.com/v3/items?nextCursor=*&amp;offset=2000&amp;limit=20';
DataConnectionType=HTTP;
AuthScheme='{none}';
Url='https://marketplace.walmartapis.com/v3/items?nextCursor=*&amp;offset=2000&amp;limit=20';
TokenUrl='https://marketplace.walmartapis.com/v3/token';
TokenRequestData='grant_type=client_credentials';
TokenRequestMethod='POST';
TokenResponseContentFilter='$.access_token';
TokenRequestHeaders='Accept:application/json||Cache-Control:no-cache||WM_SVC.NAME:Walmart Marketplace||WM_QOS.CORRELATION_ID:TokenId_&lt;&lt;yyyy-MM-ddTHH:mm:ss.fffZ,FUN_GETDATE_UTC&gt;&gt;||Authorization:Basic &lt;&lt;[$userid$]:[$password$],FUN_BASE64ENC&gt;&gt;';
TokenAuthHeader='WM_SEC.ACCESS_TOKEN';
TokenResponseContentType=Json;
UserName='######YourClientId#######';
CredentialType=TokenDynamic;
Password='######YourSecret#######';
Filter='$.ns2:ItemResponses.ns2:ItemResponse[*]';
RequestMethod='GET';
RequestHeaders='Content-Type: application/xml || Accept: application/xml || Authorization: Basic ######Base64OfClientIdAndSecret####### || WM_SVC.NAME: Walmart Marketplace || WM_QOS.CORRELATION_ID: TokenId_&lt;&lt;yyyy-MM-ddTHH:mm:ss.fffZ,FUN_GETDATE_UTC&gt;&gt;'</pre>
<div id="attachment_7712" style="width: 533px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/zappysys-driver-load-connection-string.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7712" class="size-full wp-image-7712" src="https://zappysys.com/blog/wp-content/uploads/2019/07/zappysys-driver-load-connection-string.png" alt="ZappySys Driver - Load Connection String" width="523" height="499" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/zappysys-driver-load-connection-string.png 523w, https://zappysys.com/blog/wp-content/uploads/2019/07/zappysys-driver-load-connection-string-300x286.png 300w" sizes="(max-width: 523px) 100vw, 523px" /></a><p id="caption-attachment-7712" class="wp-caption-text">ZappySys Driver &#8211; Load Connection String</p></div>
<p>&nbsp;</li>
<li>Now go to preview tab and enter below query and click Run below SQL.</p><pre class="crayon-plain-tag">select * from $</pre><p>
<strong>&#8211;OR&#8211;<br />
</strong>NOTE: Change <strong>YourClientId</strong> and <strong>YourSecret</strong> in below sql before running</p><pre class="crayon-plain-tag">SELECT * FROM $
WITH(
Src='https://marketplace.walmartapis.com/v3/items?nextCursor=*&amp;offset=2000&amp;limit=20'
,Header='Content-Type: application/xml
Accept: application/xml
Authorization: Basic &lt;&lt;YourClientid:YourSecret,FUN_BASE64ENC&gt;&gt;
WM_SVC.NAME: Walmart Marketplace
WM_QOS.CORRELATION_ID: TokenId_&lt;&lt;yyyy-MM-ddTHH:mm:ss.fffZ,FUN_GETDATE_UTC&gt;&gt;'
)</pre><p>
&nbsp;</li>
</ol>
<h2>Walmart API Integration with Other BI Tools (Power BI, Excel, SSRS, MS Access&#8230;)</h2>
<div class="content_block" id="custom_post_widget-7051">ZappySys ODBC Drivers built using ODBC standard which is widely adopted by industry for a long time. Which mean the majority of BI Tools / Database Engines / ETL Tools already there will support native / 3rd party ODBC Drivers. Below is the small list of most popular tools / programming languages our Drivers support. If your tool / programming language doesn't appear in the below list, which means we have not documented use case but as long as your tool supports ODBC Standard, our drivers should work fine.

&nbsp;

<img loading="lazy" decoding="async" class="" src="//zappysys.com/images/odbc-powerpack/odbc-powerpack-integration.jpg" alt="ZappySys ODBC Drivers for REST API, JSON, XML - Integrate with Power BI, Tableau, QlikView, QlikSense, Informatica PowerCenter, Excel, SQL Server, SSIS, SSAS, SSRS, Visual Studio / WinForm / WCF, Python, C#, VB.net, PHP. PowerShell " width="750" height="372" />
<table style="valign: top;">
<tbody>
<tr>
<td>
<p style="text-align: center;"><strong>BI / Reporting Tools
Integration</strong></p>
</td>
<td style="text-align: center;"><strong>ETL Tools
Integration
</strong></td>
<td style="text-align: center;"><strong>Programming Languages</strong>
<strong>Integration</strong></td>
</tr>
<tr>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/howto-import-json-rest-api-power-bi/" target="_blank" rel="noopener">Microsoft Power BI</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-tableau-read-json-soap-xml-csv/">Tableau</a></li>
 	<li><a href="https://zappysys.com/blog/read-rest-api-using-ssrs-reports-call-json-xml-web-service/" target="_blank" rel="noopener">SSRS (SQL Reporting Services)</a></li>
 	<li><a href="https://zappysys.com/blog/qlik-rest-connector-examples-read-json-xml-api/" target="_blank" rel="noopener">QlikView /Qlik Sense</a></li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-in-microstrategy-json-soap-xml/" target="_blank" rel="noopener">MicroStrategy</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-google-sheet-call-appscript-load-json-soap-xml-csv/" target="_blank" rel="noopener">Google Sheet</a></li>
 	<li><a href="https://zappysys.com/blog/import-json-excel-load-file-rest-api/" target="_blank" rel="noopener">Microsoft Excel</a></li>
 	<li><a href="https://zappysys.com/api/integration-hub/rest-api-connector/access?context=connector" target="_blank" rel="noopener">Microsoft Access</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/read-json-informatica-import-rest-api-json-file/" target="_blank" rel="noopener">Informatica PowerCenter</a> (Windows)</li>
 	<li>Informatica Cloud</li>
 	<li>SSIS (SQL Integration Services)</li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">SQL Server</a></li>
 	<li><a href="https://zappysys.com/blog/read-write-rest-api-data-in-talend-json-xml-soap/" target="_blank" rel="noopener">Talend Data Studio</a></li>
 	<li><a href="https://zappysys.com/blog/pentaho-read-rest-api-in-pentaho/" target="_blank" rel="noopener">Pentaho Kettle</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li>Visual Studio</li>
 	<li><a href="https://zappysys.com/blog/calling-rest-api-in-c/" target="_blank" rel="noopener">C#</a></li>
 	<li>C++</li>
 	<li><a href="https://zappysys.com/blog/connect-java-to-rest-api-json-soap-xml/" target="_blank" rel="noopener">JAVA</a></li>
 	<li><a href="https://zappysys.com/blog/set-rest-python-client/" target="_blank" rel="noopener">Python</a></li>
 	<li>PHP</li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-powershell-script-export-json-csv/" target="_blank" rel="noopener">PowerShell</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">T-SQL (Using Linked Server)</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
&nbsp;</div>
<h2>How to encrypt Authorization Token as Base64Encode</h2>
<ol>
<li>If you want to directly pass Authorization header Token as Base64Encode(clientId:clientSecret) encrypted in the get token call, you can encrypted it using ZS Logging task and used it. Please refer to this <a href="https://zappysys.com//onlinehelp/ssis-powerpack/index.htm#page=ssis-format-specifiers.htm" target="_blank" rel="noopener">link</a> for the same.</li>
<li>In visual studio just Drag and Drop ZS Logging Task in the design panel.
<div style="width: 405px" class="wp-caption aligncenter"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/logging-task/ssis-logging-task-drag.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/logging-task/ssis-logging-task-drag.png" alt="Drag and Drop ZS Logging Task" width="395" height="80" /></a><p class="wp-caption-text">Drag and Drop ZS Logging Task</p></div></li>
<li>Double click on ZS Logging Task to configure it.</li>
<li>In the ZS Logging Task configure like the following image.
<div id="attachment_7453" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-encrypted-authorization-token-using-zs-logging-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7453" class="wp-image-7453 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-encrypted-authorization-token-using-zs-logging-task-768x426.png" alt="Logging Task : Base64Enocde " width="720" height="399" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-encrypted-authorization-token-using-zs-logging-task-768x426.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-encrypted-authorization-token-using-zs-logging-task-300x167.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-encrypted-authorization-token-using-zs-logging-task-1024x569.png 1024w, https://zappysys.com/blog/wp-content/uploads/2019/07/ssis-walmart-encrypted-authorization-token-using-zs-logging-task.png 1050w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-7453" class="wp-caption-text">Logging Task : Base64Enocde</p></div></li>
<li>That&#8217;s all, Save Base64Encoded token for use in HTTP Connection.</li>
</ol>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>After all, we saw you how to extract information from REST API such as Walmart REST API using HTTP Connection and load into SQL Server. We also learned techniques like How to get Dynamic Token using HTTP Connection. To explore many other scenarios not discussed in this article download <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here (includes 70+ Components)</a>.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following links for more information:</p>
<ul style="list-style-type: circle;">
<li>Help File: <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/json-source.htm" target="_blank" rel="noopener">JSON Source(REST API or File)</a>, <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-logging-task.htm" target="_blank" rel="noopener">ZS Logging Task</a></li>
<li>Walmart API: <a href="https://developer.walmart.com/#/apicenter/marketPlace/latest#getToken" target="_blank" rel="noopener">HTTP Connection</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/read-walmart-api-data-ssis-odbc/">How to read Walmart API data in SSIS / ODBC</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Import Bing Ads data into SQL Server (Performance Reports)</title>
		<link>https://zappysys.com/blog/import-bing-ads-data-sql-server-performance-reports/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 13 Jun 2019 21:04:57 +0000</pubDate>
				<category><![CDATA[ODBC Gateway]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[T-SQL (SQL Server)]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[Bing Ads]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=7217</guid>

					<description><![CDATA[<p>Introduction In our previous blog post we saw how to import REST / SOAP API in SQL Server. Using same concepts let&#8217;s look at how to import Bing Ads data into SQL Server. We will explore many techniques to call Bing Ads API and learn how to automate data extraction without doing any ETL. You [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/import-bing-ads-data-sql-server-performance-reports/">Import Bing Ads data into SQL Server (Performance Reports)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/bing-ads-logo.png"><img loading="lazy" decoding="async" class=" wp-image-7363 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2019/06/bing-ads-logo.png" alt="" width="190" height="158" /></a>In our previous blog post we saw how to <a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">import REST / SOAP API in SQL Server</a>. Using same concepts let&#8217;s look at how to import Bing Ads data into SQL Server. We will explore many techniques to call Bing Ads API and learn how to automate data extraction without doing any ETL. You can call Bing Ads API just using T-SQL code (Yes you heard it right). At the end of this article you will learn how to <strong>Download Performance Reports from Bing Ads Account</strong> without any coding (See sample screenshot below). Please go through full article carefully.</p>
<p><strong>NOTE:</strong> Bing Ads now renamed as Microsoft Advertising but this article will use popular name for time being.</p>
<h2></h2>
<div id="attachment_7218" style="width: 841px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7218" class="size-full wp-image-7218" src="https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table.png" alt="Import Bing Ads data into SQL Server (Using SSMS T-SQL Code)" width="831" height="741" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table.png 831w, https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table-300x268.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table-768x685.png 768w" sizes="(max-width: 831px) 100vw, 831px" /></a><p id="caption-attachment-7218" class="wp-caption-text">Import Bing Ads data into SQL Server (Using SSMS T-SQL Code)</p></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-7048"><h2>Requirements</h2>
This article talks about few tools and techniques in order to load API data in SQL Server. Please make sure following prerequisites are met.
<ol>
 	<li>Download and Install <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> (This includes XML / JSON / REST API and few other drivers for SQL Server and ODBC connectivity in tools like Excel, Power BI, SSRS)</li>
 	<li>Make sure you have access to SQL Server Instance. If you cant find one still want to try what is mentioned in this article then install <a href="https://www.microsoft.com/en-us/sql-server/sql-server-editions-express" target="_blank" rel="noopener">FREE SQL Express Edition</a></li>
 	<li>Confirm that you have SSMS Installed. If you don't have then you can download <a href="https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017">from here</a>.</li>
</ol></div>
<h2>About Bing Ads API / SOAP Web Service</h2>
<p>If you are new to Bing Ads API then <a href="https://docs.microsoft.com/en-us/advertising/" target="_blank" rel="noopener">start from here</a>. Bing Ads APIs are SOAP XML APIs. You can call it to automate <a href="https://docs.microsoft.com/en-us/advertising/guides/?view=bingads-13" target="_blank" rel="noopener">many scenarios</a> for Bing Ads. In this article we will mainly focus on read scenario (e.g. Read Performance Data) but you can use these techniques to write / update (e.g. Create New Campaign).</p>
<p>If you are new to SOAP WebService then <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">Check this article</a> to learn more. It will explain you how to use tools like <strong>SoapUI</strong> tool to craft SOAP Requests for Bing API or any other SOAP API.</p>
<p>For Bing API you can use Service WSDL files <a href="https://docs.microsoft.com/en-us/advertising/guides/web-service-addresses?view=bingads-13" target="_blank" rel="noopener">found here</a>. Use URL ending <strong>?wsdl</strong> to import in SoapUI.</p>
<h2>Example Bing API Request</h2>
<p>Here is raw API request for Bing API. This sample assumes you have completed 3-Legged OAuth Authorization to obtain AccessToken and RefreshToken (Explained later in this article). Below request uses AccessToken you might have already obtained via <a href="https://docs.microsoft.com/en-us/advertising/guides/get-started?view=bingads-13#get-developer-token" target="_blank" rel="noopener">process like this</a>. If you are using ZappySys tools then this will be generated automatically for you.</p>
<p><strong>Request Method / URL:</strong></p><pre class="crayon-plain-tag">POST https://clientcenter.api.bingads.microsoft.com/Api/CustomerManagement/v13/CustomerManagementService.svc</pre><p>
<strong>Headers:<br />
</strong>Notice that for each Api you may need correct <strong>SOAPAction</strong> in Header. If you are not sure then use SoapUI Tool. Execute request in SoapUI and then go to <strong>Raw tab </strong><a href="https://zappysys.com/blog/wp-content/uploads/2016/06/soapui-get-contenttype-soapaction-raw-tab.png" target="_blank" rel="noopener">like this one</a>.</p><pre class="crayon-plain-tag">Content-Type: text/xml; charset=utf-8
SOAPAction: "GetUser"</pre><p>
<strong>Body:<br />
</strong>Notice that you have to replace <strong>AuthenticationToken</strong> and <strong>DeveloperToken</strong> in below request. AccessToken is placed inside AuthenticationToken tag. This Auth token is short lived and extracted via OAuth Process and DeveloperToken you can extract as mentioned in the previous section <a href="https://developers.ads.microsoft.com/Account">or get it from here</a>.</p><pre class="crayon-plain-tag"><s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Customer/v13">
    <Action mustUnderstand="1">GetUser</Action>
    <AuthenticationToken i:nil="false"><%access_token%></AuthenticationToken>
    <DeveloperToken i:nil="false">1052Bxxxxxxxxxxxxxx</DeveloperToken>
  </s:Header>
  <s:Body>
    <GetUserRequest xmlns="https://bingads.microsoft.com/Customer/v13">
      <UserId i:nil="true"></UserId>
    </GetUserRequest>
  </s:Body>
</s:Envelope></pre><p>
<strong>Response:</strong></p><pre class="crayon-plain-tag">&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;s:Header&gt;
    &lt;h:TrackingId xmlns:h="https://bingads.microsoft.com/Customer/v13"&gt;fddf3cb9-e4c2-4e75-9546-f3bc20ea91a8&lt;/h:TrackingId&gt;
  &lt;/s:Header&gt;
  &lt;s:Body&gt;
    &lt;GetUserResponse xmlns="https://bingads.microsoft.com/Customer/v13"&gt;
      &lt;User xmlns:a="https://bingads.microsoft.com/Customer/v13/Entities" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
        &lt;a:ContactInfo&gt;
          &lt;a:Address&gt;
            &lt;a:City i:nil="true" /&gt;
            &lt;a:CountryCode&gt;US&lt;/a:CountryCode&gt;
            &lt;a:Id i:nil="true" /&gt;
            &lt;a:Line1 i:nil="true" /&gt;
            &lt;a:Line2 i:nil="true" /&gt;
            &lt;a:Line3 i:nil="true" /&gt;
            &lt;a:Line4 i:nil="true" /&gt;
            &lt;a:PostalCode i:nil="true" /&gt;
            &lt;a:StateOrProvince i:nil="true" /&gt;
            &lt;a:TimeStamp i:nil="true" /&gt;
            &lt;a:BusinessName i:nil="true" /&gt;
          &lt;/a:Address&gt;
          &lt;a:ContactByPhone&gt;false&lt;/a:ContactByPhone&gt;
          &lt;a:ContactByPostalMail&gt;false&lt;/a:ContactByPostalMail&gt;
          &lt;a:Email&gt;someone@zappysys.com&lt;/a:Email&gt;
          &lt;a:EmailFormat i:nil="true" /&gt;
          &lt;a:Fax i:nil="true" /&gt;
          &lt;a:HomePhone i:nil="true" /&gt;
          &lt;a:Id&gt;48045678&lt;/a:Id&gt;
          &lt;a:Mobile i:nil="true" /&gt;
          &lt;a:Phone1&gt;111-222-3333&lt;/a:Phone1&gt;
          &lt;a:Phone2 i:nil="true" /&gt;
        &lt;/a:ContactInfo&gt;
        &lt;a:CustomerId&gt;19112345&lt;/a:CustomerId&gt;
        &lt;a:Id&gt;48012345&lt;/a:Id&gt;
        &lt;a:JobTitle i:nil="true" /&gt;
        &lt;a:LastModifiedByUserId&gt;48012345&lt;/a:LastModifiedByUserId&gt;
        &lt;a:LastModifiedTime&gt;2019-06-04T14:22:35.38&lt;/a:LastModifiedTime&gt;
        &lt;a:Lcid&gt;EnglishUS&lt;/a:Lcid&gt;
        &lt;a:Name&gt;
          &lt;a:FirstName&gt;Someone&lt;/a:FirstName&gt;
          &lt;a:LastName&gt;Good&lt;/a:LastName&gt;
          &lt;a:MiddleInitial i:nil="true" /&gt;
        &lt;/a:Name&gt;
        &lt;a:Password i:nil="true" /&gt;
        &lt;a:SecretAnswer i:nil="true" /&gt;
        &lt;a:SecretQuestion&gt;None&lt;/a:SecretQuestion&gt;
        &lt;a:UserLifeCycleStatus&gt;Active&lt;/a:UserLifeCycleStatus&gt;
        &lt;a:TimeStamp&gt;AAAAAJiX/cU=&lt;/a:TimeStamp&gt;
        &lt;a:UserName&gt;someone@zappysys.com&lt;/a:UserName&gt;
        &lt;a:ForwardCompatibilityMap i:nil="true" xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /&gt;
      &lt;/User&gt;
      &lt;CustomerRoles xmlns:a="https://bingads.microsoft.com/Customer/v13/Entities" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
        &lt;a:CustomerRole&gt;
          &lt;a:RoleId&gt;41&lt;/a:RoleId&gt;
          &lt;a:CustomerId&gt;19160000&lt;/a:CustomerId&gt;
          &lt;a:AccountIds i:nil="true" xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /&gt;
          &lt;a:LinkedAccountIds xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /&gt;
          &lt;a:CustomerLinkPermission i:nil="true" /&gt;
        &lt;/a:CustomerRole&gt;
      &lt;/CustomerRoles&gt;
    &lt;/GetUserResponse&gt;
  &lt;/s:Body&gt;
&lt;/s:Envelope&gt;</pre><p>
<div class="content_block" id="custom_post_widget-7357"><h2>Things to know about REST / SOAP API</h2>
Before we deep dive into calling your specific APIs you like to integrate, you must have basic understanding what is REST API / SOAP API. In this section we will cover few important concepts and difference about these two API styles REST vs SOAP.
<h3><strong>What is REST API (or RESTful API)</strong></h3>
As per wikipedia <a href="https://en.wikipedia.org/wiki/Representational_state_transfer" target="_blank" rel="noopener">REST</a> is an architecture style which can be used to to expose data over the internet using http / https. Using REST style you can expose data operations / functions which can be called by other users. With API calls You can read / write data or just call business functions which triggers some workflow.

Most APIs documents various aspects of calling API (REST or SOAP). You need to pass these details accurately. Refer to your API documentation <a href="https://developer.zendesk.com/rest_api/docs/support/introduction" target="_blank" rel="noopener">like this one for example</a> . If its an internal API then contact API developer to get more details.
<ul>
 	<li><strong>URL and Parameters</strong>  (or sometimes referred as endpoint)</li>
 	<li><strong>Request Method</strong> (or sometimes referred as Verb)- e.g. GET, POST, PUT, PATCH .....</li>
 	<li><strong>HTTP Headers</strong></li>
 	<li><strong>Request Body</strong></li>
</ul>
<strong>Sample REST API Call</strong>

<strong>Request:</strong>
<pre class="lang:default decode:true">POST http://myhost/api/v2/customers/new
X-SecretKey: Abcdxxxxxxxxxxxxxx
Content-Type: application/json

{ firstname: "Someone", lastname: "Good" }</pre>
<strong>Response:</strong>
<pre class="lang:default highlight:0 decode:true">{
 request_status: "CreatedOK",
 new_customer_id: "1234566"
}</pre>
<h3>What is SOAP Web Service (XML API)</h3>
<a href="https://en.wikipedia.org/wiki/SOAP" target="_blank" rel="noopener">SOAP Web Service</a> is an old standard developed before REST Style got popular. SOAP is strictly XML based API on the other hand RESTful API can be any format. As we said earlier REST is an architecture style,  and SOAP is a standard (XML Based Protocol to transfer data).

For more information on SOAP API <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">refer to this link / videos</a>
<h3>Other Concepts Calling REST / SOAP</h3>
There are few things you have to find out from your API Provider (Read their documentation <a href="https://developer.zendesk.com/rest_api/docs/support/introduction" target="_blank" rel="noopener">like this for example</a>). Few important concepts for API calling listed below.
<ul>
 	<li><strong>Authentication</strong> - Most APIs need some sort of credentials to verify your identity. Here are some common Auth mechanism
<ul>
 	<li><a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/">Basic Authentication</a>,</li>
 	<li><a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/" target="_blank" rel="noopener">OAuth 1a or 2.0</a></li>
 	<li><a href="https://zappysys.com/blog/call-soap-rest-api-using-dynamic-token-ssis/" target="_blank" rel="noopener">Dynamic Token Auth </a></li>
 	<li>Pass API key via URL Parameter
e.g. <span class="lang:default decode:true  crayon-inline">http://myhost/api/v1/getcustomers?apikey=###some-secret-key####</span></li>
 	<li>Pass API key via Header</li>
</ul>
</li>
 	<li><strong>Pagination</strong> - Most APIs don't return huge amount of data in a single requests so you must call next request to continue fetch more data until all rows are fetched. There is no standard around pagination so find out from your API provider how to paginate. <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">Check this article for example</a> to learn about various pagination patterns.</li>
 	<li><strong>Throttling (API calls rate limit)</strong> - Most API providers enforce API call rate limit. Which means you cannot call it more than X times in a given time. If you ever face such issue, You can enable <a href="https://zappysys.com/blog/wp-content/uploads/2018/09/http-retry-settings-oauth-connection.png" target="_blank" rel="noopener">error retry option like this</a> or simply <a href="https://zappysys.com/blog/wp-content/uploads/2016/01/rest-api-limit-throttling-pause-request-per-seconds.png" target="_blank" rel="noopener">add delay like this</a> to slow down.</li>
</ul>
<h3>Must have Tools for API Testing / Debugging</h3>
Before you start integrating API calls in ZappySys products like <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ODBC PowerPack</a> or <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> you can start testing API using tools like CURL, Postman or Fiddler.
<h4><strong>Fiddler</strong></h4>
Fiddler is the best API API debugger out there. It acts like a small Proxy server so you can see all Web requests on your system in a raw format. You can also use this tool to Test API requests (See Composer tab in Fiddler) however if API testing is your primary use case then use POSTMAN (see next) because it has more UI elements compared to Fiddler. Here is <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/">small tutorial to get started with Fiddler</a>.
<h4><strong>Postman</strong></h4>
<a href="https://www.getpostman.com/" target="_blank" rel="noopener">Postman</a> is probably the most popular tool to test API with full User interface. It's not data processing like ZappySys but you can pass various parts of API we talked earlier and test API before you can start using ZappySys for Data integration. Here is <a href="https://www.youtube.com/watch?v=t5n07Ybz7yI">Video Tutorial to get started with Postman</a>.
<h4><strong>cURL</strong></h4>
<a href="https://curl.haxx.se/">CURL</a> is a simple yet most popular command line tool to call / test APIs. It doesn't have UI elements like previous two tools so have to learn about each options you can pass to this command line.</div>
<h2>Step-By-Step: How to Import Bing Ads Data into SQL Server</h2>
<p>Now let&#8217;s look at how to import Bing Ads Data into SQL Server Table. This tutorial will require 10-15 mins of your time. At the end of this tutorial you will be able to Read Bing Ads Performance Report and Import data into SQL Server. Step listed in this tutorial may help you to call Bing API in other tools like <a href="https://zappysys.com/blog/call-rest-api-using-ssis-web-service-task/">SSIS</a>, <a href="https://zappysys.com/blog/call-soap-api-power-bi-read-xml-web-service-data/">Power BI</a>, SSRS, Tableau and so on.</p>
<p>So let&#8217;s get started.</p>
<h3>Register OAuth App for Bing Ads API (Azure Active Directory App)</h3>
<p>Very first thing to call any Bing API is to register OAuth App (Under Azure Active Directory Tab).</p>
<p>Here is how to register OAuth App which can be used to call Bing Ads API later on.</p>
<ol>
<li>
    <strong>Login to Azure Portal:</strong></p>
<ul>
<li>Navigate to the <a href="https://portal.azure.com/#home" target="_blank" rel="noopener"><strong>Azure Portal</strong></a> and log in using your credentials.</li>
</ul>
</li>
<li>
    <strong>Access Azure Active Directory:</strong></p>
<ul>
<li>In the left-hand menu, click on <a target="_blank" href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview" rel="noopener"><strong>Azure Active Directory</strong></a>.</li>
</ul>
</li>
<li>
    <strong>Register a New Application:</strong></p>
<ul>
<li>Go to <a target="_blank" href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps" rel="noopener"><strong>App registrations</strong></a> and click on <strong>New registration</strong>.<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2019/07/register-azure-active-directory-oauth-app.png"><img loading="lazy" decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2019/07/register-azure-active-directory-oauth-app.png" alt="" width="638" height="368" class="alignnone size-full wp-image-7344" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/register-azure-active-directory-oauth-app.png 638w, https://zappysys.com/blog/wp-content/uploads/2019/07/register-azure-active-directory-oauth-app-300x173.png 300w" sizes="(max-width: 638px) 100vw, 638px" /></a>
</li>
<li><strong>Application Name:</strong> Enter a name for your application.<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2019/07/create-new-azure-oauth-app-select-type.png"><img loading="lazy" decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2019/07/create-new-azure-oauth-app-select-type.png" alt="" width="392" height="567" class="alignnone size-full wp-image-7345" srcset="https://zappysys.com/blog/wp-content/uploads/2019/07/create-new-azure-oauth-app-select-type.png 392w, https://zappysys.com/blog/wp-content/uploads/2019/07/create-new-azure-oauth-app-select-type-207x300.png 207w" sizes="(max-width: 392px) 100vw, 392px" /></a>
</li>
<li><strong>Supported Account Types:</strong> Choose the account types your app will support. For example, select <strong>Accounts in this organizational directory only</strong> if you need access to data in your organization only.</li>
<li><strong>Redirect URI:</strong>
<ul>
<li>Set the type to <strong>Web</strong>.</li>
<li>In the textbox enter <b>https://login.microsoftonline.com/common/oauth2/nativeclient</b> as the Redirect URI or any other valid redirect URL, e.g., <b>https://zappysys.com/oauth</b>.</li>
<li>Use this Redirect URI in the <strong>Redirect URL</strong> grid row.</li>
</ul>
</li>
</ul>
</li>
<li>
    <strong>Save Client ID:</strong></p>
<ul>
<li>After registering the app, copy the <strong>Application (client) ID</strong> and paste it into the <strong>Client ID</strong> field in the API Connection Manager configuration.</li>
</ul>
</li>
<li>
    <strong>Set Authorization &amp; Token URLs:</strong></p>
<ul>
<li>Click on the <strong>Endpoints</strong> link in the App registration overview.</li>
<li><strong>Authorization URL:</strong> Copy the <strong>OAuth 2.0 authorization endpoint (v2)</strong> URL (e.g., <code>https://login.microsoftonline.com/{your-tenant-id}/oauth2/v2.0/authorize</code>) and paste it into the <strong>Authorization URL</strong> field in the configuration grid.</li>
<li><strong>Token URL:</strong> Copy the <strong>OAuth 2.0 token endpoint (v2)</strong> URL (e.g., <code>https://login.microsoftonline.com/{your-tenant-id}/oauth2/v2.0/token</code>) and paste it into the <strong>Token URL</strong> field.</li>
</ul>
</li>
<li>
    <strong>Create a Client Secret:</strong></p>
<ul>
<li>In the <strong>Certificates &amp; secrets</strong> tab, click <strong>New client secret</strong>.</li>
<li>Set an expiration period for the secret.</li>
<li>Copy the generated client secret and paste it into the <strong>Client Secret</strong> field in the API Connection Manager configuration.</li>
</ul>
</li>
<li>
    <strong>Configure API Permissions:</strong></p>
<ul>
<li>Go to the <strong>API Permissions</strong> section.</li>
<li>Click on <strong>Add a permission</strong>, select <strong>Microsoft Graph</strong>, and choose <strong>Delegated Permissions</strong>.</li>
<li>Add the required permissions:
<ul>
<li>offline_access</li>
<li>openid</li>
<li>profile</li>
<li>Sites.Read.All</li>
<li>Sites.ReadWrite.All</li>
<li>User.Read</li>
<li>email</li>
</ul>
<div id="attachment_11177" style="width: 903px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/azure-ad-app-required-app-permissions.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11177" src="https://zappysys.com/blog/wp-content/uploads/2019/06/azure-ad-app-required-app-permissions.jpg" alt="azure-ad-app-required-app-permissions" width="893" height="681" class="size-full wp-image-11177" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/azure-ad-app-required-app-permissions.jpg 893w, https://zappysys.com/blog/wp-content/uploads/2019/06/azure-ad-app-required-app-permissions-300x229.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2019/06/azure-ad-app-required-app-permissions-768x586.jpg 768w" sizes="(max-width: 893px) 100vw, 893px" /></a><p id="caption-attachment-11177" class="wp-caption-text">Azure AD App &#8211; Required API Permissions</p></div>
      </li>
<li><strong>Grant Admin Consent</strong> for the permissions that require it.</li>
</ul>
</li>
<li>
    <strong>Generate Tokens:</strong></p>
<ul>
<li>Use the <strong>Generate Token</strong> feature in the API Connection Manager to generate authentication tokens.</li>
</ul>
</li>
<li>
    <strong>Use a Generic Account for Automation:</strong></p>
<div style="background-color: #f5f2c4; border-style: solid; border-color: #000000; border-width: 1px; margin-top: 3px; margin-bottom: 6px; padding: 6px;">
		<b>NOTE</b>: If you are planning to use your current data connection/token for automated processes, we recommend that you use a generic account for token generation when the login box appears (e.g. sales_automation@mycompany.com instead of bob_smith@mycompany.com). When you use a personal account which is tied to a specific employee profile and that employee leaves the company, the token may become invalid and any automated processes using that token will fail. Another potentially unwanted effect of using a personal token is incorrect logging; the API calls (e.g. Read, Edit, Delete, Upload) made with that token will record the specific user as performing the calls instead of an automated process.
    </div>
</li>
<li>That&#8217;s it!</li>
</ol>
<h3>Get Bing API Developer Token</h3>
<p>Once we have OAuth App registered next thing is to obtain Developer Token for Bing Ads API. <a href="https://developers.ads.microsoft.com/Account" target="_blank" rel="noopener">Click here to request new token</a> or view existing Developer token.</p>
<div class="content_block" id="custom_post_widget-5411"><h3><span style="font-size: 14pt;">Configure ZappySys Data Gateway</span></h3>
Now let's look at steps to configure Data Gateway after installation.
<ol style="margin-left: 0;">
 	<li style="text-align: left;">Assuming you have installed <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> using default options (Which also enables Data Gateway Service)</li>
 	<li style="text-align: left;">Search "Gateway" in your start menu and click ZappySys Data Gateway
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png" alt="Open ZappySys Data Gateway" /></a>
<p class="wp-caption-text">Opening ZappySys Data Gateway</p>

</div></li>
 	<li>First, make sure Gateway Service is running (Verify Start icon is disabled)</li>
 	<li>Also, verify Port on General Tab
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ZappySys-data-gateway-port-5000.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ZappySys-data-gateway-port-5000.png" alt="Port Number setting on ZappySys Data Gateway" /></a>
<p class="wp-caption-text">Checking port number setting on ZappySys Data Gateway</p>

</div></li>
 	<li>Now go to Users tab. <strong>Click Add</strong> icon to add a new user. Check Is admin to give access to all data sources you add in future. If you don't check admin then you have to manually configure user permission for each data source.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/zappysys-data-gateway-add-user.png">
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-5453" src="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-configure-add-user.png" alt="" width="564" height="438" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-configure-add-user.png 564w, https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-configure-add-user-300x233.png 300w" sizes="(max-width: 564px) 100vw, 564px" /></a>
<p class="wp-caption-text">Adding the Gateway user</p>

</div></li>
</ol>
&nbsp;</div>
<h3>Create new Bing Ads API Data Source in Gateway</h3>
<p>Once you setup Data Gateway user we can move to next step. To call Bing API we need to setup Connection for XML Driver in ZappySys Data Gateway.</p>
<ol>
<li>Click on Add New Data source. Name as <strong>BingAds</strong> and select <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener"><strong>Native &#8211; ZappySys XML Driver</strong></a> option.
<div id="attachment_5557" style="width: 572px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc_json_driver_add_native_driver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5557" class="size-full wp-image-5557" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc_json_driver_add_native_driver.png" alt="Add Gateway Data Source" width="562" height="539" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc_json_driver_add_native_driver.png 562w, https://zappysys.com/blog/wp-content/uploads/2018/11/odbc_json_driver_add_native_driver-300x288.png 300w" sizes="(max-width: 562px) 100vw, 562px" /></a><p id="caption-attachment-5557" class="wp-caption-text">Add Gateway Data Source</p></div></li>
<li>Now click Edit to Configure Settings. For now we will only care OAuth Connection settings. All other options are overwritten in SQL Query.
<div id="attachment_5440" style="width: 572px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5440" class="size-full wp-image-5440" src="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-2.png" alt="Edit Gateway Data Source Settings" width="562" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-2.png 562w, https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-2-300x206.png 300w" sizes="(max-width: 562px) 100vw, 562px" /></a><p id="caption-attachment-5440" class="wp-caption-text">Edit Gateway Data Source Settings</p></div></li>
<li>When UI opens Click on Load ConnectionString and Paste below connection string after changing some items (<strong>Screenshot may be differ</strong>). Make sure to replace following attributes.<strong>RefreshTokenFilePath</strong> &#8211; Enter some valid file path which will hold refresh token<br />
<strong>ClientId</strong> &#8211; get Application Id from Azure Portal under App we created earlier)<br />
<strong>DeveloperToken</strong> &#8211; Replace 1052Bxxxxxxxxxxxx with your own devloper token.</p>
<div id="attachment_7024" style="width: 996px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/zappysys-driver-load-connectionstring.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7024" class="size-full wp-image-7024" src="https://zappysys.com/blog/wp-content/uploads/2019/05/zappysys-driver-load-connectionstring.png" alt="Load ZappySys Driver ConnectionString to configure UI" width="986" height="454" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/zappysys-driver-load-connectionstring.png 986w, https://zappysys.com/blog/wp-content/uploads/2019/05/zappysys-driver-load-connectionstring-300x138.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/zappysys-driver-load-connectionstring-768x354.png 768w" sizes="(max-width: 986px) 100vw, 986px" /></a><p id="caption-attachment-7024" class="wp-caption-text">Load ZappySys Driver ConnectionString to configure UI</p></div>
<p><strong>Use below string and replace parameters </strong></p><pre class="crayon-plain-tag">DRIVER={ZappySys XML Driver};
DataPath='https://clientcenter.api.bingads.microsoft.com/Api/CustomerManagement/v13/CustomerManagementService.svc';
DataConnectionType=OAuth;
AuthUrl='https://login.microsoftonline.com/common/oauth2/v2.0/authorize';
TokenUrl='https://login.microsoftonline.com/common/oauth2/v2.0/token';
ReturnUrl='https://login.microsoftonline.com/common/oauth2/nativeclient';
RefreshTokenFilePath='c:\xxxxxx_some_folder_xxxxxxx\BingAds_RefreshToken.txt';
ScopeSeparator='{space}';
Scope='https://ads.microsoft.com/ads.manage offline_access';
ClientId='xxxxxxxxxxxxxx';
UseCustomApp=True;
RequestData='&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;s:Header&gt;
    &lt;h:ApplicationToken i:nil="true" xmlns:h="https://bingads.microsoft.com/Customer/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;h:AuthenticationToken xmlns:h="https://bingads.microsoft.com/Customer/v13"&gt;&lt;%access_token%&gt;&lt;/h:AuthenticationToken&gt;
    &lt;h:DeveloperToken xmlns:h="https://bingads.microsoft.com/Customer/v13"&gt;1052Bxxxxxxxxxxxx&lt;/h:DeveloperToken&gt;
    &lt;h:Password i:nil="true" xmlns:h="https://bingads.microsoft.com/Customer/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;h:UserName i:nil="true" xmlns:h="https://bingads.microsoft.com/Customer/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
  &lt;/s:Header&gt;
  &lt;s:Body&gt;
    &lt;GetUserRequest xmlns="https://bingads.microsoft.com/Customer/v13"&gt;
      &lt;UserId i:nil="true" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;/GetUserRequest&gt;
  &lt;/s:Body&gt;
&lt;/s:Envelope&gt;';
RequestContentTypeCode=TextXml;
RequestMethod='POST';
RequestHeaders='SOAPAction: "GetUser"'</pre><p>
</li>
<li>Next to <strong>OAuth</strong> Click on <strong>Configure Settings</strong></li>
<li>By default most of settings on OAuth connections should be pre-populated for you but still lets Notice few things. This is how to setup redirect URI</li>
<li>
<div id="attachment_7360" style="width: 1027px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/configure-oauth-redirect-url-azure-active-directory-oauth-app.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7360" class="size-full wp-image-7360" src="https://zappysys.com/blog/wp-content/uploads/2019/06/configure-oauth-redirect-url-azure-active-directory-oauth-app.png" alt="Configure Redirect URI for Bing Ads API OAuth Connection" width="1017" height="486" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/configure-oauth-redirect-url-azure-active-directory-oauth-app.png 1017w, https://zappysys.com/blog/wp-content/uploads/2019/06/configure-oauth-redirect-url-azure-active-directory-oauth-app-300x143.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/06/configure-oauth-redirect-url-azure-active-directory-oauth-app-768x367.png 768w" sizes="(max-width: 1017px) 100vw, 1017px" /></a><p id="caption-attachment-7360" class="wp-caption-text">Configure Redirect URI for Bing Ads API OAuth Connection</p></div></li>
<li>Here is where you setup <a href="https://zappysys.zendesk.com/hc/en-us/articles/115004555334-How-to-handle-Changing-OAuth-RefreshToken-in-SSIS-ODBC-" target="_blank" rel="noopener">Changing Refresh Token File path</a>. if you dont supply this path then your refresh token extracted first time will expire in 60 days.
<div id="attachment_7361" style="width: 609px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/handle-oauth-changing-refresh-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7361" class="size-full wp-image-7361" src="https://zappysys.com/blog/wp-content/uploads/2019/06/handle-oauth-changing-refresh-token.png" alt="Refresh Token File path (Only needed if API issues new Refresh Token when you request AccessToken)" width="599" height="355" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/handle-oauth-changing-refresh-token.png 599w, https://zappysys.com/blog/wp-content/uploads/2019/06/handle-oauth-changing-refresh-token-300x178.png 300w" sizes="(max-width: 599px) 100vw, 599px" /></a><p id="caption-attachment-7361" class="wp-caption-text">Refresh Token File path (Only needed if API issues new Refresh Token when you request AccessToken)</p></div></li>
<li>Once you verify all settings <strong>click</strong> <strong>Generate Token</strong> and Finish the process. It will populate <strong>AccessToken</strong> and <strong>RefreshToken</strong> Fields if everything goes well.
<div id="attachment_7359" style="width: 1054px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/configure-zppysys-bing-ads-driver-oauth-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7359" class="size-full wp-image-7359" src="https://zappysys.com/blog/wp-content/uploads/2019/06/configure-zppysys-bing-ads-driver-oauth-connection.png" alt="Configure Bing Ads API Connection (OAuth 2.0)" width="1044" height="605" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/configure-zppysys-bing-ads-driver-oauth-connection.png 1044w, https://zappysys.com/blog/wp-content/uploads/2019/06/configure-zppysys-bing-ads-driver-oauth-connection-300x174.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/06/configure-zppysys-bing-ads-driver-oauth-connection-768x445.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/06/configure-zppysys-bing-ads-driver-oauth-connection-1024x593.png 1024w" sizes="(max-width: 1044px) 100vw, 1044px" /></a><p id="caption-attachment-7359" class="wp-caption-text">Configure Bing Ads API Connection (OAuth 2.0)</p></div></li>
<li>Click OK to save OAuth Connection UI to go back to main UI</li>
<li>You can now <strong>Click Test Connection</strong> to confirm everything</li>
<li>If you need to access Gateway from Other machine then go to <strong>Firewall tab</strong> and Click Add Rule</li>
<li><strong>Click Save</strong> button <strong>on Gateway UI</strong> to save and restart the service.</li>
</ol>
<h3>Create a new Linked Server for Bing Ads API</h3>
<p>Once we setup setup Bing Ads Data Source in Gateway we can move to next step which is create a Linked Server which points to Data gateway Data source we created. This will create a bridge between ZappySys Driver and SQL Server so you can call API via T-SQL.</p>
<ol>
<li>If you are using Latest ODBC PowerPack then on Data gateway UI you will See <strong>App Integration Tab</strong>. Copy Code and run it in SSMS to create a new linked server.
<div id="attachment_7366" style="width: 774px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/data-gateway-code-generator-sql-linked-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7366" class="size-full wp-image-7366" src="https://zappysys.com/blog/wp-content/uploads/2019/06/data-gateway-code-generator-sql-linked-server.png" alt="ZappySys Data Gateway code generator for Linked Server" width="764" height="702" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/data-gateway-code-generator-sql-linked-server.png 764w, https://zappysys.com/blog/wp-content/uploads/2019/06/data-gateway-code-generator-sql-linked-server-300x276.png 300w" sizes="(max-width: 764px) 100vw, 764px" /></a><p id="caption-attachment-7366" class="wp-caption-text">ZappySys Data Gateway code generator for Linked Server</p></div></li>
<li>If things go well when you execute code you may see some result in grid.</li>
</ol>
<h3>Run sample Queries to call Bing API in SQL Server / Import Data</h3>
<p>Once Linked Server is created we can run various queries like below.</p>
<p><strong>Example-1</strong></p><pre class="crayon-plain-tag">--use all default settings from gateway data source UI
--Read
Select * from OPENQUERY( [YourLinkedServer] , 'select * from $')&amp;nbsp;

/*
--import
Select * into #tempTable from OPENQUERY( [YourLinkedServer] , 'select * from $') 
Select * from #tempTable
*/</pre><p>
<strong>Example-2</strong></p><pre class="crayon-plain-tag">--use Filter to extract specific Node from response XML
Select * from OPENQUERY( [YourLinkedServer] , 
'select * from $
WITH(Filter=''$.s:Envelope.s:Body.GetUserRequest[*]'', 
  ElementsToTreatAsArray=''GetUserResponse'' 
   )'
)</pre><p>
&nbsp;</p>
<p><strong>Example-3</strong></p><pre class="crayon-plain-tag">--Override URL, Headers and Body Settings. Change DeveloperToken in below request
--Header, Filter, URL, Request data is different for each Endpoint

SELECT * FROM OPENQUERY([YourLinkedServer]
, 'SELECT * FROM $
WITH(
	 ElementsToTreatAsArray=''GetUserResponse''
	,Src=''https://clientcenter.api.bingads.microsoft.com/Api/CustomerManagement/v13/CustomerManagementService.svc''
	,Filter=''$.s:Envelope.s:Body.GetUserResponse[*]''	
	,Header=''SOAPAction: "GetUser"''	
	,RequestData=''&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v13="https://bingads.microsoft.com/Customer/v13"&gt;
&lt;soapenv:Header&gt;
   &lt;v13:DeveloperToken&gt;1052xxxxxxxxxxxxx&lt;/v13:DeveloperToken&gt;
   &lt;v13:AuthenticationToken&gt;&lt;%access_token%&gt;&lt;/v13:AuthenticationToken&gt;
&lt;/soapenv:Header&gt;
&lt;soapenv:Body&gt;
   &lt;v13:GetUserRequest&gt;
      &lt;v13:UserId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/&gt;
   &lt;/v13:GetUserRequest&gt;
&lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;''
)')</pre><p>
&nbsp;</p>
<h3>Download Bing Ads Performance Data in SQL Server Table</h3>
<p>Now lets look at more complex example to read data from Bing Performance Report. Calling This API is tricky due to many steps involved in data extraction. But not to worry if you use ZappySys Drivers. This is API is somewhat similar as <a href="https://zappysys.com/blog/import-amazon-mws-data-sql-server-t-sql/" target="_blank" rel="noopener">Amazon MWS Report Request (See last section)</a>.</p>
<p>Here are high level steps needs to be performed to call API for Bing Ads Report (e.g. Performance Report)</p>
<ol>
<li>Call <a href="https://docs.microsoft.com/en-us/advertising/reporting-service/submitgeneratereport?view=bingads-13" target="_blank" rel="noopener">SubmitGenerateReportResponse</a> API to request new Report. This returns ReportRequestId</li>
<li>Now we have to keep checking every few seconds see report is ready or not. Call <a href="https://docs.microsoft.com/en-us/advertising/reporting-service/pollgeneratereport?view=bingads-13" target="_blank" rel="noopener">PollGenerateReport</a> until Status field is Success from Pending</li>
<li>Once previous step returns Success extract Report Download URL (Its Zip File which may contain data in CSV or XML)</li>
</ol>
<p>So lets get started to implement above login in a single T-SQL Query and load data into Table. There is a known limitation with Query Size we can send to data gateway from SSMS so we can use some tricks to read Body from File rather than hard coding in SQL. We can use IsMultiPart=True and then supply Filepath in RequestBody (Path must start with @ symbol)</p>
<ol>
<li>Bing Report API needs 2 additional values along with DeveloperToken we got earlier. You need to supply <strong>AccountId</strong> and <strong>CustomerId</strong> part of Body so obtain it by visiting below page in your bing account.<br />
Visit <a href="https://ads.microsoft.com/cc/accounts" target="_blank" rel="noopener">https://ads.microsoft.com/cc/accounts</a></p>
<div id="attachment_7362" style="width: 666px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/how-to-get-bing-ads-accountid-customerid.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7362" class="size-full wp-image-7362" src="https://zappysys.com/blog/wp-content/uploads/2019/06/how-to-get-bing-ads-accountid-customerid.png" alt="Obtain Bing Ads AccountId, ClientId for APi calls" width="656" height="556" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/how-to-get-bing-ads-accountid-customerid.png 656w, https://zappysys.com/blog/wp-content/uploads/2019/06/how-to-get-bing-ads-accountid-customerid-300x254.png 300w" sizes="(max-width: 656px) 100vw, 656px" /></a><p id="caption-attachment-7362" class="wp-caption-text">Obtain Bing Ads AccountId, ClientId for APi calls</p></div></li>
<li>Create new XML file for first step in a Notepad. Enter below content and save as <strong>C:\Requests\BingAds\sql_body1.xml</strong><br />
Replace Following Values as per your settingsCustomerAccountId (Found 2 places)<br />
CustomerId<br />
DeveloperToken<br />
<pre class="crayon-plain-tag">&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;s:Header&gt;
    &lt;h:ApplicationToken i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;h:AuthenticationToken xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;&lt;%access_token%&gt;&lt;/h:AuthenticationToken&gt;
    &lt;h:CustomerAccountId xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;481xxxxxxxxxxx&lt;/h:CustomerAccountId&gt;
    &lt;h:CustomerId xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;191xxxxxxxxxxx&lt;/h:CustomerId&gt;
    &lt;h:DeveloperToken xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;1052Bxxxxxxxxxxx&lt;/h:DeveloperToken&gt;
    &lt;h:Password i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;h:UserName i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
  &lt;/s:Header&gt;
  &lt;s:Body&gt;
    &lt;SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13"&gt;
      &lt;ReportRequest i:type="CampaignPerformanceReportRequest" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
        &lt;ExcludeColumnHeaders&gt;false&lt;/ExcludeColumnHeaders&gt;
        &lt;ExcludeReportFooter&gt;false&lt;/ExcludeReportFooter&gt;
        &lt;ExcludeReportHeader&gt;false&lt;/ExcludeReportHeader&gt;
        &lt;Format&gt;Xml&lt;/Format&gt;
        &lt;ReportName&gt;My Campaign Performance Report&lt;/ReportName&gt;
        &lt;ReturnOnlyCompleteData&gt;false&lt;/ReturnOnlyCompleteData&gt;
        &lt;Aggregation&gt;Hourly&lt;/Aggregation&gt;
        &lt;Columns&gt;
          &lt;CampaignPerformanceReportColumn&gt;TimePeriod&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;AccountId&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;CampaignId&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;CampaignName&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;CampaignStatus&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;DeviceType&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;BidMatchType&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;QualityScore&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;AdRelevance&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;LandingPageExperience&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;Revenue&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;Assists&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;ExpectedCtr&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;DeliveredMatchType&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;AveragePosition&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;Conversions&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;AdDistribution&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;Network&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;Clicks&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;Impressions&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;Ctr&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;AverageCpc&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;Spend&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;LowQualityClicks&lt;/CampaignPerformanceReportColumn&gt;
          &lt;CampaignPerformanceReportColumn&gt;LowQualityConversionRate&lt;/CampaignPerformanceReportColumn&gt;
        &lt;/Columns&gt;
        &lt;Filter&gt;
          &lt;AccountStatus i:nil="true" /&gt;
          &lt;AdDistribution i:nil="true" /&gt;
          &lt;DeviceOS i:nil="true" /&gt;
          &lt;DeviceType i:nil="true" /&gt;
          &lt;Status i:nil="true" /&gt;
        &lt;/Filter&gt;
        &lt;Scope&gt;
          &lt;AccountIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"&gt;
            &lt;a:long&gt;481xxxxxxxxxxx&lt;/a:long&gt;
          &lt;/AccountIds&gt;
          &lt;Campaigns i:nil="true" /&gt;
        &lt;/Scope&gt;
        &lt;Time&gt;
          &lt;CustomDateRangeEnd i:nil="true" /&gt;
          &lt;CustomDateRangeStart i:nil="true" /&gt;
          &lt;PredefinedTime&gt;Yesterday&lt;/PredefinedTime&gt;
          &lt;ReportTimeZone&gt;PacificTimeUSCanadaTijuana&lt;/ReportTimeZone&gt;
        &lt;/Time&gt;
      &lt;/ReportRequest&gt;
    &lt;/SubmitGenerateReportRequest&gt;
  &lt;/s:Body&gt;
&lt;/s:Envelope&gt;</pre>
&nbsp;</li>
<li>Create another XML file for second step in a Notepad. Enter below content and save as <strong>C:\Requests\BingAds\sql_body2.xml</strong><br />
Replace following values as per your need.<br />
<pre class="crayon-plain-tag">&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;s:Header&gt;
    &lt;h:ApplicationToken i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;h:AuthenticationToken xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;&lt;%access_token%&gt;&lt;/h:AuthenticationToken&gt;
    &lt;h:CustomerAccountId xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;480xxxxxxxxxxx&lt;/h:CustomerAccountId&gt;
    &lt;h:CustomerId xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;191xxxxxxxxxxx&lt;/h:CustomerId&gt;
    &lt;h:DeveloperToken xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;1052Bxxxxxxxxxxx&lt;/h:DeveloperToken&gt;
    &lt;h:Password i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;h:UserName i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
  &lt;/s:Header&gt;
  &lt;s:Body&gt;
    &lt;PollGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13"&gt;
      &lt;ReportRequestId&gt;[$a.ReportRequestId$]&lt;/ReportRequestId&gt;
    &lt;/PollGenerateReportRequest&gt;
  &lt;/s:Body&gt;
&lt;/s:Envelope&gt;</pre>
&nbsp;</li>
<li>Now try to execute below query. This should generate Performance report and download it in a SQL table for you.<br />
<pre class="crayon-plain-tag">select * into tmpBingAdsReport from OPENQUERY(Zs_BingAds,
'SELECT c.* FROM $
WITH(
	--submit report request for XML format

	 alias=''a'' 
	,Src=''https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc''
	,Filter=''$.s:Envelope.s:Body.SubmitGenerateReportResponse''
	,RequestData=''@C:\Requests\BingAds\sql_body1.xml''
	,IsMultiPart=''True''
	,RequestContentTypeCode=''TextXml''
	,Header=''SOAPAction: "SubmitGenerateReport"''
	,RequestMethod=''POST''
	,EnableBodyPlaceholderForMultiPart=''True''
	,Meta=''[{"Name": "ReportRequestId","Type": "Int64"}]''

	--keep checking status until report is ready - returns final url when done

	,join1_alias=''b''
	,join1_Filter=''$.s:Envelope.s:Body.PollGenerateReportResponse.ReportRequestStatus''
	,join1_RequestData=''@C:\Requests\BingAds\sql_body2.xml''
	,join1_IsMultiPart=''True''
	,join1_Src=''https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc''
	,join1_RequestContentTypeCode=''TextXml''
	,join1_Header=''SOAPAction: "PollGenerateReport"''
	,join1_RequestMethod=''POST''
	,join1_EnableBodyPlaceholderForMultiPart=''True''
	,join1_EnableStatusCheck=''True'', 
	,join1_StatucCheckMaxWaitSeconds=300, --wait max 5 mins?
	,join1_StatucCheckIterationWaitSeconds=5, --check every 5 sec?
	,join1_StatusSuccessValue=''Success'', --look for success word in response

	--Download report (Zip file) and Parse rows

	,join2_alias=''c''
	,join2_DataConnectionType=''Default''
	,join2_Src=''[$b.ReportDownloadUrl$]''
	,join2_Filter=''$.Report.Table.Row[*]''
	,join2_ElementsToTreatAsArray=''Row''	
	,join2_RequestMethod=''GET''
	,join2_IsMultiPart=''False''
	,join2_FileCompressionType=''Zip''	
)')

select * from tmpBingAdsReport</pre>
<div id="attachment_7218" style="width: 841px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7218" class="size-full wp-image-7218" src="https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table.png" alt="" width="831" height="741" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table.png 831w, https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table-300x268.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/06/import-bing-ads-data-into-sql-server-table-768x685.png 768w" sizes="(max-width: 831px) 100vw, 831px" /></a><p id="caption-attachment-7218" class="wp-caption-text">Import Bing Ads data into SQL Server</p></div></li>
</ol>
<h2>Multi Step Query to download Report</h2>
<p>So in previous section we saw how to write a single query to get your Performance Report from Bing Ads. However there will be time you want to split 3 steps into seperate queries.</p>
<p>Here is how to do.</p><pre class="crayon-plain-tag">/*
RPC and RPC OUT options must be turned on to run this proc

EXEC master.dbo.sp_serveroption @server=N'Zs_BingAds', @optname=N'rpc', @optvalue=N'true'
EXEC master.dbo.sp_serveroption @server=N'Zs_BingAds', @optname=N'rpc out', @optvalue=N'true'
--Below needed to support EXEC + INSERT (dynamic query)
EXEC master.dbo.sp_serveroption @server=N'Zs_BingAds, @optname=N'remote proc transaction promotion', @optvalue=N'false'
Also 
1. Change Body file path
2. Change CustomerAccountId, CustomerId, DeveloperToken
*/

ALTER proc usp_Api_BingAds_Reports
as
--///////////////////////////////////////////////////////////////////////////////
--Step-1 - submit report request for XML format
--///////////////////////////////////////////////////////////////////////////////
create table #tmpBingAdsReport_Step1(ReportRequestId bigint)
INSERT into #tmpBingAdsReport_Step1
EXEC(
'SELECT * FROM $
WITH(
 Src=''https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc''
,Filter=''$.s:Envelope.s:Body.SubmitGenerateReportResponse''
,RequestData=''@c:\BWProjects\Requests\BingAds\sql_body1.xml''
,IsMultiPart=''True''
,RequestContentTypeCode=''TextXml''
,Header=''SOAPAction: "SubmitGenerateReport"''
,RequestMethod=''POST''
,EnableBodyPlaceholderForMultiPart=''True''
,Meta=''[{"Name": "ReportRequestId","Type": "Int64"}]''
)') AT zs_BingAds


--///////////////////////////////////////////////////////////////////////////////
--Step2 - keep checking status until report is ready - returns final url when done
--///////////////////////////////////////////////////////////////////////////////

declare @reportid varchar(100)
select top 1 @reportid=cast(ReportRequestId as varchar(100)) from #tmpBingAdsReport_Step1

create table #tmpBingAdsReport_Step2(ReportDownloadUrl varchar(500))
INSERT into #tmpBingAdsReport_Step2 
EXEC(
'SELECT * FROM $
WITH(
 Filter=''$.s:Envelope.s:Body.PollGenerateReportResponse.ReportRequestStatus''
,RequestData=''&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;s:Header&gt;
    &lt;h:ApplicationToken i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;h:AuthenticationToken xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;&lt;%access_token%&gt;&lt;/h:AuthenticationToken&gt;
    &lt;h:CustomerAccountId xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;480xxxxxxxxx&lt;/h:CustomerAccountId&gt;
    &lt;h:CustomerId xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;191xxxxxxxxx&lt;/h:CustomerId&gt;
    &lt;h:DeveloperToken xmlns:h="https://bingads.microsoft.com/Reporting/v13"&gt;105xxxxxxxxxxx&lt;/h:DeveloperToken&gt;
    &lt;h:Password i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
    &lt;h:UserName i:nil="true" xmlns:h="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /&gt;
  &lt;/s:Header&gt;
  &lt;s:Body&gt;
    &lt;PollGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13"&gt;
      &lt;ReportRequestId&gt;'+ @reportid +'&lt;/ReportRequestId&gt;
    &lt;/PollGenerateReportRequest&gt;
  &lt;/s:Body&gt;
&lt;/s:Envelope&gt;''
--,IsMultiPart=''True''
,Src=''https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc''
,RequestContentTypeCode=''TextXml''
,Header=''SOAPAction: "PollGenerateReport"''
,RequestMethod=''POST''
--,EnableBodyPlaceholderForMultiPart=''True''
,EnableStatusCheck=''True'', 
,StatucCheckMaxWaitSeconds=300, --wait max 5 mins?
,StatucCheckIterationWaitSeconds=5, --check every 5 sec?
,StatusSuccessValue=''Success'', --look for success word in response
,Meta=''[{"Name": "ReportDownloadUrl","Type": "String",Length:"300"}]''
)') AT zs_BingAds


declare @reportpath varchar(500)
select top 1 @reportpath=ReportDownloadUrl from #tmpBingAdsReport_Step2

select * from #tmpBingAdsReport_Step1
select * from #tmpBingAdsReport_Step2

--///////////////////////////////////////////////////////////////////////////////
--Step-3 - Get report file
--///////////////////////////////////////////////////////////////////////////////
--Static table
--//INSERT INTO BingAdsReport
EXEC(
'SELECT * FROM $
WITH(
 DataConnectionType=''Default''
,Src='''+ @reportpath +'''
,Filter=''$.Report.Table.Row[*]''
,ElementsToTreatAsArray=''Row''	
,RequestMethod=''GET''
,IsMultiPart=''False''
,FileCompressionType=''Zip''	
)') AT zs_BingAds


--select * from tmpBingAdsReport_Step3
--select * from openquery(Bing, 'select * from $')


/*
select * into tmpBingAdsReport from OPENQUERY(zs_BingAds,
'SELECT c.* FROM $
WITH(
--submit report request for XML format

alias=''a'' 
,Src=''https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc''
,Filter=''$.s:Envelope.s:Body.SubmitGenerateReportResponse''
,RequestData=''@c:\BWProjects\Requests\BingAds\sql_body1.xml''
,IsMultiPart=''True''
,RequestContentTypeCode=''TextXml''
,Header=''SOAPAction: "SubmitGenerateReport"''
,RequestMethod=''POST''
,EnableBodyPlaceholderForMultiPart=''True''
,Meta=''[{"Name": "ReportRequestId","Type": "Int64"}]''

--keep checking status until report is ready - returns final url when done

,join1_alias=''b''
,join1_Filter=''$.s:Envelope.s:Body.PollGenerateReportResponse.ReportRequestStatus''
,join1_RequestData=''@c:\BWProjects\Requests\BingAds\sql_body2.xml''
,join1_IsMultiPart=''True''
,join1_Src=''https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc''
,join1_RequestContentTypeCode=''TextXml''
,join1_Header=''SOAPAction: "PollGenerateReport"''
,join1_RequestMethod=''POST''
,join1_EnableBodyPlaceholderForMultiPart=''True''
,join1_EnableStatusCheck=''True'', 
,join1_StatucCheckMaxWaitSeconds=300, --wait max 5 mins?
,join1_StatucCheckIterationWaitSeconds=5, --check every 5 sec?
,join1_StatusSuccessValue=''Success'', --look for success word in response

--Download report (Zip file) and Parse rows

,join2_alias=''c''
,join2_DataConnectionType=''Default''
,join2_Src=''[$b.ReportDownloadUrl$]''
,join2_Filter=''$.Report.Table.Row[*]''
,join2_ElementsToTreatAsArray=''Row''	
,join2_RequestMethod=''GET''
,join2_IsMultiPart=''False''
,join2_FileCompressionType=''Zip''	
)')

select * from tmpBingAdsReport

select * from openquery(Bing, 'select * from $')
*/
go</pre><p>
&nbsp;</p>
<h2>Conclusion</h2>
<p>In this article we saw how to import Bing Ads API data in SQL Server without any coding using <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack (SOAP / XML Driver)</a>. Download it it and try it for FREE to explore many API integration features not discussed in this article.</p>
<p>The post <a href="https://zappysys.com/blog/import-bing-ads-data-sql-server-performance-reports/">Import Bing Ads data into SQL Server (Performance Reports)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to import Amazon MWS data into SQL Server (T-SQL)</title>
		<link>https://zappysys.com/blog/import-amazon-mws-data-sql-server-t-sql/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 30 May 2019 15:37:37 +0000</pubDate>
				<category><![CDATA[CSV File / REST API Driver]]></category>
		<category><![CDATA[ODBC Gateway]]></category>
		<category><![CDATA[T-SQL (SQL Server)]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[Amazon MWS]]></category>
		<category><![CDATA[linked server]]></category>
		<category><![CDATA[openquery]]></category>
		<category><![CDATA[t-sql]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6961</guid>

					<description><![CDATA[<p>Introduction In our previous blog post we saw how to import rest API in SQL Server. Using same concepts lets look at how to import Amazon MWS Data into SQL Server. We will explore many techniques to call Amazon MWS API and learn how to automate Amazon MWS data extraction without doing any ETL. We [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/import-amazon-mws-data-sql-server-t-sql/">How to import Amazon MWS data into SQL Server (T-SQL)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<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;">
<strong><span style="vertical-align: text-bottom;font-size: 0.86em;">⚠️</span> Deprecation Notice: MWS API is deprecated</strong><br />
Amazon&#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 />
</div></div>
<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="98" height="98" 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: 98px) 100vw, 98px" /></a>In our previous blog post we saw how to <a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">import rest API in SQL Server</a>. Using same concepts lets look at how to import Amazon MWS Data into SQL Server. We will explore many techniques to call Amazon MWS API and learn how to automate Amazon MWS data extraction without doing any ETL. We will call MWS XML or CSV API just using T-SQL code. We will also learn how to Download Reports from by calling MWS API.</p>
<p>You can also refer other articles <a href="https://zappysys.com/blog/import-amazon-mws-data-power-bi/" target="_blank" rel="noopener">here (Power BI)</a> and <a href="https://zappysys.com/blog/call-amazon-mws-api-using-ssis-marketplace-web-service/" target="_blank" rel="noopener">here (SSIS)</a></p>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-7048"><h2>Requirements</h2>
This article talks about few tools and techniques in order to load API data in SQL Server. Please make sure following prerequisites are met.
<ol>
 	<li>Download and Install <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> (This includes XML / JSON / REST API and few other drivers for SQL Server and ODBC connectivity in tools like Excel, Power BI, SSRS)</li>
 	<li>Make sure you have access to SQL Server Instance. If you cant find one still want to try what is mentioned in this article then install <a href="https://www.microsoft.com/en-us/sql-server/sql-server-editions-express" target="_blank" rel="noopener">FREE SQL Express Edition</a></li>
 	<li>Confirm that you have SSMS Installed. If you don't have then you can download <a href="https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017">from here</a>.</li>
</ol></div>
<h2></h2>
<h2>About Amazon MWS  API</h2>
<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>
<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>
<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> see throttling section. Also <a href="https://docs.developer.amazonservices.com/en_IT/dev_guide/DG_Throttling.html">this one</a>).</div></div>
<h2>Obtain MWS API Access Key / Secret and Seller ID</h2>
<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>
<p>Here is where to look for your Merchant ID and Key / Secret.  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>
<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>
<h2>Getting Started</h2>
<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  <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> so make sure it&#8217;s installed first.</p>
<h3>Using ScratchPad to Test Amazon MWS API</h3>
<p>Each MWS API has set of required and optional parameters. You can refer each API page for details. For example <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 online 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>
<ol>
<li>Open <a href="https://mws.amazonservices.com/scratchpad/index.html" target="_blank" rel="noopener">MWS ScratchPad</a>  by vising <strong>https://mws.amazonservices.com/scratchpad/index.html</strong></li>
<li>Select <strong>Products</strong> API category and pick <strong>ListMatchingProducts</strong> API</li>
<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.
<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>
<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>
<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>
</ol>
<p>This API requires Market ID parameter so enter it as per your Market where you selling. For example USA marketplaceid = ATVPDKIKX0DER. 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>
<h3></h3>
<h2>Setup Amazon MWS API Connections</h2>
<div class="content_block" id="custom_post_widget-5411"><h3><span style="font-size: 14pt;">Configure ZappySys Data Gateway</span></h3>
Now let's look at steps to configure Data Gateway after installation.
<ol style="margin-left: 0;">
 	<li style="text-align: left;">Assuming you have installed <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> using default options (Which also enables Data Gateway Service)</li>
 	<li style="text-align: left;">Search "Gateway" in your start menu and click ZappySys Data Gateway
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png" alt="Open ZappySys Data Gateway" /></a>
<p class="wp-caption-text">Opening ZappySys Data Gateway</p>

</div></li>
 	<li>First, make sure Gateway Service is running (Verify Start icon is disabled)</li>
 	<li>Also, verify Port on General Tab
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ZappySys-data-gateway-port-5000.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ZappySys-data-gateway-port-5000.png" alt="Port Number setting on ZappySys Data Gateway" /></a>
<p class="wp-caption-text">Checking port number setting on ZappySys Data Gateway</p>

</div></li>
 	<li>Now go to Users tab. <strong>Click Add</strong> icon to add a new user. Check Is admin to give access to all data sources you add in future. If you don't check admin then you have to manually configure user permission for each data source.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/zappysys-data-gateway-add-user.png">
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-5453" src="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-configure-add-user.png" alt="" width="564" height="438" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-configure-add-user.png 564w, https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-configure-add-user-300x233.png 300w" sizes="(max-width: 564px) 100vw, 564px" /></a>
<p class="wp-caption-text">Adding the Gateway user</p>

</div></li>
</ol>
&nbsp;</div>
<h3>Create XML Driver Connection for Amazon MWS API (e.g. RequestReport )</h3>
<p>Some APIs we need to call in this article is XML format and some API (e.g. GetReport) is CSV format &#8211; Tab delimited so we need to create 2 different connections using CSV driver and XML driver. So lets get started with Amazon MWS Connection for XML API.</p>
<ol>
<li>Click on Add New Data source. Name as <strong>AMAZON-MWS-XML</strong> and select <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener"><strong>Native &#8211; ZappySys XML Driver</strong></a> option.
<div id="attachment_5557" style="width: 572px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc_json_driver_add_native_driver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5557" class="size-full wp-image-5557" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc_json_driver_add_native_driver.png" alt="Add Gateway Data Source" width="562" height="539" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc_json_driver_add_native_driver.png 562w, https://zappysys.com/blog/wp-content/uploads/2018/11/odbc_json_driver_add_native_driver-300x288.png 300w" sizes="(max-width: 562px) 100vw, 562px" /></a><p id="caption-attachment-5557" class="wp-caption-text">Add Gateway Data Source</p></div></li>
<li>Now click Edit to Configure Settings. For now we will only care OAuth Connection settings. All other options are overwritten in SQL Query.
<div id="attachment_5440" style="width: 572px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5440" class="size-full wp-image-5440" src="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-2.png" alt="Edit Gateway Data Source Settings" width="562" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-2.png 562w, https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-2-300x206.png 300w" sizes="(max-width: 562px) 100vw, 562px" /></a><p id="caption-attachment-5440" class="wp-caption-text">Edit Gateway Data Source Settings</p></div></li>
<li>When UI opens for Driver 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.<br />
<pre class="crayon-plain-tag">https://mws.amazonservices.com/Products/2011-10-01</pre>
</li>
<li>Select <strong>OAuth</strong> from the Connection dropdown and Click <strong>Configure Settings</strong></li>
<li>On the Connection UI, Select OAuth Provider <strong>Amazon Market Web Service (MWS)</strong></li>
<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>
<li>Your connection will look like below.
<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>
<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.
<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>
<li>Click OK to save OAuth Connection UI to go back to main UI</li>
<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>
<li>Click OK to Save UI</li>
<li>Click Save button on Gateway UI to save and restart</li>
</ol>
<h3>Create CSV Driver Connection for Amazon MWS API (e.g. GetReport )</h3>
<p>Now lets create a connection CSV API (e.g. <a href="https://docs.developer.amazonservices.com/en_UK/reports/Reports_GetReport.html" target="_blank" rel="noopener">GetReport</a> ).</p>
<p>Follow almost same steps as previous section except use CSV Driver when you click on Add new Data source select <strong><a href="https://zappysys.com/products/odbc-powerpack/odbc-csv-rest-api-driver/" target="_blank" rel="noopener">Native &#8211; ZappySys CSV Driver</a></strong> and name data source as <strong>AMAZON-MWS-CSV</strong> . As we mentioned for now we mostly want to setup Connection and not worry about Request Body, Pagination etc.</p>
<h3>Create Linked Server for SQL Server</h3>
<p>Run following Script in SSMS to create Linked servers. Change ######## with Your gateway password. Change localhost with machine name or IP where ZappySys Gateway Is running. Use localhost if SQL Server and Gateway both on the same machine.</p><pre class="crayon-plain-tag">USE [master]
GO

EXEC master.dbo.sp_addlinkedserver @server = N'AMAZON-MWS-XML', @srvproduct=N'', @provider=N'SQLNCLI', @datasrc=N'localhost,5000', @catalog=N'AMAZON-MWS-XML'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'AMAZON-MWS-XML',@useself=N'False',@locallogin=NULL,@rmtuser=N'tdsuser',@rmtpassword='########'
GO

EXEC master.dbo.sp_addlinkedserver @server = N'AMAZON-MWS-CSV', @srvproduct=N'', @provider=N'SQLNCLI', @datasrc=N'localhost,5000', @catalog=N'AMAZON-MWS-CSV'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'AMAZON-MWS-CSV',@useself=N'False',@locallogin=NULL,@rmtuser=N'tdsuser',@rmtpassword='########'
GO</pre><p>
If you want to know how to configure Linked Server using UI then <a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">check this article</a>.</p>
<p>&nbsp;</p>
<h2>Amazon MWS ListOrders Example</h2>
<p>Now lets look at how to call ListOrders request with pagination in SQL Server. Create a following Stored Procedure to List MWS Orders. If you want to extract many orders then call Report rather than this proc (See next section for generating reports)</p><pre class="crayon-plain-tag">USE MyDatabase
GO
/*
Example: 
 exec usp_MWS_ListOrders @SellerId='Axxxxxxx', @MarketplaceId ='Bxxxxxxx',@CreatedAfter='2019-01-01'  
*/
Create proc [dbo].[usp_MWS_ListOrders]
	@SellerId varchar(100),
	@MarketplaceId varchar(100),
	@CreatedAfter varchar(100),
	@CreatedBefore varchar(100)=null,
	@MaxRows int=0
as
declare @sql varchar(max) 
declare @limitClase varchar(100)=''
if(@MaxRows&gt;0)
	set @limitClase	=' LIMIT ' + cast(@MaxRows as varchar(20))

--//Confirm ISO Date format 2019-06-01T04%3A00%3A00Z  rather 2019-06-01T04:00:00Z
if(isnull(@CreatedAfter,'')&lt;&gt;'')
begin
	set @CreatedAfter='&amp;CreatedAfter=' + @CreatedAfter
	set @CreatedAfter=replace(@CreatedAfter,':','%3A')
	if(@CreatedAfter NOT LIKE @CreatedAfter + 'T%')
		set @CreatedAfter=@CreatedAfter + 'T00%3A00%3A00Z'
	if(@CreatedAfter NOT LIKE @CreatedAfter + '%Z')
		set @CreatedAfter=@CreatedAfter + 'Z'
	--//T04%3A00%3A00Z
end
if(isnull(@CreatedBefore,'')&lt;&gt;'')
begin
	set @CreatedBefore='&amp;CreatedBefore=' + @CreatedBefore
	set @CreatedBefore=replace(@CreatedBefore,':','%3A')
	if(@CreatedBefore NOT LIKE @CreatedBefore + 'T%')
		set @CreatedBefore=@CreatedBefore + 'T00%3A00%3A00Z'
	if(@CreatedBefore NOT LIKE @CreatedBefore + '%Z')
		set @CreatedBefore=@CreatedBefore + 'Z'
end

set @CreatedAfter = isnull(@CreatedAfter,'')
set @CreatedBefore = isnull(@CreatedBefore,'')


set @sql = 'SELECT * FROM OPENQUERY([AMAZON-MWS-XML]
, ''
SELECT ReportRequestId FROM $
' + @limitClase +' 
WITH(
     Src=''''https://mws.amazonservices.com/Orders/2013-09-01''''
	,Filter=''''$.RequestReportResponse.RequestReportResult.ReportRequestInfo''''
	,ElementsToTreatAsArray=''''Order''''
	,RequestData=''''Action=ListOrders[$tag$]' + @CreatedAfter + @CreatedBefore + '&amp;MarketplaceId.Id.1='+ @MarketplaceId +'&amp;SellerId='+ @SellerId +'''''
	,RequestMethod=''''POST''''
	,NextUrlAttributeOrExpr=''''$.ListOrders[$tag$]Response.ListOrders[$tag$]Result.NextToken''''
	,NextUrlSuffix=''''&amp;NextToken=&lt;%nextlink_encoded%&gt;''''
	,WaitTimeMs=20000 -- slow down to avoid throttling. 6 requests per min
	,HasDifferentNextPageInfo=''''True''''
	,EnablePageTokenForBody=''''True''''
	,PagePlaceholders=''''body=|ByNextToken;filter=|ByNextToken''''
	--,DataConnectionType=''''OAuth''''
	--,ScopeSeparator=''''{space}''''
	--,ServiceProvider=''''AmazonMWS''''
	--,ClientId=''''AKIxxxxxx''''
	--,ClientSecret=''''AKIxxxxxx''''
	--,UseCustomApp=''''True''''
	,CacheFileLocation=''''c:\temp\mws-orders.cache''''
	,CacheEntryTtl=300 --send every 5 mins else use from cache
	,IncludeParentColumns=''''False''''
)
'')'
print @sql

EXECUTE( @sql)</pre><p>
Here is how to call this proc. Change SellerId, MarketplaceId and Date.</p><pre class="crayon-plain-tag">exec usp_MWS_ListOrders @SellerId='Axxxxxxx', @MarketplaceId ='Bxxxxxxx',@CreatedAfter='2019-01-01'</pre><p>
&nbsp;</p>
<h2>Download Amazon MWS Report data in SQL Server (CSV / XML Format)</h2>
<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> (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  until its done. Once Report ready you have to read in CSV format or XML. Some Reports only available in CSV format. <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>
<ol>
<li>Create a new report request &#8211; Cal <a href="https://docs.developer.amazonservices.com/en_UK/reports/Reports_RequestReport.html" target="_blank" rel="noopener">RequestReport</a> API . It returns <strong>ReportRequestId</strong> (You can use it in the next step)</li>
<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> API (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>  or <strong>_DONE_NO_DATA_</strong> status in response.</li>
<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>
</ol>
<h3>Method 1 &#8211; Single query approach (New Driver)</h3>
<p>In new driver ZappySys added few new features which makes it possible to call above 3 steps process in a single query. New query syntax offers StatusCheck and Mixing Content Formats using same driver. Because Most MWS Reports are in CSV Format we have to use CSV Driver but oddly first 2 steps listed in above sections are in XML Format so we have to use XML driver. Technically we need atleast 2 steps (i.e 2 queries) but we will show you how to achieve using single query as below.</p>
<ol>
<li>Assuming you have followed steps to create a linked server AMAZON-MWS-CSV (see previous section)</li>
<li>Run below query. Replace necessary parameters as per your need. (i.e MarketplaceId , SellerId, CreatedAfter date)<br />
<pre class="crayon-plain-tag">--- //////////////////////////////////////////////////////////////////////////
-- 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
-- Replace MarketplaceId in all 3 steps (i.e for USA use ATVPDKIKX0DER) --https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html
-- Replace SellerId in all 3 steps
-- Remove or Change CreatedAfter in first step (or use CreatedBefore parameter instread of CreatedAfter)
--- //////////////////////////////////////////////////////////////////////////
select * into tmpMWS_Report from OPENQUERY([AMAZON-MWS-CSV],
'
SELECT s3.* FROM $
WITH(
Src=''https://mws.amazonservices.com/Reports/2009-01-01'',RequestMethod=''POST''
,RequestData=''Action=RequestReport&amp;ReportType=_GET_MERCHANT_LISTINGS_DATA_&amp;MarketplaceId=ATVPDKIKX0DER&amp;SellerId=Axxxxxxxxxx&amp;CreatedAfter=2017-12-31T04%3A00%3A00Z''
,IncludeParentColumns=''False''
,EnableRawOutputModeSingleRow=''True''
,RawOutputFilterExpr=''//*[local-name()="ReportRequestId"]'' 
,RawOutputDataRowTemplate=''{ReportRequestId:"[$1]"}'' 
,RawOutputExtractMode=''Xml'' 
,WaitTimeMs=5000
,Meta=''[{"Name": "ReportRequestId","Type": "Int64"}]''
,Alias=''s1''

,Join1_alias=''s2''	
,Join1_Src=''https://mws.amazonservices.com/Reports/2009-01-01'',Join1_RequestMethod=''POST''
,Join1_RequestData=''Action=GetReportRequestList&amp;ReportRequestIdList.Id.1=[$s1.ReportRequestId$]&amp;MarketplaceId=ATVPDKIKX0DER&amp;SellerId=Axxxxxxxxxxxxx''
,Join1_EnableRawOutputModeSingleRow=''True''
,Join1_RawOutputFilterExpr=''//*[local-name()="ReportProcessingStatus"]||//*[local-name()="GeneratedReportId"]'' 
,Join1_RawOutputDataRowTemplate=''{ReportProcessingStatus:"[$1]",GeneratedReportId:"[$2]"}'' 
,Join1_RawOutputExtractMode=''Xml'' 
,Join1_EnableStatusCheck=''True'', 
,Join1_StatucCheckMaxWaitSeconds=300,
,Join1_StatucCheckIterationWaitSeconds=25,
,Join1_StatusSuccessValue=''_DONE_''
,Join1_StatusFailedValue=''_DONE_NO_DATA_|_CANCELLED_''

,Join2_Alias=''s3''
,Join2_Src=''https://mws.amazonservices.com/Reports/2009-01-01'',Join2_RequestMethod=''POST''
,Join2_RequestData=''Action=GetReport&amp;ReportId=[$s2.GeneratedReportId$]&amp;MarketplaceId=ATVPDKIKX0DER&amp;SellerId=Axxxxxxxxxxxxxx''	
,Join2_ColumnDelimiter=''{TAB}''
,Join2_ResponseCharset=''Windows-1252''	 
,Join2_EnableStatusCheck=''False'' 
,Join2_EnableRawOutputModeSingleRow=''False''
,Join2_WaitTimeMs=10000
)') 
go
select * from tmpMWS_Report</pre>
&nbsp;</li>
</ol>
<p>&nbsp;</p>
<p><strong>Performance Tip</strong></p>
<p>If you like to improve performance and dont want to use SELECT INTO approach to load into temp table as above then you can use EXEC (&#8230;.) AT YourLinkedServerName  as below.</p>
<p>Advantage of this method is your Query speed will increase because system calls API only once when you call EXEC AT. In OPENROWSET it needs to call above query twice (Once to obtain metadata and once to get data).</p><pre class="crayon-plain-tag">INSERT INTO tmpMWS_Report
EXEC('select s3.* .................. ') AT [AMAZON-MWS-CSV]</pre><p>
<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;">When you use OPENQUERY / EXEC..AT with Data Gateway there is a known limitation with SQL Query Length. Your query must be less than 2048 characters otherwise you may get [**** Data is invalid error ****] Try to avoid column names for long query and use SELECT * INTO temp_table FROM OPENQUERY(&#8230;..) approach. </div></div>
<p>&nbsp;</p>
<h3>Method 2 &#8211; Multiple query approach (For old driver)</h3>
<p>Now lets see how to load Amazon MWS data in SQL Server using <strong>old driver</strong> (<strong>v1.1.2 or older</strong>) which didnt support single query approach like previous section. If you are using older driver or for some reason you like to split steps into multiple procedures then use below approach.</p>
<h4>usp_MWS_Report  Stored Proc ( Generate ReportRequest, Wait until done, Read data )</h4>
<pre class="crayon-plain-tag">USE MyDatabase
GO

/*
Examples: 
Get ReportType from here https://docs.developer.amazonservices.com/en_UK/reports/Reports_ReportType.html

exec usp_MWS_Report @MarketplaceId ='ATVPDKIKX0DER', @SellerId='AZxxxxxxxx', @ReportType = '_GET_MERCHANT_LISTINGS_DATA_'
exec usp_MWS_Report @MarketplaceId ='ATVPDKIKX0DER', @SellerId='AZxxxxxxxx', @ReportType = '_GET_FLAT_FILE_ORDER_REPORT_DATA_'

--Do not Throw Error if no data found (return empty resultset or run custom sql)
exec usp_MWS_Report @MarketplaceId ='ATVPDKIKX0DER', @SellerId='AZxxxxxxxx', @ReportType = '_GET_FLAT_FILE_ORDER_REPORT_DATA_',@ThrowErrIfNoData=0,@EmptyRowSql='select top 0 * from Orders'
--Supply date range
exec usp_MWS_Report @MarketplaceId ='ATVPDKIKX0DER', @SellerId='AZxxxxxxxx', @ReportType = '_GET_MERCHANT_LISTINGS_DATA_', @StartDate='2019-01-01T00:00:00Z', @EndDate='2019-01-31T00:00:00Z'

--loading into table 

--//////////////////////////////////
— Step-1 : Create Local Linked server to point to self
--//////////////////////////////////
USE [master]
GO
--change default catalog
--For MSSQL 2012, 2014, 2016, 2017, and 2019 use @provider=N'MSOLEDBSQL' below (SQL Server Native Client 11.0)---
EXEC master.dbo.sp_addlinkedserver @server = N'ME', @srvproduct=N'', @provider=N'SQLNCLI11', @datasrc=N'localhost', @catalog=N'Northwind'
--For MSSQL 2022 or higher use @provider=N'MSOLEDBSQL' below (Microsoft OLE DB Driver for SQL Server)---
--EXEC master.dbo.sp_addlinkedserver @server = N'ME', @srvproduct=N'', @provider=N'MSOLEDBSQL', @datasrc=N'localhost', @catalog=N'Northwind'

EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'ME',@useself=N'True',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL
GO
--//////////////////////////////////
— Step-2 : Enable RPC OUT and Disable MSDTC
--//////////////////////////////////
EXEC sp_serveroption 'ME', 'rpc out', true;  
GO
--Below needed to support EXEC + INSERT (dynamic query)
EXEC sp_serveroption 'ME', 'remote proc transaction promotion', false;
GO
--test simple query
select * from OPENQUERY(ME,'select 1')
GO

--//////////////////////////////////
— Step-3 : Load data into table from MWS Report
--//////////////////////////////////
SELECT * INTO #amazon_mws_report
FROM OPENQUERY(me,'
SET NOCOUNT ON;
EXEC usp_MWS_Report 
   @Columns=''[item-name], [item-description], [listing-id]'',
   @MarketplaceId =''ATVPDKIKX0DER'', 
   @SellerId=''Axxxxxxxxxxxxxxxxx'', 
   @ReportType = ''_GET_MERCHANT_LISTINGS_DATA_''
WITH RESULT SETS 
(
	(itmname varchar(1000),itmdesc varchar(1000),itmid varchar(1000))
)
')

select * from #amazon_mws_report


*/
CREATE proc [dbo].[usp_MWS_Report]
	@MarketplaceId varchar(100),
	@SellerId varchar(100),
	@ReportType varchar(100)='_GET_MERCHANT_LISTINGS_DATA_',
	@StartDate varchar(100)=null,
	@EndDate varchar(100)=null,
	@ReportId bigint=null,  ---i.e. 14783134522018025
	@ThrowErrIfNoData bit=1,
	@EmptyRowSql varchar(1000)=null, --SQL to run if no data found
	@Columns varchar(8000)='*'  --report columns which goes in final SELECT  e.g. [item-name], [item-description], [listing-id] ....
as


declare @retGeneratedReportId bigint
set @retGeneratedReportId=@ReportId
---////// STEP 1 /////////
if(@ReportId is null)
begin
	create table #step1(ReportRequestId bigint)
	insert into #step1
	exec usp_MWS_RequestReport @ReportType,@MarketplaceId,@SellerId,@StartDate,@EndDate

	--select * from #step1 --debug

	declare @retReportRequestId bigint
	select @retReportRequestId=ReportRequestId from #step1

	---////// STEP 2 /////////
	declare @status varchar(100)
	declare @cnt int
	create table #step2(ReportProcessingStatus varchar(100),GeneratedReportId bigint)
	
	--Keep looping until status is done or we waited too long
	while(isnull(@status,'') IN ('','_SUBMITTED_','_IN_PROGRESS_') )
	begin
		truncate table #step2
		insert into #step2
		exec usp_MWS_GetReportIdAndStatus @retReportRequestId,@MarketplaceId,@SellerId 
	
		select @status=ReportProcessingStatus, @retGeneratedReportId=GeneratedReportId from #step2
		if(isnull(@status,'') IN ('','_SUBMITTED_','_IN_PROGRESS_') )			
		begin
			--amazon says dont check often https://docs.developer.amazonservices.com/en_UK/reports/Reports_GetReportRequestList.html
			Print 'Status='+  isnull(@status,'') +'. Checking after 45 sec... #' + cast(@cnt as varchar(10))
			WAITFOR DELAY '00:00:45'			
		end
		else
			print @status

		set @cnt=@cnt+1

		--if(@cnt&gt;50)
			--//throw err?
	end
	--select * from #step2 --debug
end

if(@retGeneratedReportId is null and @status='_DONE_NO_DATA_')
begin
	if(@ThrowErrIfNoData=1)
		RAISERROR('Cannot generate report - No data found for specified criteria',16,1); 
	else if (isnull(@EmptyRowSql,'')&lt;&gt;'')
		execute(@EmptyRowSql)
end
else if(@retGeneratedReportId is null)
	RAISERROR('Cannot generate report - Unknown error (either report got cancelled or other error occurred)',16,1); 

	
---////// STEP 3 /////////
--If xml format of report data then use XML driver else CSV (most are Tab delimited reports in CSV format)
--exec usp_MWS_GetReportDataXml @retGeneratedReportId,@MarketplaceId,@SellerId
exec usp_MWS_GetReportDataCsv @retGeneratedReportId,@MarketplaceId,@SellerId,@Columns

drop table #step1
drop table #step2

GO</pre>
&nbsp;</p>
<h4>usp_MWS_RequestReport  Stored Proc ( Step1 &#8211; Create Report Request )</h4>
<p>&nbsp;</p><pre class="crayon-plain-tag">USE [MyDatabase]
GO

CREATE proc [dbo].[usp_MWS_RequestReport]
	@ReportType varchar(100),
	@MarketplaceId varchar(100),
	@SellerId varchar(100),
	@StartDate varchar(100)=null,
	@EndDate varchar(100)=null
as

/*Learn more : https://docs.developer.amazonservices.com/en_UK/reports/Reports_RequestReport.html */

--//Confirm ISO Date format 2019-06-01T04%3A00%3A00Z  rather 2019-06-01T04:00:00Z
if(isnull(@StartDate,'')&lt;&gt;'')
begin
	set @StartDate='&amp;StartDate=' + @StartDate
	set @StartDate=replace(@StartDate,':','%3A')
	if(@StartDate NOT LIKE @StartDate + 'T%')
		set @StartDate=@StartDate + 'T00%3A00%3A00Z'
	if(@StartDate NOT LIKE @StartDate + '%Z')
		set @StartDate=@StartDate + 'Z'
	--//T04%3A00%3A00Z
end
if(isnull(@EndDate,'')&lt;&gt;'')
begin
	set @EndDate='&amp;EndDate=' + @EndDate
	set @EndDate=replace(@EndDate,':','%3A')
	if(@EndDate NOT LIKE @EndDate + 'T%')
		set @EndDate=@EndDate + 'T00%3A00%3A00Z'
	if(@EndDate NOT LIKE @EndDate + '%Z')
		set @EndDate=@EndDate + 'Z'
end

set @StartDate = isnull(@StartDate,'')
set @EndDate = isnull(@EndDate,'')

declare @sql varchar(max) 
set @sql = 'SELECT * FROM OPENQUERY([AMAZON-MWS-XML]
, ''
SELECT ReportRequestId FROM $
WITH(
	Src=''''https://mws.amazonservices.com/Reports/2009-01-01'''',RequestMethod=''''POST''''
	--,ElementsToTreatAsArray=''''Product''''
	,Filter=''''$.RequestReportResponse.RequestReportResult.ReportRequestInfo''''
	,RequestData=''''Action=RequestReport&amp;ReportType=' + @ReportType  + '&amp;MarketplaceId='+ @MarketplaceId +'&amp;SellerId='+ @SellerId + @StartDate + @EndDate +'''''
	,CacheFileLocation=''''c:\temp\mws-cache-step-1.cache''''
	,CacheEntryTtl=300 --send every 5 mins else use from cache
	,WaitTimeMs=''''300''''
	,IncludeParentColumns=''''False''''
	,Meta=''''[{"Name": "ReportRequestId","Type": "Int64"}]''''
)'')'
--print @sql

EXECUTE( @sql)
--sleep 25 seconds after this - hope report is ready by that time else We have to loop
WAITFOR DELAY '00:00:25'  --lets wait 30 sec... incase we get luck and report is done?
GO</pre><p>
&nbsp;</p>
<p>&nbsp;</p>
<h4>usp_MWS_GetReportIdAndStatus Stored Proc ( Step2 &#8211; Get Report Id and Report Status )</h4>
<p>&nbsp;</p><pre class="crayon-plain-tag">USE MyDatabase
GO


CREATE proc [dbo].[usp_MWS_GetReportIdAndStatus]
	@ReportRequestId bigint,
	@MarketplaceId varchar(100),
	@SellerId varchar(100)
as

declare @sql varchar(max) 
set @sql = 'SELECT * FROM OPENQUERY([AMAZON-MWS-XML]
, ''SELECT *  FROM $
WITH(
	 Src=''''https://mws.amazonservices.com/Reports/2009-01-01'''',RequestMethod=''''POST''''
	,ElementsToTreatAsArray=''''ReportRequestInfo''''
	,Filter=''''$.GetReportRequestListResponse.GetReportRequestListResult.ReportRequestInfo''''
	,RequestData=''''Action=GetReportRequestList&amp;ReportRequestIdList.Id.1=' + cast(@ReportRequestId as varchar(20)) + '&amp;MarketplaceId='+ @MarketplaceId +'&amp;SellerId='+ @SellerId +'''''
	,WaitTimeMs=''''300''''
	,IncludeParentColumns=''''False''''
	--,CacheFileLocation=''''c:\temp\mws-cache-step-2.cache''''
	--,CacheEntryTtl=10  --do not use from cache too old.. but cache still prevents too many requests
	,Meta=''''[{"Name": "ReportProcessingStatus","Type": "String", Length: 100},{"Name": "GeneratedReportId","Type": "Int64"}]''''	
)'')'

--print @sql

EXECUTE( @sql)

GO</pre><p>
&nbsp;</p>
<h4>usp_MWS_GetReportDataCsv Stored Proc (Step3 &#8211; Get Report Data in CSV format )</h4>
<p>Last step in report generation is download the report data in CSV format.</p><pre class="crayon-plain-tag">USE MyDatabase
GO

CREATE proc [dbo].[usp_MWS_GetReportDataCsv]
	@ReportId bigint,
	@MarketplaceId varchar(100),
	@SellerId varchar(100),
	@Columns varchar(8000)='*'

as

declare @sql varchar(max) 
set @sql = 'SELECT '+ @Columns +' FROM OPENQUERY([AMAZON-MWS-CSV], 
''SELECT * FROM $
WITH(
    Src=''''https://mws.amazonservices.com/Reports/2009-01-01'''',RequestMethod=''''POST''''
	,RequestData=''''Action=GetReport&amp;ReportId=' + cast(@ReportId as varchar(20)) + '&amp;MarketplaceId='+ @MarketplaceId +'&amp;SellerId='+ @SellerId +'''''
	,WaitTimeMs=''''300''''
	,ColumnDelimiter=''''{TAB}''''
	,ResponseCharset=''''Windows-1252''''	
	,CacheFileLocation=''''c:\temp\mws-cache-step-3.cache''''
	,CacheEntryTtl=300 --once report is generated lets try to read from cache 
	)''
)'

print @sql

EXECUTE( @sql)
GO</pre><p>
&nbsp;</p>
<h4>Example &#8211; Import data from Amazon MWS into SQL Server Table</h4>
<p>Finally when we have all stored procs created we can load into target table as below. In our previous article we saw how to use SELECT INTO along with OPENQUERY to load data into new temp table or insert into some existing table. However when you want to load Stored Proc output into table its not straight forward specially when we calling dynamic SQL.</p>
<p>Three tricks worth mentioning here which makes it possible to load data from stored proc into temp table dynamically.</p>
<ol>
<li>Create a linked server to Self so we can use OPENQUERY against to call stored proc so its easy to use <strong>SELECT INTO</strong>.</li>
<li>Use <strong>WITH RESULT SETS</strong> to describe metadata of output. This is needed because we are using dynamic SQL inside proc and WITH RESULT SETS describes the metadata.</li>
<li>Use of SET NO COUNT ON to avoid error like below<br />
<pre class="crayon-plain-tag">"SOMESERVERNAME" indicates that either the object has no columns 
or the current user does not have permissions on that object</pre>
</li>
<li>If you dont do above tricks then you may see errors like <a href="https://stackoverflow.com/questions/3795263/errors-insert-exec-statement-cannot-be-nested-and-cannot-use-the-rollback-s" target="_blank" rel="noopener">this</a> (INSERT is not allowed when we use DYNAMIC SQL inside nested Stored Procs)</li>
</ol>
<p>To load output into table you must know column names from the output.  If you dont know you can try to run stored proc without @Columns like below.</p><pre class="crayon-plain-tag">EXEC usp_MWS_Report @MarketplaceId =''ATVPDKIKX0DER'', @SellerId=''Axxxxxxxxxxxxx'', @ReportType = ''_GET_MERCHANT_LISTINGS_DATA_''</pre><p>
Once we know columns from report, you can run following script to insert into table.</p>
<p><strong>Full Script &#8211; Load MWS Report Output into Table</strong></p><pre class="crayon-plain-tag">--//////////////////////////////////
— Step-1 : Create Local Linked server to point to self
--//////////////////////////////////
USE [master]
GO
--change default catalog
--For MSSQL 2012, 2014, 2016, 2017, and 2019 use @provider=N'MSOLEDBSQL' below (SQL Server Native Client 11.0)---
EXEC master.dbo.sp_addlinkedserver @server = N'ME', @srvproduct=N'', @provider=N'SQLNCLI11', @datasrc=N'localhost', @catalog=N'Northwind'
--For MSSQL 2022 or higher use @provider=N'MSOLEDBSQL' below (Microsoft OLE DB Driver for SQL Server)---
--EXEC master.dbo.sp_addlinkedserver @server = N'ME', @srvproduct=N'', @provider=N'MSOLEDBSQL', @datasrc=N'localhost', @catalog=N'Northwind'

EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'ME',@useself=N'True',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL
GO
--//////////////////////////////////
— Step-2 : Enable RPC OUT and Disable MSDTC
--//////////////////////////////////
EXEC sp_serveroption 'ME', 'rpc out', true;  
GO
--Below needed to support EXEC + INSERT (dynamic query)
EXEC sp_serveroption 'ME', 'remote proc transaction promotion', false;
GO
--test simple query
select * from OPENQUERY(ME,'select 1')
GO

--//////////////////////////////////
— Step-3 : Load data into temp table from Amazon MWS Report
--//////////////////////////////////
SELECT * INTO #amazon_mws_report
FROM OPENQUERY(me,'
SET NOCOUNT ON;
EXEC usp_MWS_Report 
   @Columns=''[item-name], [item-description], [listing-id]'',
   @MarketplaceId =''ATVPDKIKX0DER'', 
   @SellerId=''Axxxxxxxxxxxxx'', 
   @ReportType = ''_GET_MERCHANT_LISTINGS_DATA_''
WITH RESULT SETS 
(
	(itmname varchar(1000),itmdesc varchar(1000),itmid varchar(1000))
)
')

select * from #amazon_mws_report</pre><p>
<div id="attachment_7192" style="width: 865px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/import-amazon-mws-data-into-sql-server-table-generate-report.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7192" class="size-full wp-image-7192" src="https://zappysys.com/blog/wp-content/uploads/2019/05/import-amazon-mws-data-into-sql-server-table-generate-report.png" alt="Import Amazon MWS Data into SQL Table (Load Report output into temp table)" width="855" height="499" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/import-amazon-mws-data-into-sql-server-table-generate-report.png 855w, https://zappysys.com/blog/wp-content/uploads/2019/05/import-amazon-mws-data-into-sql-server-table-generate-report-300x175.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/import-amazon-mws-data-into-sql-server-table-generate-report-768x448.png 768w" sizes="(max-width: 855px) 100vw, 855px" /></a><p id="caption-attachment-7192" class="wp-caption-text">Import Amazon MWS Data into SQL Table (Load Report output into temp table)</p></div>
<h2>Conclusion</h2>
<p>In this article, we saw how to load Amazon MWS Data into SQL Server. We used simple SQL queries with ZappySys XML / CSV Driver to pull data from Amazon MWS API. <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>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/import-amazon-mws-data-sql-server-t-sql/">How to import Amazon MWS data into SQL Server (T-SQL)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read RSS feed in SSIS and ODBC (with pagination)</title>
		<link>https://zappysys.com/blog/read-rss-feed-in-ssis-pagination/</link>
		
		<dc:creator><![CDATA[ZappySys Team]]></dc:creator>
		<pubDate>Tue, 05 Mar 2019 17:26:01 +0000</pubDate>
				<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[odbc]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6503</guid>

					<description><![CDATA[<p>Introduction Read RSS feed in SSIS can be challenging. RSS named first RDF Site Summary and later named Rich Site Summary and Really Simple Syndication allows customer applications to be updated with the news of a site. For example, Microsoft RSS feeds, Apple RSS feeds, Samsung RSS feeds, etc.  With RSS the information comes to you directly and you do [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-rss-feed-in-ssis-pagination/">How to read RSS feed in SSIS and ODBC (with pagination)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2016/08/ssis-xml-parser-transform.png"><img loading="lazy" decoding="async" class="size-full wp-image-2122 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2016/08/ssis-xml-parser-transform.png" alt="" width="110" height="110" /></a>Read RSS feed in SSIS can be challenging. RSS named first RDF Site Summary and later named Rich Site Summary and Really Simple Syndication allows customer applications to be updated with the news of a site. For example, <a href="https://blog.feedspot.com/microsoft_rss_feeds/">Microsoft RSS feeds</a>, <a href="https://www.apple.com/rss/">Apple RSS feeds</a>, <a href="https://blog.feedspot.com/samsung_rss_feeds/">Samsung RSS feeds</a>, etc.  With RSS the information comes to you directly and you do not need to waste time checking the web site. In this article, we will show how to read RSS feed in SSIS and later using ODBC.</p>
<h2></h2>
<h2></h2>
<h2>Requirements</h2>
<ol>
<li>First of all, <a href="https://zappysys.com/products/ssis-powerpack/">ZappySys SSIS Powerpack</a> installed.</li>
<li>Secondly, <a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017">SSDT for Business Intelligence</a> (SSIS) installed.</li>
<li>Finally, <a href="https://zappysys.com/products/odbc-powerpack/">ODBC Powerpack installed</a>.</li>
</ol>
<h2>Getting Started</h2>
<h3>Understanding RSS data</h3>
<ol>
<li>In order to start, we will work with the WordPress RSS example:<br />
<pre class="crayon-plain-tag">https://wordpress.org/news/feed/</pre>
</li>
<li>When you go to the link, you see the feed like this:
<div id="attachment_6563" style="width: 761px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/RSS-file-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6563" class="size-full wp-image-6563" src="https://zappysys.com/blog/wp-content/uploads/2019/03/RSS-file-data.png" alt="RSS data" width="751" height="462" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/RSS-file-data.png 751w, https://zappysys.com/blog/wp-content/uploads/2019/03/RSS-file-data-300x185.png 300w" sizes="(max-width: 751px) 100vw, 751px" /></a><p id="caption-attachment-6563" class="wp-caption-text">RSS information</p></div></li>
<li>Basically, it is an XML file with the Last Build date (lastBuildDate), the title, link, description. It shows the WordPress news per version and date.</li>
</ol>
<h3>Read RSS feed in SSIS</h3>
<ol>
<li>First of all, you need an SSIS Project and a Data Flow with the ZS XML Source (if you are not familiar with SSIS and the ZS XML Source, refer to <a href="https://youtu.be/d_x5bgGjg0Y?t=408">this link</a>.
<div style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="Use Data Flow" width="460" height="155" /><p class="wp-caption-text">Drag and drop Data Flow</p></div></li>
<li>Secondly, In the ZS XML Source, add the following RSS WordPress URL:<br />
<pre class="crayon-plain-tag">https://wordpress.org/news/feed/</pre>
<div id="attachment_6564" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-feed.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6564" class="size-full wp-image-6564" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-feed.png" alt="URL of RSS in SSIS" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-feed.png 826w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-feed-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-feed-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-6564" class="wp-caption-text">SSIS read RSS</p></div></li>
<li>After that, you will be able to see the following tags when you press the array filter:</li>
<li>This time, we will focus on the information under channel which is the most relevant, make sure that the array filter is this one:<br />
<pre class="crayon-plain-tag">$.rss.channel[*].item[*]</pre>
<div id="attachment_6568" style="width: 494px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-get-data-filter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6568" class="size-full wp-image-6568" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-get-data-filter.png" alt="Filter RSS data in SSIS" width="484" height="728" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-get-data-filter.png 484w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-rss-get-data-filter-199x300.png 199w" sizes="(max-width: 484px) 100vw, 484px" /></a><p id="caption-attachment-6568" class="wp-caption-text">Using RSS filters in SSIS</p></div></li>
<li>In addition, press the preview data button and you will see the following information:
<div id="attachment_6566" style="width: 968px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-xml-source-preview-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6566" class="size-full wp-image-6566" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-xml-source-preview-data.png" alt="SSIS Preview Data" width="958" height="357" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-xml-source-preview-data.png 958w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-xml-source-preview-data-300x112.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-xml-source-preview-data-768x286.png 768w" sizes="(max-width: 958px) 100vw, 958px" /></a><p id="caption-attachment-6566" class="wp-caption-text">SSIS preview RSS</p></div></li>
</ol>
<h3>Read RSS feed in SSIS and copy to SQL Server</h3>
<ol>
<li>In the previous section, we got data from RSS. Now we will copy to SQL Server.</li>
<li>First of all, drag and drop the <strong>OLEDB Destination</strong> and join the <strong>XML </strong><strong>Source</strong> with the OLEDB Destination:
<div id="attachment_6570" style="width: 382px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-destination-xml-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6570" class="size-full wp-image-6570" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-destination-xml-source.png" alt="Copy data from RSS to SQL Server" width="372" height="215" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-destination-xml-source.png 372w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-destination-xml-source-300x173.png 300w" sizes="(max-width: 372px) 100vw, 372px" /></a><p id="caption-attachment-6570" class="wp-caption-text">SSIS RSS to OLEDB</p></div></li>
<li>Also, in the OLEDB Destination, press <strong>New</strong> button and select a SQL Server connection or create a new one:
<div id="attachment_6571" style="width: 834px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6571" class="size-full wp-image-6571" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-connection.png" alt="Create oledb destination table" width="824" height="719" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-connection.png 824w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-connection-300x262.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-connection-768x670.png 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><p id="caption-attachment-6571" class="wp-caption-text">RSS to Oledb</p></div></li>
<li>In addition, in the table or view textbox press <strong>new</strong> to create a new destination table:
<div id="attachment_6573" style="width: 834px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-table.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6573" class="size-full wp-image-6573" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-table.png" alt="Create SQL Server to store RSS data in SSIS" width="824" height="719" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-table.png 824w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-table-300x262.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-new-table-768x670.png 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><p id="caption-attachment-6573" class="wp-caption-text">Create a new SQL table to store RSS data</p></div></li>
<li>Next, modify the table name:
<div id="attachment_6575" style="width: 514px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-modify-table-name.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6575" class="size-full wp-image-6575" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-modify-table-name.png" alt="SQL Server table name in SSIS" width="504" height="442" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-modify-table-name.png 504w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-modify-table-name-300x263.png 300w" sizes="(max-width: 504px) 100vw, 504px" /></a><p id="caption-attachment-6575" class="wp-caption-text">Change SSIS destination table name</p></div></li>
<li>Also, go to the mappings page to generate the mappings:
<div id="attachment_6576" style="width: 834px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-mappings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6576" class="size-full wp-image-6576" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-mappings.png" alt="SSIS with RSS to SQL Server" width="824" height="663" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-mappings.png 824w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-mappings-300x241.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-oledb-mappings-768x618.png 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><p id="caption-attachment-6576" class="wp-caption-text">RSS Source to SQL Destination in SSIS</p></div></li>
<li>Finally, run the package and you will export the data from RSS to SQL Server.</li>
</ol>
<p>&nbsp;</p>
<h3>How to read RSS feed in SSIS using pagination</h3>
<p>If you have multiple rows, pagination helps a lot to handle multiple items. You can handle the information in pages. Instead of loading all the information, you can get the data from page 1, 2, 3 and more.</p>
<ol>
<li>First of all, in the URL, you can include the following to specify the page:<br />
<pre class="crayon-plain-tag">https://wordpress.org/news/feed/?paged=2</pre>
</li>
<li>Also, note that it used the word <strong>paged</strong> and not page. Many URLs use page and not paged, but WordPress is different:</li>
<li>In addition, if you want to use variables, you can use a variable like this:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-page-as-variable.png"><img loading="lazy" decoding="async" class="size-full wp-image-6584" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-page-as-variable.png" alt="RSS pagination in SSIS" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-page-as-variable.png 826w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-page-as-variable-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-page-as-variable-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><br />
RSS page as a variable</li>
<li>Also, we have a pagination tab with different pagination options. You can check the configuration here:
<div id="attachment_6577" style="width: 836px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-pagination-increment-by-wordpress.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6577" class="wp-image-6577 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-pagination-increment-by-wordpress.png" alt="Read RSS feed in SSIS" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-pagination-increment-by-wordpress.png 826w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-pagination-increment-by-wordpress-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-pagination-increment-by-wordpress-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-6577" class="wp-caption-text">RSS pagination configuration</p></div></li>
<li>Finally, for more information about pagination, refer to <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/">this link</a>.</li>
</ol>
<h3>How to read RSS feed in ZappySys ODBC PowerPack</h3>
<p><a href="default.html">Zappysys ODBC PowerPack</a> is a powerful tool to access to REST API, SOAP, XML, JSON, CSV, Odata. In this article, we will show how to access to RSS using ODBC PowerPack.</p>
<ol>
<li>First of all, open your ODBC Data Source Administrator in Windows.</li>
<li>Secondly, in the user DSN, press Add.</li>
<li>Also, add the Zappysys XML Driver:
<div id="attachment_6579" style="width: 603px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-connect-XML-RSS.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6579" class="size-full wp-image-6579" src="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-connect-XML-RSS.png" alt="Connect to RSS using ODBC" width="593" height="422" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-connect-XML-RSS.png 593w, https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-connect-XML-RSS-300x213.png 300w" sizes="(max-width: 593px) 100vw, 593px" /></a><p id="caption-attachment-6579" class="wp-caption-text">odbc XML driver</p></div></li>
<li> In addition, add the following URL:<br />
<pre class="crayon-plain-tag">https://wordpress.org/news/feed/</pre>
<div id="attachment_6581" style="width: 812px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-web.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6581" class="size-full wp-image-6581" src="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-web.png" alt="URL of RSS " width="802" height="702" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-web.png 802w, https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-web-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-web-768x672.png 768w" sizes="(max-width: 802px) 100vw, 802px" /></a><p id="caption-attachment-6581" class="wp-caption-text">ODBC to RSS connection</p></div></li>
<li>Finally, you can use the filters and pagination as we did with the SSIS PowerPack in the previous sections.
<div id="attachment_6582" style="width: 812px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-wordpress-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6582" class="size-full wp-image-6582" src="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-wordpress-pagination.png" alt="Use pagination for RSS " width="802" height="702" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-wordpress-pagination.png 802w, https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-wordpress-pagination-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/03/odbc-rss-wordpress-pagination-768x672.png 768w" sizes="(max-width: 802px) 100vw, 802px" /></a><p id="caption-attachment-6582" class="wp-caption-text">ODBC pagination RSS</p></div></li>
</ol>
<h2>Conclusion</h2>
<p>To conclude, we can say that with <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> and <a href="https://zappysys.com/products/ssis-powerpack/">ODBC PowerPack</a>, it is easy to access, filter and paginate RSS information or any XML / SOAP API. We strongly recommend you to try the product by yourself and check the results.</p>
<h2>References</h2>
<p>For more information about RSS, refer to these links:</p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/RSS">RSS</a></li>
<li><a href="http://www.whatisrss.com/">What Is RSS? RSS Explained</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/read-rss-feed-in-ssis-pagination/">How to read RSS feed in SSIS and ODBC (with pagination)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Read / Write REST API data in Talend (JSON / XML / SOAP)</title>
		<link>https://zappysys.com/blog/read-write-rest-api-data-in-talend-json-xml-soap/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 12 Jan 2019 20:18:31 +0000</pubDate>
				<category><![CDATA[ETL - Talend]]></category>
		<category><![CDATA[JSON File / REST API Driver]]></category>
		<category><![CDATA[ODBC Gateway]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[etl]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[odbc]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[talend]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6012</guid>

					<description><![CDATA[<p>Introduction In this post we will learn how to read / write REST API data in Talend Open Studio. We will create a simple Talend Job using ZappySys JSON  Driver to read from REST API / JSON Files and load into Target (e.g. File / DB). Techniques listed in this article can be also used to [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-write-rest-api-data-in-talend-json-xml-soap/">Read / Write REST API data in Talend (JSON / XML / SOAP)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<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;"><strong>UPDATE:</strong> Please visit <a href="https://zappysys.com/api/integration-hub/apps/talend-studio">Talend Studio Connectors</a> page in <a href="https://zappysys.com/api/integration-hub">API Integration Hub</a> to find updated articles on various Talend Studio integrations, including integrations with <a href="https://zappysys.com/api/integration-hub/rest-api-connector/talend-studio">REST API</a>, <a href="https://zappysys.com/api/integration-hub/soap-connector/talend-studio">SOAP API</a>, <a href="https://zappysys.com/api/integration-hub/json-file-connector/talend-studio">JSON file</a>, and <a href="https://zappysys.com/api/integration-hub/xml-file-connector/talend-studio">XML file</a>.</div></div>
<p><img loading="lazy" decoding="async" class="wp-image-11136 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-logo-2.png" alt="" width="150" height="151" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-logo-2.png 177w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-logo-2-150x150.png 150w" sizes="(max-width: 150px) 100vw, 150px" />In this post we will learn how to read / write REST API data in Talend Open Studio. We will create a simple Talend Job using <a href="https://zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/" target="_blank" rel="noopener">ZappySys JSON  Driver</a> to read from REST API / JSON Files and load into Target (e.g. File / DB). Techniques listed in this article can be also used to read from SOAP API / XML Files or CSV Files / API using <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/">XML Driver</a> / <a href="https://zappysys.com/products/odbc-powerpack/odbc-csv-rest-api-driver/">CSV Driver</a>.</p>
<p>These drivers support familiar SQL query language. Using SQL you can query virtually any API services just like relational database table. It can flatten nested hierarchy and provide output in rows / columns. Many complex REST API / SOAP API complexity is taken care automatically (e.g. Authentication, Pagination, Security, Error Handling).</p>
<p>So let&#8217;s get started.</p>
<p>&nbsp;</p>
<h2>Requirements</h2>
<ol>
<li>Download and install Talend Open Studio (FREE) <a href="https://www.talend.com/products/data-integration/data-integration-open-studio/" target="_blank" rel="noopener">from here</a>. Skip this step if you already installed.</li>
<li>Download <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> (JSON / XML Drivers)</li>
<li>Get Microsoft <strong>JDBC driver</strong> for <strong>SQL Server</strong> <a href="https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;id=11774">from here</a> (Download <strong>sqljdbc_6.0.8112.200_enu.exe</strong> which is self extracting file you can run and extract to some folder)<br />
After you extract jdbc files, go to sqljdbc_6.0\enu\jre8\ folder rename <strong>sqljdbc42.jar</strong> to  <strong>mssql-jdbc.jar</strong> (name must be this). We will load this file in Talend later in this article.</li>
<li>Basic knowledge about REST API and JSON / XML format.</li>
</ol>
<h2>Configure Data Gateway</h2>
<div class="content_block" id="custom_post_widget-5282">Now let's look at how to configure <a href="https://zappysys.com/products/odbc-powerpack/data-gateway/" target="_blank" rel="noopener">ZappySys Data Gateway</a>. This feature acts as a bridge between Client App and ZappySys Drivers. Using data gateway you can use ZappySys Drivers inside applications / operating systems where ZappySys drivers may not be available directly for some reason (e.g. You don't have access to Server for Installation or System does not support ODBC drivers like JAVA programs). <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-gateway/">Click here to read more</a> on various use cases of Data Gateway.
<h4><span style="font-size: 14pt;">Configure Data Gateway User / Port</span></h4>
Now let's look at steps to configure Data Gateway after installation. We will also create a sample data source for ODATA API (i.e. JSON based REST API Service).
<ol>
 	<li>Assuming you have installed <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> using default options (Which also enables Data Gateway Service)</li>
 	<li>Search "Gateway" in your start menu and click ZappySys Data Gateway
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png" alt="Open ZappySys Data Gateway" /></a>
<p class="wp-caption-text">Open ZappySys Data Gateway</p>

</div></li>
 	<li>First make sure Gateway Service is running (Verify Start icon is disabled)</li>
 	<li>Also verify Port on General Tab
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-1.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-1.png" alt="Port Number setting on ZappySys Data Gateway" /></a>
<p class="wp-caption-text">Port Number setting on ZappySys Data Gateway</p>

</div></li>
 	<li>Now go to Users tab. <strong>Click Add</strong> icon to add a new user. Check Is admin to give access to all data sources you add in future. If you don't check admin then you have to manually configure user permission for each data source.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-2.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-2.png" alt="Add Data Gateway User" /></a>
<p class="wp-caption-text">Add Data Gateway User</p>

</div></li>
</ol>
&nbsp;
<h4><span style="font-size: 14pt;">Configure Data Source</span></h4>
<ol>
 	<li>After user is added, go to Data Sources tab. <strong>Click Add</strong> icon to create new data source. Select appropriate driver based on your API / File format. You can choose Generic ODBC option to read data from ODBC DSN or use Native Driver option.
<pre class=""><strong>NOTE:</strong> Whenever possible use native driver option for better performance / security and ease of use.</pre>
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-3.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-3.png" alt="Add Gateway Data Source (Native JSON Driver)" /></a>
<p class="wp-caption-text">Add Gateway Data Source (Native JSON Driver)</p>

</div></li>
 	<li>Click on "Edit" under Data source and configure as per your need (e.g. Url, Connection, Request Method, Content Type, Body, Pagination etc.). For this demo we are going to pick simple JSON REST API which doesn't need any authentication.  Enter following URL.
<pre class="">https://services.odata.org/V3/Northwind/Northwind.svc/Invoices?$format=json</pre>
</li>
 	<li>You can also view response structure and select default hierarchy (i.e. Filter) like below (Select Array Icon) for data extraction.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-4.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-4.png" alt="Configure JSON API Data source" /></a>
<p class="wp-caption-text">Configure JSON API Data source</p>

</div></li>
</ol>
<h4><span style="font-size: 14pt;">Test SQL Query / Preview Data</span></h4>
<ol>
 	<li>Now go to Preview Tab. You can click Preview button to execute default query
OR
Select Table name from dropdown to generate SQL with column names.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-5.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-5.png" alt="JSON / REST API Driver Query Preview / Query Examples (Read REST API or JSON Files)" /></a>
<p class="wp-caption-text">JSON / REST API Driver Query Preview / Query Examples (Read REST API or JSON Files)</p>

</div></li>
 	<li>You can also click Query Builder to generate SQL using different options in WITH clause. ANy setting you specify in WITH clause will override UI settings we applied in previous steps.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-6.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-6.png" alt="Using SQL Query Builder (For Files or REST / SOAP API - JSON / XML / CSV Format)" /></a>
<p class="wp-caption-text">Using SQL Query Builder (For Files or REST / SOAP API - JSON / XML / CSV Format)</p>

</div></li>
 	<li>There is another useful option for code generation. Select your Language and quickly copy code snippet. See below Example of XML Driver Query to call SOAP API.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-7.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/odbc-configure-data-gateway-json-7.png" alt="Generate Example Code for ZappySys Driver" /></a>
<p class="wp-caption-text">Generate Example Code for ZappySys Driver</p>

</div></li>
 	<li><strong>Click OK</strong> to Close Data Source UI</li>
 	<li>Once data source is tested and configured you can <strong>click Save </strong>button in the Gateway UI toolbar and click <strong>Yes</strong> for <strong>Restart Service</strong>.</li>
</ol>
&nbsp;</div>
<h2>Register MS SQL JDBC driver in Talend</h2>
<p>Now lets register Microsoft JDBC Driver in Talend. This is very important step because MSSQL JDBC driver is used to communicate with ZappySys Data Gateway we configured in previous step.</p>
<p>If you missed steps mentioned in the Requirements section then make sure you first download JDBC driver using below steps.</p>
<p>Get Microsoft <strong>JDBC driver</strong> for <strong>SQL Server</strong> <a href="https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;id=11774">from here</a> (Download <strong>sqljdbc_6.0.8112.200_enu.exe</strong> which is self extracting file you can run and extract to some folder). After you extract jdbc files, go to sqljdbc_6.0\enu\jre8\ folder rename <strong>sqljdbc42.jar</strong> to  <strong>mssql-jdbc.jar</strong> (name must be this).</p>
<p>Now lets go through the steps to register MSSQL jdbc driver in Talend.</p>
<ol>
<li>Open Talend Open Studio</li>
<li>Go to <strong>Windows</strong> &gt; Click <strong><strong>Show View</strong></strong>
<div id="attachment_6038" style="width: 456px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-show-views-menu.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6038" class="size-full wp-image-6038" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-show-views-menu.png" alt="Talend - Show View" width="446" height="184" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-show-views-menu.png 446w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-show-views-menu-300x124.png 300w" sizes="(max-width: 446px) 100vw, 446px" /></a><p id="caption-attachment-6038" class="wp-caption-text">Talend &#8211; Show View</p></div></li>
<li>When you see Popup selection under <strong>Talend</strong> &gt; Select <strong><strong><strong>Modules</strong></strong></strong>
<div id="attachment_6037" style="width: 342px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-show-modules-option.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6037" class="size-full wp-image-6037" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-show-modules-option.png" alt="Talend - Select Modules Window" width="332" height="399" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-show-modules-option.png 332w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-show-modules-option-250x300.png 250w" sizes="(max-width: 332px) 100vw, 332px" /></a><p id="caption-attachment-6037" class="wp-caption-text">Talend &#8211; Select Modules Window</p></div></li>
<li>When Module window is visible click on Little Jar Icon (Bottle icon) in the toolbar.</li>
<li>Select <strong>mssql-jdbc.jar</strong> file we renamed earlier and load this file.
<div id="attachment_6036" style="width: 870px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-register-jdbc-driver-import-mssql-jar.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6036" class="size-full wp-image-6036" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-register-jdbc-driver-import-mssql-jar.png" alt="Talend - Import JAR file / module (Register MS SQL JDBC Driver Example)" width="860" height="348" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-register-jdbc-driver-import-mssql-jar.png 860w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-register-jdbc-driver-import-mssql-jar-300x121.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-register-jdbc-driver-import-mssql-jar-768x311.png 768w" sizes="(max-width: 860px) 100vw, 860px" /></a><p id="caption-attachment-6036" class="wp-caption-text">Talend &#8211; Import JAR file / module (Register MS SQL JDBC Driver Example)</p></div></li>
<li>That&#8217;s it. Now we ready to make API calls / read from JSON / XML in the next section.</li>
</ol>
<h2>Setup Talend REST API Connection (JSON / XML / CSV)</h2>
<p>Now let&#8217;s configure REST API Connection in Talend. To read from JSON / XML Files you can use same steps too. We will use MSSQL JDBC Driver to connect to ZappySys Data Gateway.</p>
<ol>
<li>In Talend Go to Metadata &gt; Db Connections (Right click) &gt; Create Connection
<div id="attachment_6030" style="width: 353px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-create-new-db-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6030" class="size-full wp-image-6030" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-create-new-db-connection.png" alt="Talend - Create new DB connection (JSON / REST API Example)" width="343" height="364" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-create-new-db-connection.png 343w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-create-new-db-connection-283x300.png 283w" sizes="(max-width: 343px) 100vw, 343px" /></a><p id="caption-attachment-6030" class="wp-caption-text">Talend &#8211; Create new DB connection (JSON / REST API Example)</p></div></li>
<li>On the connection Wizard specify following attributes.<br />
<strong>DB Version :</strong> Microsoft<br />
<strong>Login :</strong>  username you setup in zappysys data gateway<br />
<strong>Password :</strong>  password of data gateway user<br />
<strong>Server :</strong> machine name or IP where zappysys data gateway is running<br />
<strong>Port :</strong> &lt;default is 5000&gt; Port on which zappysys data gateway is listening<br />
<strong>DataBase :</strong>  Data source name you setup in zappysys data gateway (case-sensitive)</p>
<div id="attachment_6029" style="width: 977px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-connect-json-xml-rest-api-using-zappysys-gateway-ms-jdbc.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6029" class="size-full wp-image-6029" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-connect-json-xml-rest-api-using-zappysys-gateway-ms-jdbc.png" alt="Talend - Connect to JSON / REST API using ZappySys Gateway (Use MS SQL JDBC Driver)" width="967" height="716" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-connect-json-xml-rest-api-using-zappysys-gateway-ms-jdbc.png 967w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-connect-json-xml-rest-api-using-zappysys-gateway-ms-jdbc-300x222.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-connect-json-xml-rest-api-using-zappysys-gateway-ms-jdbc-768x569.png 768w" sizes="(max-width: 967px) 100vw, 967px" /></a><p id="caption-attachment-6029" class="wp-caption-text">Talend &#8211; Connect to JSON / REST API using ZappySys Gateway (Use MS SQL JDBC Driver)</p></div></li>
<li>That&#8217;s all we need to do to setup a connection which can be used to read / write REST API data in Talend. In the next section we will see how to create a job to read data from REST API Service using this connection.</li>
</ol>
<p>&nbsp;</p>
<h2>Read from REST API in Talend</h2>
<p>Now let&#8217;s look at how to read data from REST API source or JSON / XML File using the connection we configured in the previous section.</p>
<h3>Configure REST API Source</h3>
<ol>
<li>Create a Talend JOB and double click to open designer</li>
<li>Now drag and drop MSSQL Connection we created for ZappySys Data gateway, drop it on the designer surface. It will popup UI like below.</li>
<li>Select <strong>tDBInput</strong> (Microsoft SQL Server). Remember that we are using MSSQL JDBC Driver to connect to ZappySys Data Gateway for REST API Call. This gateway uses Microsoft TDS Protocol so MSSQL JDBC driver is used to communicate.</li>
<li>Now rename Source to something meaningful (e.g. Read from JSON REST API)</li>
<li>Double click REST Source to configure.</li>
<li>Enter <strong>Query</strong> like below (Make sure to <strong>enter between double quotes</strong>). See below examples to read from URL or File. If you have double quote in SQL then escape using \&#8221; character (e.g. select \&#8221;my col\&#8221; from $ )<strong>Read From REST API Url</strong><br />
<pre class="crayon-plain-tag">"SELECT * FROM value 
WITH (SRC='https://services.odata.org/V3/Northwind/Northwind.svc/Customers?$format=json')"</pre>
<strong>Read from Local File (Wildcard Pattern Search allowed)</strong><br />
<pre class="crayon-plain-tag">"SELECT * FROM value 
WITH (SRC='c:\data\Customers_*.json')"</pre>
</li>
<li>Click on <strong>Guess Schema</strong> button and Click OK to accept detected schema.
<div id="attachment_6028" style="width: 972px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-configure-json-rest-api-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6028" class="size-full wp-image-6028" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-configure-json-rest-api-source.png" alt="Talend - Configure REST API / JSON Source (Enter SQL Query / Guess Schema)" width="962" height="723" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-configure-json-rest-api-source.png 962w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-configure-json-rest-api-source-300x225.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-configure-json-rest-api-source-768x577.png 768w" sizes="(max-width: 962px) 100vw, 962px" /></a><p id="caption-attachment-6028" class="wp-caption-text">Talend &#8211; Configure REST API / JSON Source (Enter SQL Query / Guess Schema)</p></div></li>
<li>Now we will configure target in the next section.</li>
</ol>
<h3>Configure Target (Delimited File)</h3>
<ol>
<li>Now search for &#8220;FileOut&#8221; in the toolbox (Hit Enter). You will see <strong>tFileOutputDelimited</strong> so just select that for now and drag on the surface.
<div id="attachment_6035" style="width: 828px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-to-csv-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6035" class="size-full wp-image-6035" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-to-csv-file.png" alt="Talend - Add File Output (tFileOutputDelimited)" width="818" height="307" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-to-csv-file.png 818w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-to-csv-file-300x113.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-to-csv-file-768x288.png 768w" sizes="(max-width: 818px) 100vw, 818px" /></a><p id="caption-attachment-6035" class="wp-caption-text">Talend &#8211; Add File Output (tFileOutputDelimited)</p></div></li>
<li>Double click it to configure.</li>
<li>Enter correct file path (e.g. &#8220;C:/Talend/workspace/rest-api-output.csv&#8221; )</li>
<li>On Advanced Tab you can configure some additional settings (e.g. Throw an error if file already exists)</li>
</ol>
<h3>Connect and Run</h3>
<ol>
<li>Once you have configured Source and Target its time to connect them</li>
<li>Drag Source Port to Target to connect like below.
<div id="attachment_6033" style="width: 539px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-load-json-rest-api-data-to-csv-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6033" class="size-full wp-image-6033" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-load-json-rest-api-data-to-csv-file.png" alt="Talend - Connect REST / JSON Source to File Target" width="529" height="176" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-load-json-rest-api-data-to-csv-file.png 529w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-load-json-rest-api-data-to-csv-file-300x100.png 300w" sizes="(max-width: 529px) 100vw, 529px" /></a><p id="caption-attachment-6033" class="wp-caption-text">Talend &#8211; Connect REST / JSON Source to File Target</p></div></li>
<li>Run the job
<div id="attachment_6034" style="width: 863px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-rest-api-import-into-file-table.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6034" class="wp-image-6034 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-rest-api-import-into-file-table.png" alt="Run Talend Job - Loading REST API data into File (Read JSON / XML / CSV)" width="853" height="510" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-rest-api-import-into-file-table.png 853w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-rest-api-import-into-file-table-300x179.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-read-json-rest-api-import-into-file-table-768x459.png 768w" sizes="(max-width: 853px) 100vw, 853px" /></a><p id="caption-attachment-6034" class="wp-caption-text">Run Talend Job &#8211; Loading REST API data into File (Read JSON / XML / CSV)</p></div></li>
<li>That&#8217;s it. So in few clicks you loaded data from REST API to File in Talend Open Studio.</li>
</ol>
<h2>Write / Send data to REST API (POST Example)</h2>
<p>There will be a time when you want to POST data to REST API service. Let&#8217;s check how to write POST query to submit data to REST API.</p>
<p>Just like how we did Read query in previous example, we can set POST Body in the SQL Query to send data. Use query like below and click Guess Schema button. If Blank Filter gives you no data error then make sure you remove Filter on Data Gateway Data source. (Notice we used \&#8221; to escape double quote inside query )</p><pre class="crayon-plain-tag">"SELECT * FROM _root_
WITH (
 METHOD='POST'
,HEADER='Content-Type: text/plain || first-header: AAA || second-header: BBB'
,SRC='http://httpbin.org/post'
,BODY='{id:1,notes:\"Some notes\"}'
,FILTER=''
)
"</pre><p>
<div id="attachment_6040" style="width: 848px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-post-data-to-rest-api-url.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6040" class="size-full wp-image-6040" src="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-post-data-to-rest-api-url.png" alt="Talend - POST data to REST API URL" width="838" height="641" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/talend-post-data-to-rest-api-url.png 838w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-post-data-to-rest-api-url-300x229.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/talend-post-data-to-rest-api-url-768x587.png 768w" sizes="(max-width: 838px) 100vw, 838px" /></a><p id="caption-attachment-6040" class="wp-caption-text">Talend &#8211; POST data to REST API URL</p></div>
<h2>SQL Query Examples</h2>
<p>Click on below link to learn more writing SQL Query using ZappySys Drivers.</p>
<p><a href="https://zappysys.com/onlinehelp/odbc-powerpack/scr/json-odbc-driver-sql-query-examples.htm" target="_blank" rel="noopener">JSON / REST Driver &#8211; SQL Query Examples</a></p>
<p><a href="https://zappysys.com/onlinehelp/odbc-powerpack/scr/xml-odbc-driver-sql-query-examples.htm" target="_blank" rel="noopener">XML / SOAP Driver &#8211; SQL Query Examples</a></p>
<p><a href="https://zappysys.com/onlinehelp/odbc-powerpack/scr/csv-odbc-driver-sql-query-examples.htm" target="_blank" rel="noopener">CSV / REST Driver &#8211; SQL Query Examples</a></p>
<h2>REST API / XML SOAP Pagination Settings for Talend</h2>
<div class="content_block" id="custom_post_widget-3892"><div style="margin-bottom: 1em;">Even we set up ODBC Data Source to get the data, it may not be enough. Usually, if you are getting a huge data set from API provider, it won't give it to you in one HTTP response. Instead, it gives back only a subset of data and provides a mechanism for data pagination. The good news is that <em>ZappySys ODBC Driver</em> includes many options to cover virtually any pagination method.</div>
<div><span style="font-size: 16px;">Below you will find a few examples of API pagination. If you need something more sophisticated check the below link (the article was written for SSIS PowerPack but UI options and concepts apply to ODBC Driver too):</span></div>
<div style="margin-bottom: 1em;"><a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/</a></div>
<h3>Paginate by Response Attribute</h3>
This example shows how to paginate API calls where you need to paginate until the last page detected. In this example, next page is indicated by some attribute called nextlink (found in response). If this attribute is missing or null then it stops fetching the next page.
<pre class="lang:tsql decode:true codeblock">SELECT * FROM $
WITH(
SRC=@'https://zappysys.com/downloads/files/test/pagination_nextlink_inarray_1.json'
,NextUrlAttributeOrExpr = '$.nextlink'  --keep reading until this attribute is missing. If attribute name contains dot then use brackets like this $.['my.attr.name']
)</pre>
<h3>Paginate by URL Parameter (Loop until certain StatusCode)</h3>
This example shows how to paginate API calls where you need to pass page number via URL. The driver keeps incrementing page number and calls next URL until the last page detected (401 error). There are few ways to indicate the last page (e.g. By status code, By row count, By response size). If you don't specify end detection then it will use the default (i.e. No records found).
<pre class="lang:tsql decode:true codeblock">SELECT * FROM $
WITH (
SRC=@'https://zappysys.com/downloads/files/test/page-xml.aspx?page=1&amp;mode=DetectBasedOnResponseStatusCode'
,PagingMode='ByUrlParameter'
,PagingByUrlAttributeName='page'
,PagingByUrlEndStrategy='DetectBasedOnResponseStatusCode'
,PagingByUrlCheckResponseStatusCode=401
,IncrementBy=1
)</pre>
<h3>Paginate by URL Path (Loop until no record)</h3>
This example shows how to paginate API calls where you need to pass page number via URL Path. The driver keeps incrementing page number and calls next URL until the last page is detected. There are few ways to indicate the last page (e.g. By status code, By row count, By response size). If you don't specify end detection then it will use the default (i.e. No records found).
<pre class="lang:tsql decode:true codeblock">SELECT * FROM $
WITH (
SRC=@'https://zappysys.com/downloads/files/test/cust-&lt;%page%&gt;.xml'
,PagingMode='ByUrlPath'
,PagingByUrlAttributeName='&lt;%page%&gt;'
,PagingByUrlEndStrategy='DetectBasedOnRecordCount'
,IncrementBy=1
)</pre>
<h3>Paginate by Header Link (RFC 5988)</h3>
API like GitHub / Wordpress use Next link in Headers (<a href="https://tools.ietf.org/html/rfc5988" target="_blank" rel="noopener">RFC 5988</a>)
<pre class="lang:default decode:true ">SELECT * FROM $
LIMIT 25
WITH(
	 Src='https://wordpress.org/news/wp-json/wp/v2/categories?per_page=10'
	,PagingMode='ByResponseHeaderRfc5988'
	,WaitTimeMs='200' --//wait 200 ms after each request
)</pre>
&nbsp;</div>
<h2>REST API / SOAP Web Service Connection Settings for Talend</h2>
<div class="content_block" id="custom_post_widget-3896"><div style="margin-bottom: 1em;">If you need to authenticate or authorize your user to access a web resource, you will need to use one of the <em>Connections:</em></div>
<ul>
 	<li>HTTP</li>
 	<li>OAuth</li>
</ul>
<img loading="lazy" decoding="async" class="wp-image-4078 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-powerpack-authentication-authorization-e1529337108252.png" alt="ZappySys XML Driver - HTTP and OAuth Connection Types" width="577" height="302" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-powerpack-authentication-authorization-e1529337108252.png 577w, https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-powerpack-authentication-authorization-e1529337108252-300x157.png 300w" sizes="(max-width: 577px) 100vw, 577px" />
<h3>HTTP Connection</h3>
<div style="margin-bottom: 1em;">Use <em>HTTP Connection</em> for simple Windows, Basic, NTLM or Kerberos authentication. Just fill in a username and a password and you are good to go!</div>
<div style="margin-bottom: 1em;">You can also use <em>HTTP Connection</em> for more sophisticated authentication like:</div>
<ul>
 	<li><strong>SOAP WSS</strong> (when accessing a SOAP WebService)</li>
 	<li><strong>Static Token / API Key</strong> (when need to pass an API key in HTTP header)</li>
 	<li><strong>Dynamic Token</strong> (same as Static Token method except that each time you need to log in and retrieve a fresh API key)</li>
 	<li><strong>JWT Token</strong> (As per RFC 7519)</li>
</ul>
<img loading="lazy" decoding="async" class="alignnone wp-image-4091 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-api-connection-type-1.png" alt="" width="622" height="570" />
<h3>OAuth</h3>
If you are trying to access REST API resource, it is a huge chance, you will need to use <em>OAuth Connection</em>. <a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/" target="_blank" rel="noopener">Read this article</a> to understand how OAuth authentication and authorization works and how to use it (article originally was written for <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a>, but the concepts and UI stay the same): <br/>
<a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/" target="_blank" rel="noopener">https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/</a>
<img loading="lazy" decoding="async" class="alignnone size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-api-connection-type-2.png" width="721" height="708" /></div>
<h2>Other settings for REST API / SOAP XML Call in Talend</h2>
<div class="content_block" id="custom_post_widget-3901">There are few settings you can coder while calling Web API
<h3><strong>API Limit / Throttling</strong></h3>
While calling public API or other external web services one important aspect you have to check,  how many requests are allowed by your API. Especially when you use API pagination options to pull many records you have to slow down based on API limits. For example, your API may allow you only 5 requests per second. Use Throttling Tab on Driver UI to set delay after each request.
<h3><strong>2D Array Transformation</strong></h3>
If you are using JSON or XML API Driver then possible you may have to transform your data using 2D array transformation feature. <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">Check this link</a> for more information.

&nbsp;</div>
<h2>REST API / XML SOAP Performance Tips for Talend</h2>
<div class="content_block" id="custom_post_widget-4455">While calling APIs you may face some performance issues. There are a few tips you can consider to speed up things.
<h4><span style="font-size: 14pt;"><strong>Use Server-side filtering if possible in URL or Body Parameters</strong></span></h4>
Many API supports filtering your data by URL parameters or via Body. Whenever possible try to use such features.  Here is an example of <a href="http://www.odata.org/getting-started/basic-tutorial/" target="_blank" rel="noopener">odata API</a>, In the below query the first query is faster than the second query because in the first query we filter at the server.
<pre class="lang:tsql decode:true">SELECT * FROM value
WITH(
	 Src='https://services.odata.org/V3/Northwind/Northwind.svc/Customers?$format=json&amp;$filter=Country eq ''USA'''
	,DataFormat='Odata'
)

-- Slow query - Client-side filtering
SELECT * FROM value
WHERE Country ='USA'
WITH(
	 Src='https://services.odata.org/V3/Northwind/Northwind.svc/Customers?$format=json'
	,DataFormat='Odata'
)</pre>
<h4><span style="font-size: 14pt;"><strong>Avoid Special features in SQL Query (e.g. WHERE, Group By, Order By)</strong></span></h4>
ZappySys API engine triggers client-side processing if special features are used in Query. Following SQL Features will trigger Client-Side processing which is several times slower than server-side processing. So always try to use simple query (Select col1, col2 .... from mytable )
<ul>
 	<li>WHERE Clause</li>
 	<li>GROUP BY Clause</li>
 	<li>HAVING Clause</li>
 	<li>ORDER BY</li>
 	<li>FUNCTIONS (e.g. Math, String, DateTime, Regex... )</li>
</ul>
LIMIT clause does not trigger client-side processing.
<h4><span style="font-size: 14pt;"><strong>Consider using pre-generated Metadata / Cache File</strong></span></h4>
Use META option in WITH Clause to use static metadata (Pre-Generated)There are two more options to speedup query processing time. Check <a href="https://zappysys.com/blog/caching-metadata-odbc-drivers-performance/" target="_blank" rel="noopener">this article</a> for details.
<ol>
 	<li>
<pre class="lang:default decode:true">select * from value WITH( meta='c:\temp\meta.txt' )
--OR--
select * from value WITH( meta='my-meta-name' )
--OR--
select * from value WITH( meta='[ {"Name": "col1",&amp;nbsp;"Type": "String", Length: 100},&amp;nbsp;{"Name": "col2",&amp;nbsp;"Type": "Int32"} ...... ]' )</pre>
</li>
 	<li>Enable Data Caching Options (Found on <strong>Property Grid</strong> &gt; <strong>Advanced</strong> Mode Only )</li>
</ol>
<h4><span style="font-size: 14pt;"><strong>Consider using Metadata / Data Caching Option</strong></span></h4>
ZappySys API drivers support Caching Metadata and Data rows to speed up query processing. If your data doesn't change often then you can enable this option to speed up processing significantly.

Check <a href="https://zappysys.com/blog/caching-metadata-odbc-drivers-performance/" target="_blank" rel="noopener">this article</a> for details how to enable Data cache / metadata cache feature for datasource level or query level.

To define cache option at query level you can use like below.
<pre class="">SELECT * FROM $
WITH 
(  SRC='https://myhost.com/some-api'
  ,CachingMode='All'  --cache metadata and data rows both
  ,CacheStorage='File' --or Memory
  ,CacheFileLocation='c:\temp\myquery.cache'
  ,CacheEntryTtl=300 --cache for 300 seconds
)
</pre>
&nbsp;

&nbsp;
<h4><strong><span style="font-size: 14pt;">Use --FAST Option to enable Stream Mode</span></strong></h4>
ZappySys JSON / XML drivers support <strong>--FAST</strong> suffix for Filter. By using this suffix after Filter driver enables Stream Mode, <a href="https://zappysys.com/blog/caching-metadata-odbc-drivers-performance/#Reading_Large_Files_Streaming_Mode_for_XML_JSON" target="_blank" rel="noopener">Read this article</a> to understand how this works.
<pre class="lang:default decode:true">SELECT * FROM $ 
LIMIT 10 --//add this just to test how fast you can get 10 rows
WITH(
  Filter='$.LargeArray[*]--FAST' --//Adding --FAST option turn on STREAM mode (large files)
 ,SRC='https://zappysys.com/downloads/files/test/large_file_100k_largearray_prop.json.gz'
 --,SRC='c:\data\large_file.json.gz'
 ,IncludeParentColumns='False'  --//This Must be OFF for STREAM mode (read very large files)
 ,FileCompressionType='GZip' --Zip or None (Zip format only available for Local files)
)</pre>
&nbsp;</div>
<h2>Calling SOAP Web Service in Talend</h2>
<div class="content_block" id="custom_post_widget-3870">To call SOAP API you need to know Request XML Body Structure. If you are not sure how to create SOAP Request body then no worries. <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">Check this article</a> to learn how to generate SOAP Request body using the Free tool <a href="https://www.soapui.org/downloads/latest-release.html" target="_blank" rel="noopener">SoapUI</a>. Basically, you have to use SoapUI to generate Request XML and after that, you can replace parameters as needed in the generated body.
<h3>What is SOAP Web Service?</h3>
If you are new to SOAP Web Service sometimes referred as XML Web Service then please read some concept about SOAP Web service standard <a href="https://msdn.microsoft.com/en-us/library/ms996507.aspx?f=255&amp;MSPPError=-2147217396" target="_blank" rel="noopener">from this link</a>

There are two important aspects in SOAP Web service.
<ol>
 	<li>Getting WSDL file or URL</li>
 	<li>Knowing exact Web Service URL</li>
</ol>
<h3>What is WSDL</h3>
In very simple term WSDL (often pronounced as whiz-dull) is nothing but a document which describes Service metadata (e.g. Functions you can call, Request parameters, response structure etc). Some service simply give you WSDL as xml file you can download on local machine and then analyze or sometimes you may get direct URL (e.g. http://api.mycompany.com/hr-soap-service/?wsdl )
<h3>Example SQL Query for SOAP API call using ZappySys XML Driver</h3>
Here is an example SQL query you can write to call SOAP API. If you not sure about many details then check next few sections on how to use XML Driver User Interface to build desired SQL query to POST data to XML SOAP Web Service without any coding.
<pre class="lang:tsql decode:true">SELECT * FROM $
WITH(
	 Src='http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx'
	,DataConnectionType='HTTP'
	,CredentialType='Basic' --OR SoapWss
	,SoapWssPasswordType='PasswordText'
	,UserName='myuser'
	,Password='pass$$w123'
	,Filter='$.soap:Envelope.soap:Body.GetHolidaysAvailableResponse.GetHolidaysAvailableResult.HolidayCode[*]'
	,ElementsToTreatAsArray='HolidayCode'	
	,RequestMethod='POST'	
	,Header='Content-Type: text/xml;charset=UTF-8 || SOAPAction: "http://www.holidaywebservice.com/HolidayService_v2/GetHolidaysAvailable"'
	,RequestData='
&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hol="http://www.holidaywebservice.com/HolidayService_v2/"&gt;
   &lt;soapenv:Header/&gt;
   &lt;soapenv:Body&gt;
      &lt;hol:GetHolidaysAvailable&gt;
         &lt;!--type: Country - enumeration: [Canada,GreatBritain,IrelandNorthern,IrelandRepublicOf,Scotland,UnitedStates]--&gt;
         &lt;hol:countryCode&gt;UnitedStates&lt;/hol:countryCode&gt;
      &lt;/hol:GetHolidaysAvailable&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;'
)</pre>
Now let's look at steps to create SQL query to call SOAP API. Later we will see how to generate code for your desired programming language (e.g. C# or SQL Server)
<h3>Video Tutorial - Introduction to SOAP Web Service and SoapUI tool</h3>
Before we dive into details about calling SOAP API using ZappySys XML Driver, lets first understand what is SOAP API and how to create SOAP requests using SoapUI tool. You will learn more about this process in the later section. The video contains some fragment about using SOAP API in SSIS but just ignore that part because we will be calling Soap API using ZappySys ODBC Driver rather than SSIS Components.

&nbsp;

<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/d_x5bgGjg0Y?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen="allowfullscreen" data-mce-fragment="1"></iframe>
<h3>Using SoapUI to test SOAP API call / Create Request Body XML</h3>
Assuming you have downloaded and installed <a href="https://www.soapui.org/downloads/latest-release.html" target="_blank" rel="noopener">SoapUI from here</a>, now we are ready to use WSDL for your SOAP Web Service Calls. If you do not have WSDL file or URL handy then contact your API provider (sometimes you just have to add <strong>?wsdl </strong>at the end of your Service URL to get WSDL so try that. Example: http://mycompany/myservice?wsdl ).

If you don't know what is WSDL then in short, WSDL is <strong>Web service Description Language</strong> (i.e. XML file which describes your SOAP Service). WSDL helps to craft SOAP API request Body for ZappySys XML Driver. So Let's get started.
<ol>
 	<li>Open SoapUI and click SOAP button to create new SOAP Project</li>
 	<li>Enter WSDL URL or File Path of WSDLFor example WSDL for our sample service can be accessed via this URL
<pre class="lang:default highlight:0 decode:true">http://www.dneonline.com/calculator.asmx?wsdl</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/calling-soap-api-import-wsdl-new-soapui-project.png"><img loading="lazy" decoding="async" class="size-full wp-image-3871" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-14.png" alt="Create new SOAP API Project in SoapUI tool for SOAP API Testing" width="486" height="349" /></a>
<div style="margin-bottom: 1em;">Create new SOAP API Project in SoapUI tool for SOAP API Testing</div></li>
 	<li>Once WSDL is loaded you will see possible operations you can call for your SOAP Web Service.</li>
 	<li>If your web service requires credentials then you have to configure it. There are two common credential types for public services (<strong>SOAP WSS</strong> or <strong>BASIC</strong> )
<ol>
 	<li>
<div style="margin-bottom: 1em;">To use <strong>SOAP WSS Credentials</strong> select request node and enter UserId, Password, and <strong>WSS-PasswordType</strong> (PasswordText or PasswordHash)</div>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/calling-soap-api-pass-soap-wss-credentials-userid-password.png"><img loading="lazy" decoding="async" class="size-full wp-image-3872 alignnone" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-2.png" alt="Configure SOAP WSS Credentials for SoapUI (SOAP API Testing Tool)" width="294" height="544" /></a>
<div style="display: block;">Configure SOAP WSS Credentials for SoapUI (SOAP API Testing Tool)</div></li>
 	<li>To use <strong>BASIC Auth</strong> Credentials select request node and double-click it. At the bottom click on Auth (Basic) and From Authorization dropdown click Add New and Select Basic.<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/calling-soap-api-pass-basic-authentication-userid-password.png"><img loading="lazy" decoding="async" class="size-full wp-image-3873" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-2.png" alt="Configure Basic Authorization for SoapUI (SOAP API Testing Tool)" width="616" height="653" /></a>
<div style="margin-bottom: 1em;">Configure Basic Authorization for SoapUI (SOAP API Testing Tool)</div></li>
</ol>
</li>
 	<li>Now you can test your request first Double-click on the request node to open request editor.</li>
 	<li>Change necessary parameters, remove optional or unwanted parameters. If you want to regenerate request you can click on <strong>Recreate default request toolbar icon</strong>.
<a href="https://zappysys.com/blog/wp-content/uploads/2016/06/create-soap-request-with-optional-parameters-soapui.png"><img loading="lazy" decoding="async" class="size-full wp-image-2812" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-4.png" alt="Create SOAP Request XML (With Optional Parameters)" width="807" height="315" /></a>
<div style="margin-bottom: 1em;">Create SOAP Request XML (With Optional Parameters)</div></li>
 	<li>Once your SOAP Request XML is ready, <strong>Click the Play button</strong> in the toolbar to execute SOAP API Request and Response will appear in Right side panel.
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/soapui-test-soap-api-request-response-edit-xml-body.png"><img loading="lazy" decoding="async" class="size-full wp-image-3874" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-5.png" alt="Test SOAP API using SoapUI Tool (Change Default XML Body / Parameters, Execute and See Response)" width="1216" height="511" /></a>
Test SOAP API using SoapUI Tool (Change Default XML Body / Parameters, Execute and See Response)</li>
</ol>
<h3>Create DSN using ZappySys XML Driver to call SOAP API</h3>
Once you have tested your SOAP API in SoapUI tool, we are ready to use ZappySys XML driver to call SOAP API in your preferred BI tool or Programming language.
<ol>
 	<li>First open <strong>ODBC Data Sources</strong> (search ODBC in your start menu or go under ZappySys &gt; ODBC PowerPack &gt; <strong>ODBC 64 bit</strong>)</li>
 	<li>Goto <strong>System DSN</strong> Tab (or User DSN which is not used by Service account)</li>
 	<li>Click <strong>Add</strong> and Select ZappySys XML Driver
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/zappysys-odbc-xml-soap-api-driver.png"><img loading="lazy" decoding="async" class="size-full wp-image-3875" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-6.png" alt="ZappySys ODBC Driver for XML / SOAP API" width="593" height="459" /></a>
ZappySys ODBC Driver for XML / SOAP API</li>
 	<li>Configure API URL, Request Method and Request Body as below
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/calling-soap-web-service-zappysys-xml-driver.png"><img loading="lazy" decoding="async" class="size-full wp-image-3876" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-7.png" alt="ZappySys XML Driver - Calling SOAP API - Configure URL, Method, Body" width="916" height="874" /></a>
ZappySys XML Driver - Calling SOAP API - Configure URL, Method, Body</li>
 	<li><strong>(This step is Optional)</strong> If your SOAP API requires credentials then Select Connection Type to HTTP and configure as below.
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/soap-api-call-credential-basic-soap-wss-zappysys-xml-driver.png"><img loading="lazy" decoding="async" class="size-full wp-image-3877" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-8.png" alt="ZappySys XML Driver - Configure SOAP WSS Credentials or Basic Authorization (Userid, Password)" width="564" height="483" /></a>
<div style="display: block;">ZappySys XML Driver - Configure SOAP WSS Credentials or Basic Authorization (Userid, Password)</div></li>
 	<li>Configure-Request Headers as below (You can get it from Request &gt; Raw tab from SoapUI after you test the request by clicking the Play button)
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/set-soap-api-request-headers-zappysys-xml-driver.png"><img loading="lazy" decoding="async" class="size-full wp-image-3881" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-9.png" alt="Configure SOAP API Request Headers - ZappySys XML Driver" width="1009" height="747" /></a>
Configure SOAP API Request Headers - ZappySys XML Driver</li>
 	<li>Once credentials entered you can select Filter to extract data from the desired node. Make sure to select array node (see special icon) or select the node which contains all necessary columns if you don't have array node.
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/soap-api-query-select-filter-zappysys-xml-driver.png"><img loading="lazy" decoding="async" class="size-full wp-image-3882" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-10.png" alt="Select Filter - Extract data from nested XML / SOAP API Response (Denormalize Hierarchy)" width="809" height="594" /></a>
Select Filter - Extract data from nested XML / SOAP API Response (Denormalize Hierarchy)</li>
 	<li>If prompted select yes to treat selected node as Array (This is helpful when you expect one or more record for selected node)
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/xml-api-array-handling-zappysys-xml-driver.png"><img loading="lazy" decoding="async" class="size-full wp-image-3883" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-11.png" alt="Treat selected node as XML Array Option for SOAP API Response XML" width="655" height="572" /></a>
Treat selected node as XML Array Option for SOAP API Response XML</li>
</ol>
<h3>Preview SOAP API Response / Generate SQL Code for SOAP API Call</h3>
Once you configure settings for XML Driver now you can preview data or generate example code for desired language (e.g. C#, Python, Java, SQL Server).

Go to Preview tab and you will see default query generated based on settings you entered in previous sections. Attributes listed in WITH clause are optional. If you omit attribute in WITH clause it will use it from Properties tab.
<h3>Preview Data</h3>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/calling-soap-web-service-zappysys-xml-api-driver.png"><img loading="lazy" decoding="async" class="size-full wp-image-3884" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-12.png" alt="Preview SOAP API Response in ZappySys XML Driver" width="808" height="780" /></a>
Preview SOAP API Response in ZappySys XML Driver
<h3>Generate Code Option</h3>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/zappysys-driver-code-generator.png"><img loading="lazy" decoding="async" class="size-full wp-image-3885" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-call-soap-api-13.png" alt="Generate Example Code for ZappySys Driver" width="572" height="618" /></a>
<div style="display: block;">Generate Example Code for ZappySys Driver</div></div>
<h2>Conclusion</h2>
<p>In this article, we used ZappySys Drivers to read data from JSON REST API / File. You can use same technique to consume SOAP / XML API or File. <a href="https://zappysys.com/products/odbc-powerpack/">Try ODBC PowerPack for FREE</a> and check out how easy it is to consume virtually any REST / SOAP API or Read from JSON / XML / CSV Files in  Talend Open Studio.</p>
<p>The post <a href="https://zappysys.com/blog/read-write-rest-api-data-in-talend-json-xml-soap/">Read / Write REST API data in Talend (JSON / XML / SOAP)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Get Office 365 data in Power BI using Microsoft Graph API and ODBC</title>
		<link>https://zappysys.com/blog/get-office-365-data-in-power-bi-using-microsoft-graph-api-and-odbc/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 19 Dec 2018 17:57:00 +0000</pubDate>
				<category><![CDATA[JSON File / REST API Driver]]></category>
		<category><![CDATA[ODBC App Integration]]></category>
		<category><![CDATA[ODBC Drivers]]></category>
		<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[Reporting - Microsoft Power BI]]></category>
		<category><![CDATA[REST API]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[microsoft graph api]]></category>
		<category><![CDATA[office 365]]></category>
		<category><![CDATA[onedrive]]></category>
		<category><![CDATA[onenote]]></category>
		<category><![CDATA[power bi]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=5661</guid>

					<description><![CDATA[<p>Introduction In this article, we will get Office 365  data in Power BI using Microsoft Graph API and ODBC drivers. Specifically, we will get Excel file data in OneDrive, events from a Calendar and finally, a list in a note in OneNote and then load that data into a Power BI report. We will achieve [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-office-365-data-in-power-bi-using-microsoft-graph-api-and-odbc/">Get Office 365 data in Power BI using Microsoft Graph API and ODBC</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-6204 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/12/office-365-to-power-bi-150x150.png" alt="" width="150" height="150" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/office-365-to-power-bi-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2018/12/office-365-to-power-bi-300x300.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/12/office-365-to-power-bi.png 350w" sizes="(max-width: 150px) 100vw, 150px" />In this article, we will get <a href="https://www.office.com/" target="_blank" rel="noopener">Office 365</a>  data in Power BI using <a href="https://docs.microsoft.com/en-us/graph/overview" target="_blank" rel="noopener">Microsoft Graph API</a> and ODBC drivers. Specifically, we will get Excel file data in <a href="https://onedrive.live.com" target="_blank" rel="noopener">OneDrive</a>, events from a <a href="https://outlook.live.com/owa/?path=/calendar" target="_blank" rel="noopener">Calendar</a> and finally, a list in a note in <a href="https://www.onenote.com/" target="_blank" rel="noopener">OneNote</a> and then load that data into a Power BI report. We will achieve that by creating an ODBC data source using <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> and then querying corresponding <a href="https://docs.microsoft.com/en-us/graph/overview" target="_blank" rel="noopener">Microsoft Graph API</a> methods. ODBC PowerPack allows to query REST/SOAP APIs in an easy way and lets to view responses in a tabular format, which will be perfect to accomplish our goal.</p>
<p>&nbsp;</p>
<h2>Prerequisites</h2>
<ol>
<li>A Power BI account.</li>
<li>Wield basic Power BI skills.</li>
<li><a href="https://powerbi.microsoft.com/en-us/desktop/" target="_blank" rel="noopener">Power BI Desktop</a> installed.</li>
<li><a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> installed.</li>
</ol>
<h2>Step By Step &#8211; Get Office 365 data in Power BI using Microsoft Graph API and ODBC</h2>
<div class="content_block" id="custom_post_widget-5670"><h2 style="text-align: left;">Register Application (OAuth2 App for Graph API)</h2>
<p style="text-align: left;">The first step to access any Office 365 API / Graph API is to register an OAuth App in the Azure Portal. After
following these steps, you will get the following two items to use in the next section:</p>

<ul style="text-align: left;">
 	<li>Application Id</li>
 	<li>Application Secret</li>
</ul>
<p style="text-align: left;">In this section, you will learn how to register a custom app in Microsoft Azure portal that will allow access to the
OneDrive. So, let's get started -</p>

<ol>
 	<li style="text-align: left;">Log into <a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps">Microsoft
Azure portal</a> to register a custom app.</li>
 	<li style="text-align: left;">Register a new application by clicking New Registration link.<a href="https://zappysys.com/blog/wp-content/uploads/2020/07/NewRegistration.png"><img loading="lazy" decoding="async" class="size-full wp-image-9034" src="https://zappysys.com/blog/wp-content/uploads/2020/07/NewRegistration.png" alt="New App Registration in Azure portal" width="748" height="221" srcset="https://zappysys.com/blog/wp-content/uploads/2020/07/NewRegistration.png 748w, https://zappysys.com/blog/wp-content/uploads/2020/07/NewRegistration-300x89.png 300w" sizes="(max-width: 748px) 100vw, 748px" /></a></li>
 	<li style="text-align: left;">Provide the name of the custom app and who can access the app in the organization.<a href="https://zappysys.com/blog/wp-content/uploads/2020/07/RegisterOneDriveApp-1.jpg"><img loading="lazy" decoding="async" class="wp-image-9005 size-full" src="https://zappysys.com/blog/wp-content/uploads/2020/07/RegisterOneDriveApp-1.jpg" alt="Register an OneDrive App" width="610" height="518" srcset="https://zappysys.com/blog/wp-content/uploads/2020/07/RegisterOneDriveApp-1.jpg 610w, https://zappysys.com/blog/wp-content/uploads/2020/07/RegisterOneDriveApp-1-300x255.jpg 300w" sizes="(max-width: 610px) 100vw, 610px" /></a></li>
 	<li style="text-align: left;">Go to the App overview and add a Redirect URL.<a href="https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI-1.jpg"><img loading="lazy" decoding="async" class="wp-image-9044 size-full" src="https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI-1.jpg" alt="Add a Redirect URL" width="937" height="122" srcset="https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI-1.jpg 937w, https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI-1-300x39.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI-1-768x100.jpg 768w" sizes="(max-width: 937px) 100vw, 937px" /></a></li>
 	<li style="text-align: left;">Click on "Add a Platform" under Platform Configuration section and then select "Web" under Web applications
section to enter a Redirect URL.
<pre class="lang:default decode:true">https://zappysys.com/oauth</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI2.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-9007" src="https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI2.jpg" alt="Redirect URL" width="466" height="564" srcset="https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI2.jpg 466w, https://zappysys.com/blog/wp-content/uploads/2020/07/RedirectURI2-248x300.jpg 248w" sizes="(max-width: 466px) 100vw, 466px" /></a></li>
 	<li style="text-align: left;">Create a Client Secret key which will be used to Authenticate the custom Azure app.<a href="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-9010" src="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret.jpg" alt="Add a Client Secret" width="576" height="403" srcset="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret.jpg 576w, https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret-300x210.jpg 300w" sizes="(max-width: 576px) 100vw, 576px" /></a><a href="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret2.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-9011" src="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret2.jpg" alt="Secret Key Expiration Period" width="208" height="259" /></a><a href="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret3.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-9012" src="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret3.jpg" alt="Specify Secret Key" width="1024" height="176" srcset="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret3.jpg 1024w, https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret3-300x52.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret3-768x132.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a>
<div><strong>Note</strong> - Take a note of <strong>Client Secret</strong>, it will be required while
configuring OAuth connection in the SSIS later</div></li>
 	<li style="text-align: left;">Add API Permissions.<a href="https://zappysys.com/blog/wp-content/uploads/2020/07/APIPermissions.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-9008" src="https://zappysys.com/blog/wp-content/uploads/2020/07/APIPermissions.jpg" alt="OneDrive API Permissions" width="1291" height="415" /></a></li>
 	<li style="text-align: left;">Select following permissions from the Delegated Permissions section.
<pre class="lang:default decode:true">User.ReadBasic.All
Files.Read
offline_access</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2020/07/APIPermissions2.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-9009" src="https://zappysys.com/blog/wp-content/uploads/2020/07/APIPermissions2.jpg" alt="Select Delegated Permissions" width="512" height="571" srcset="https://zappysys.com/blog/wp-content/uploads/2020/07/APIPermissions2.jpg 512w, https://zappysys.com/blog/wp-content/uploads/2020/07/APIPermissions2-269x300.jpg 269w" sizes="(max-width: 512px) 100vw, 512px" /></a></li>
 	<li>Take a note of Client ID, it will be required while configuring OAuth connection in the SSIS later.<a href="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret4.jpg"><img loading="lazy" decoding="async" class="wp-image-9013 size-full alignleft" src="https://zappysys.com/blog/wp-content/uploads/2020/07/ClientSecret4.jpg" alt="App Client ID" width="810" height="274" /></a></li>
</ol></div>
<div class="content_block" id="custom_post_widget-5914"><h3>Open ODBC Data Source Administrator</h3>
<ol>
 	<li>Hit <em>Windows Start</em> button and search for "odbc".</li>
 	<li>You will see two versions of <em>ODBC Data Source administrator</em>: <strong>64-bit </strong>and <strong>32-bit</strong>. Choose:
<ol>
 	<li style="list-style-type: none;">
<ul style="margin-left: 0px;">
 	<li>64-bit if your client application is a 64-bit program and you plan to create a <em>System DSN</em>.</li>
 	<li>32-bit if your client application is a 32-bit program and you plan to create a <em>System DSN</em>.</li>
 	<li>32-bit or 64-bit version if you plan to create a <em>User DSN</em>.</li>
</ul>
</li>
</ol>
<div class="wp-caption alignnone">

<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6213" src="https://zappysys.com/blog/wp-content/uploads/2019/01/how-to-open-odbc-data-source-administrator-2.png" alt="" width="394" height="542" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/how-to-open-odbc-data-source-administrator-2.png 394w, https://zappysys.com/blog/wp-content/uploads/2019/01/how-to-open-odbc-data-source-administrator-2-218x300.png 218w" sizes="(max-width: 394px) 100vw, 394px" />
<p class="wp-caption-text">Windows ODBC Data Sources</p>

</div></li>
 	<li>Once you open, you should see a similar window:
<div class="wp-caption">

<img loading="lazy" decoding="async" class="alignnone size-full wp-image-5915" src="https://zappysys.com/blog/wp-content/uploads/2019/01/open-odbc-data-source-administrator-to-get-data-in-power-bi.png" alt="" width="594" height="421" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/open-odbc-data-source-administrator-to-get-data-in-power-bi.png 594w, https://zappysys.com/blog/wp-content/uploads/2019/01/open-odbc-data-source-administrator-to-get-data-in-power-bi-300x213.png 300w" sizes="(max-width: 594px) 100vw, 594px" />
<p class="wp-caption-text">ODBC Data Source Administrator</p>

</div></li>
</ol></div>
<h3>Set up an ODBC data source based on ZappySys JSON Driver</h3>
<h4>Add a data source</h4>
<div class="content_block" id="custom_post_widget-6052"><ol>
 	<li>Go to <em>System DSN</em> and press <em>Add</em> to add a system DSN. If you use apps like Power BI which needs access only your User account then you can create User DSN.<img loading="lazy" decoding="async" class="wp-image-2927 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/odb-data-source-administrator-add.png" alt="Create new ODBC DSN (System DSN Tab)" width="590" height="419" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/odb-data-source-administrator-add.png 590w, https://zappysys.com/blog/wp-content/uploads/2018/03/odb-data-source-administrator-add-300x213.png 300w" sizes="(max-width: 590px) 100vw, 590px" /></li>
 	<li>Add a data source based on <em>ZappySys JSON Driver</em>:
<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/add-zappysys-json-driver.png"><img loading="lazy" decoding="async" class="wp-image-2923 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/add-zappysys-json-driver.png" alt="Add ZappySys JSON / REST Driver Connection" width="464" height="352" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/add-zappysys-json-driver.png 464w, https://zappysys.com/blog/wp-content/uploads/2018/03/add-zappysys-json-driver-300x228.png 300w" sizes="(max-width: 464px) 100vw, 464px" /></a></li>
</ol></div>
<h4>Configure the data source</h4>
<div class="content_block" id="custom_post_widget-6064"><ol>
 	<li>Once a window appears, give a name to the data source, e.g. <strong>System - JSON:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6182" src="https://zappysys.com/blog/wp-content/uploads/2019/01/get-data-from-office-365-using-microsoft-graph-api-and-odbc-powerpack-1.png" alt="" width="697" height="745" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/get-data-from-office-365-using-microsoft-graph-api-and-odbc-powerpack-1.png 697w, https://zappysys.com/blog/wp-content/uploads/2019/01/get-data-from-office-365-using-microsoft-graph-api-and-odbc-powerpack-1-281x300.png 281w" sizes="(max-width: 697px) 100vw, 697px" />
</strong></li>
 	<li>Then input <strong>https://graph.microsoft.com/v1.0/me</strong> in the URL field.</li>
 	<li>Select <strong>OAuth</strong> as the <em>Connection Type</em>.</li>
 	<li>Click <strong>Click to Configure</strong> button/link to open OAuth configuration window.</li>
 	<li>Select <strong>Custom</strong> as <em>OAuth Provider</em>.</li>
 	<li>Then input <em>Client Id, Client Secret</em> which we got when created the Graph API application.</li>
 	<li>Set <strong>https://login.microsoftonline.com/common/oauth2/v2.0/authorize</strong> as <em>Authorization Url.</em></li>
 	<li>Set <strong>https://login.microsoftonline.com/common/oauth2/v2.0/token</strong> as <em>Access Token Url</em>.</li>
 	<li>In <em>Scopes / Permissions</em> section set these scopes, separated by a new line. E.g. <strong>offline_access</strong>, <strong>Files.Read.All</strong>, <strong>Calendars</strong>.<strong>Read</strong>, <strong>Notes.Read, User.Read</strong></li>
 	<li>In <em>Advanced </em>tab configure <em>Callback/Redirect Url </em>and set it to the one we configured in Graph API app:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6060" src="https://zappysys.com/blog/wp-content/uploads/2018/12/oauth-callback-return-url-configuration-for-office-365-app-in-odbc-powerpack.png" alt="" width="586" height="271" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/oauth-callback-return-url-configuration-for-office-365-app-in-odbc-powerpack.png 586w, https://zappysys.com/blog/wp-content/uploads/2018/12/oauth-callback-return-url-configuration-for-office-365-app-in-odbc-powerpack-300x139.png 300w" sizes="(max-width: 586px) 100vw, 586px" /></li>
 	<li>Finally, click <strong>Generate Token </strong>button to generate a token.</li>
 	<li>Click <strong>OK</strong> to close the window.</li>
</ol></div>
<h3>Set up an ODBC data source based on ZappySys XML Driver</h3>
<div class="content_block" id="custom_post_widget-6075"><ol>
 	<li>Before adding another data source based on ZappySys XML Driver, copy the connection string of the data source we just created:
<img loading="lazy" decoding="async" class="wp-image-6062 size-full alignnone" style="margin-right: 100px;" src="https://zappysys.com/blog/wp-content/uploads/2018/12/copy-connection-string-of-odbc-datasource-for-office-365-e1547488424263.png" alt="" width="529" height="210" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/copy-connection-string-of-odbc-datasource-for-office-365-e1547488424263.png 529w, https://zappysys.com/blog/wp-content/uploads/2018/12/copy-connection-string-of-odbc-datasource-for-office-365-e1547488424263-300x119.png 300w" sizes="(max-width: 529px) 100vw, 529px" /></li>
 	<li>Close the window and then add a new data source, but this time based on <em>ZappySys XML Driver</em>.</li>
 	<li>Once a window is opened, give it a name, e.g. <strong>System - XML</strong>.</li>
 	<li>Then press <strong>Load connection string</strong> button to load the connection string.</li>
 	<li>Paste the copied connection string and replace JSON text to XML, so that you have <strong>{ ZappySys XML Driver }</strong> in <em>DRIVER</em> property.</li>
 	<li>Close the window.</li>
</ol>
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6184" src="https://zappysys.com/blog/wp-content/uploads/2019/01/load-connection-string-in-odbc-data-source-for-office-365-graph-api-app-1.png" alt="" width="652" height="416" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/load-connection-string-in-odbc-data-source-for-office-365-graph-api-app-1.png 652w, https://zappysys.com/blog/wp-content/uploads/2019/01/load-connection-string-in-odbc-data-source-for-office-365-graph-api-app-1-300x191.png 300w" sizes="(max-width: 652px) 100vw, 652px" /></div>
<h3>Create a Power BI report</h3>
<h4>Reading files from OneDrive (getting Excel data)</h4>
<p>Let&#8217;s say you have Stock.xlsx stored in <em>Sample Documents</em> folder, OneDrive with this kind of data and you want to show it in a Power BI report:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6081" src="https://zappysys.com/blog/wp-content/uploads/2018/12/stock.xlsx.png" alt="" width="261" height="151" /></p>
<p>To have that data in a Power BI report, perform these steps:</p>
<ol style="margin-left: 0;">
<li>Open Power BI Desktop and create a new Power BI report.</li>
<li>Create a data source based on <strong>System &#8211; JSON</strong> DSN (since we get a JSON response):<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6191" style="border: 1px solid grey;" src="https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-office-365-data-2.png" alt="" width="695" height="518" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-office-365-data-2.png 695w, https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-office-365-data-2-300x224.png 300w" sizes="(max-width: 695px) 100vw, 695px" /></li>
<li style="text-align: justify;">Then in <em>SQL statement</em> area enter this query:<br />
<code>SELECT * FROM $<br />
WITH(Src='https://graph.microsoft.com/v1.0/me/drive/root:/<strong>YOUR FOLDER</strong>/Stock.xlsx:/workbook/worksheets/<strong>SHEET NAME</strong>/usedRange'<br />
,Filter='$.values[1:]'<br />
,ArrayTransformType='TransformSimpleTwoDimensionalArray'<br />
,ArrayTransColumnNameFilter='$.values[0][*]'<br />
)<br />
</code>Using <em>WITH</em> clause lets us override the properties. You can generate the query above using the <em>Query Builder</em>:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6189" src="https://zappysys.com/blog/wp-content/uploads/2018/12/use-query-builder-in-odbc-powerpack-to-override-the-properties.png" alt="" width="545" height="297" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/use-query-builder-in-odbc-powerpack-to-override-the-properties.png 545w, https://zappysys.com/blog/wp-content/uploads/2018/12/use-query-builder-in-odbc-powerpack-to-override-the-properties-300x163.png 300w" sizes="(max-width: 545px) 100vw, 545px" />In this step we are overriding Url, Filter and array transformation fields you configured in JSON DSN. The <em>Src</em> value overrides the URL. The <em>Filter</em> property enables us to select the data we want to see in the report. We use <strong>[1:]</strong> in <strong>$.values[1:] </strong>to skip the first row because the first row contains the headers and we want only the data. You can configure this option in the <em>Filter Options</em> tab (<a href="https://goessner.net/articles/JsonPath/" target="_blank" rel="noopener">read more about JSON path</a>).We also have to make the transformation on the JSON and turn JSON arrays into rows. To accomplish that, we override <em>ArrayTransformType. </em>With <em>ArrayTransColumnNameFilter</em> property and <strong>[0][*]</strong> text, we specify that the first array of parent array will be the headers of the columns. You can read more about transformations in <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">Parse multi-dimensional JSON array</a> article.<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;"><strong>Note:</strong> Use <a href="https://developer.microsoft.com/en-us/graph/graph-explorer/" target="_blank" rel="noopener">Microsoft Graph API Explorer</a> to make a call and see what response you get. You can try calling <a href="https://docs.microsoft.com/en-us/graph/onedrive-concept-overview" target="_blank" rel="noopener">other OneDrive endpoints</a>.</div></div></li>
<li>Click <strong>OK</strong>.</li>
<li>Drag a table into the report, select the columns and you should see a similar view:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6087" src="https://zappysys.com/blog/wp-content/uploads/2018/12/get-excel-data-into-power-bi-using-odbc-powerpack-and-microsoft-graph-api-1.png" alt="" width="236" height="216" /></li>
</ol>
<h4>Reading calendar entries</h4>
<p>Now, let&#8217;s say you use a calendar in Office 365 and you want your appointments to be visible in a Power BI report:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6101" src="https://zappysys.com/blog/wp-content/uploads/2018/12/calendar-in-office-365.png" alt="" width="590" height="222" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/calendar-in-office-365.png 590w, https://zappysys.com/blog/wp-content/uploads/2018/12/calendar-in-office-365-300x113.png 300w" sizes="(max-width: 590px) 100vw, 590px" /></p>
<ol>
<li>To start, create a new Power BI report.</li>
<li>Then add a data source based on <strong>System &#8211; JSON </strong>DSN (again, we get the response in JSON):<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6187" src="https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-calendar-events-in-office-365-b-1.png" alt="" width="701" height="524" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-calendar-events-in-office-365-b-1.png 701w, https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-calendar-events-in-office-365-b-1-300x224.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></li>
<li style="text-align: justify;">In <em>SQL statement</em> section enter this query:<br />
<code>SELECT * FROM $<br />
WITH(Src='https://graph.microsoft.com/v1.0/me/events?$select=subject,start,end,location'<br />
,Filter='$.value[*]'<br />
,Header='Prefer: outlook.timezone="FLE Standard Time"'<br />
)</code>Here we also are overriding <em>HTTP Header</em> so that we get the event times not in UTC/GMT but for the specified timezone. It must be specified in <strong>Prefer: outlook.timezone=&#8221;{time-zone-string}&#8221;</strong> format (check <a href="https://graph.microsoft.com/v1.0/me/outlook/supportedTimeZones" target="_blank" rel="noopener">an article</a> on how to get a list of supported time zones).<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;"><strong>Note:</strong> Use <a href="https://developer.microsoft.com/en-us/graph/graph-explorer/" target="_blank" rel="noopener">Microsoft Graph API Explorer</a> to make a call and see what response you get. You can try calling <a href="https://docs.microsoft.com/en-us/graph/outlook-calendar-concept-overview" target="_blank" rel="noopener">other Calendar endpoints</a>.</div></div></li>
<li>Click <strong>OK</strong>.</li>
<li>Drag a table control into the report, select several columns and you should see a similar view:<br />
<img loading="lazy" decoding="async" class="alignnone wp-image-6102 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/12/office-365-calendar-appointments-in-power-bi-report-retrieved-with-odbc-powerpack-e1547658449371.png" alt="" width="490" height="214" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/office-365-calendar-appointments-in-power-bi-report-retrieved-with-odbc-powerpack-e1547658449371.png 490w, https://zappysys.com/blog/wp-content/uploads/2018/12/office-365-calendar-appointments-in-power-bi-report-retrieved-with-odbc-powerpack-e1547658449371-300x131.png 300w" sizes="(max-width: 490px) 100vw, 490px" /></li>
</ol>
<h4>Reading notes from OneNote</h4>
<p>Suppose, you have these notes in OneNote and you want &#8220;<em>Groceries list</em>&#8221; to be shown in a Power BI report:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6114" src="https://zappysys.com/blog/wp-content/uploads/2018/12/notes-in-onenote.png" alt="" width="516" height="189" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/notes-in-onenote.png 516w, https://zappysys.com/blog/wp-content/uploads/2018/12/notes-in-onenote-300x110.png 300w" sizes="(max-width: 516px) 100vw, 516px" /></p>
<ol>
<li>First, we will need to find NOTE ID we are trying to get. To do that, open <em>ODBC Administrator</em>, find <strong>System &#8211; JSON</strong> data source and hit <strong>Configure</strong>.</li>
<li>Then go to <em>the Preview</em> tab, and input this SQL query and hit <strong>Preview Data</strong>:<br />
<code>SELECT * FROM $<br />
WITH (Src='https://graph.microsoft.com/v1.0/me/onenote/pages'<br />
,Filter='$.value[*]'<br />
)</code></li>
<li>Once you get a result set, find your note name and copy its ID:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6192" src="https://zappysys.com/blog/wp-content/uploads/2018/12/using-odbc-powerpack-get-note-id-in-onenote-part-of-office-365-1.png" alt="" width="676" height="593" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/using-odbc-powerpack-get-note-id-in-onenote-part-of-office-365-1.png 676w, https://zappysys.com/blog/wp-content/uploads/2018/12/using-odbc-powerpack-get-note-id-in-onenote-part-of-office-365-1-300x263.png 300w" sizes="(max-width: 676px) 100vw, 676px" /></li>
<li>Then create a new Power BI report.</li>
<li>Create a new data source based on <strong>System &#8211; XML</strong> DSN (we are using XML-based DSN because the response will be in HTML):<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6193" src="https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-onenote-notes-in-office-365-1.png" alt="" width="701" height="524" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-onenote-notes-in-office-365-1.png 701w, https://zappysys.com/blog/wp-content/uploads/2018/12/create-odbc-data-source-in-power-bi-report-to-get-onenote-notes-in-office-365-1-300x224.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></li>
<li>In <em>SQL statement</em> section enter this query (use the NOTE ID you retrieved in the previous step):<br />
<code>SELECT * FROM $<br />
WITH(ElementsToTreatAsArray='div,p'<br />
,Src='https://graph.microsoft.com/v1.0/me/onenote/pages/<strong>NOTE ID</strong>/content'<br />
,Filter='$.html.body.div[0].p[1:]'<br />
)<br />
</code><br />
<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;"><strong>Note:</strong> Use <a href="https://developer.microsoft.com/en-us/graph/graph-explorer/" target="_blank" rel="noopener">Microsoft Graph API Explorer</a> to make a call and see what response you get. You can try calling <a href="https://docs.microsoft.com/en-us/graph/integrate-with-onenote" target="_blank" rel="noopener">other OneNote endpoints</a>.</div></div></li>
<li style="text-align: justify;">Click <strong>OK</strong>.</li>
<li>Drag and drop <em>Multi-row card</em> visual, select <strong>#text</strong> column and you should see a similar view:<br />
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-6145" src="https://zappysys.com/blog/wp-content/uploads/2018/12/note-to-buy.png" alt="" width="288" height="288" srcset="https://zappysys.com/blog/wp-content/uploads/2018/12/note-to-buy.png 288w, https://zappysys.com/blog/wp-content/uploads/2018/12/note-to-buy-150x150.png 150w" sizes="(max-width: 288px) 100vw, 288px" /></li>
<li>We finished! Now you can publish your Power BI reports to Power BI service.</li>
</ol>
<div class="content_block" id="custom_post_widget-5891"><h2>Working with Gateways in Power BI (Schedule Import)</h2>
If the data needs to be updated, it is necessary to create a gateway on-premises. In this new section, we will install a Power BI Gateway and in the next section schedule it to update the REST API information.
<ol>
 	<li>In the last section, we Published the report. Power BI may ask you to <strong>SIGN IN.</strong>
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/sign-in-power-bi.png"><img loading="lazy" decoding="async" class="size-full wp-image-2879" src="https://zappysys.com/blog/wp-content/uploads/2018/03/sign-in-power-bi.png" alt="Sign in Power BI" width="762" height="361" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/sign-in-power-bi.png 762w, https://zappysys.com/blog/wp-content/uploads/2018/03/sign-in-power-bi-300x142.png 300w" sizes="(max-width: 762px) 100vw, 762px" /></a>
<p class="wp-caption-text">Sign in in Power BI</p>

</div></li>
 	<li>Select the Workspace and select Datasets
<div class="wp-caption">

[caption id="attachment_10110" align="alignnone" width="702"]<a href="https://zappysys.com/blog/wp-content/uploads/2019/01/power-bi-my-workspace-dataset.png"><img loading="lazy" decoding="async" class="wp-image-10110 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/01/power-bi-my-workspace-dataset.png" alt="power-bi-my-workspace-dataset" width="702" height="372" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/power-bi-my-workspace-dataset.png 702w, https://zappysys.com/blog/wp-content/uploads/2019/01/power-bi-my-workspace-dataset-300x159.png 300w" sizes="(max-width: 702px) 100vw, 702px" /></a> Go to workspace and dataset[/caption]
<p class="wp-caption-text">Go to workspace and dataset</p>

</div></li>
 	<li>Right-click the report and select <strong>Settings</strong>.
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/report-power-bi-settings.png"><img loading="lazy" decoding="async" class="size-full wp-image-2877" src="https://zappysys.com/blog/wp-content/uploads/2018/03/report-power-bi-settings.png" alt="Define settings for Power BI report" width="535" height="325" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/report-power-bi-settings.png 535w, https://zappysys.com/blog/wp-content/uploads/2018/03/report-power-bi-settings-300x182.png 300w" sizes="(max-width: 535px) 100vw, 535px" /></a>
<p class="wp-caption-text">Specify settings for the report</p>

</div></li>
 	<li>The system will ask for a Gateway. Stay here.
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/add-power-bi-gateway.png"><img loading="lazy" decoding="async" class="size-full wp-image-2862" src="https://zappysys.com/blog/wp-content/uploads/2018/03/add-power-bi-gateway.png" alt="add power bi gateway" width="1068" height="380" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/add-power-bi-gateway.png 1068w, https://zappysys.com/blog/wp-content/uploads/2018/03/add-power-bi-gateway-300x107.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/03/add-power-bi-gateway-768x273.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/03/add-power-bi-gateway-1024x364.png 1024w" sizes="(max-width: 1068px) 100vw, 1068px" /></a>
<p class="wp-caption-text">Add Power BI Gateway</p>

</div></li>
 	<li>Use the following link to install a Data Gateway:
<pre class="lang:php highlight:0 decode:true">https://docs.microsoft.com/en-us/power-bi/service-gateway-onprem</pre>
</li>
 	<li>Run the installer and press <strong>Next</strong>
<div class="wp-caption">

<img loading="lazy" decoding="async" class="size-full wp-image-2888" src="https://zappysys.com/blog/wp-content/uploads/2018/03/on-premises-gateway-installer-PB.png" alt="Initial gateway window for installation" width="634" height="504" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/on-premises-gateway-installer-PB.png 634w, https://zappysys.com/blog/wp-content/uploads/2018/03/on-premises-gateway-installer-PB-300x238.png 300w" sizes="(max-width: 634px) 100vw, 634px" />
<p class="wp-caption-text">Gateway installer</p>

</div></li>
 	<li>Select the option On-premises data gateway (recommended). This option allows access to multiple users and can be used by more applications than Power BI.
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/choose-power-bi-on-premises-data-pb.png"><img loading="lazy" decoding="async" class="size-full wp-image-2889" src="https://zappysys.com/blog/wp-content/uploads/2018/03/choose-power-bi-on-premises-data-pb.png" alt="Choose Power BI gateway" width="631" height="501" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/choose-power-bi-on-premises-data-pb.png 631w, https://zappysys.com/blog/wp-content/uploads/2018/03/choose-power-bi-on-premises-data-pb-300x238.png 300w" sizes="(max-width: 631px) 100vw, 631px" /></a>
<p class="wp-caption-text">Choose Power BI option</p>

</div></li>
 	<li>The installer will show a warning message.
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-warning-PB-msg.png"><img loading="lazy" decoding="async" class="size-full wp-image-2891" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-warning-PB-msg.png" alt="Warning message gateway installation" width="628" height="447" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-warning-PB-msg.png 628w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-warning-PB-msg-300x214.png 300w" sizes="(max-width: 628px) 100vw, 628px" /></a>
<p class="wp-caption-text">Warning message during installation</p>

</div></li>
 	<li>Select the path to install and check the I accept the terms.
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-installation-accept.png"><img loading="lazy" decoding="async" class="size-full wp-image-2916" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-installation-accept.png" alt="accept terms" width="636" height="441" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-installation-accept.png 636w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-installation-accept-300x208.png 300w" sizes="(max-width: 636px) 100vw, 636px" /></a>
<p class="wp-caption-text">Accept terms</p>

</div></li>
 	<li>Specify the email address to use the gateway.
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-installation-email-address.png"><img loading="lazy" decoding="async" class="size-full wp-image-2895" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-installation-email-address.png" alt="Register email in gateway installation" width="627" height="578" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-installation-email-address.png 627w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-installation-email-address-300x277.png 300w" sizes="(max-width: 627px) 100vw, 627px" /></a>
<p class="wp-caption-text">Register email address</p>

</div></li>
 	<li>After entering the email, write the gateway name and a recovery key. Make sure to confirm the recovery key.
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-name-recovery-key-confirm.png"><img loading="lazy" decoding="async" class="size-full wp-image-2896" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-name-recovery-key-confirm.png" alt="Specify name and recovery key" width="629" height="487" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-name-recovery-key-confirm.png 629w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-gateway-name-recovery-key-confirm-300x232.png 300w" sizes="(max-width: 629px) 100vw, 629px" /></a>
<p class="wp-caption-text">Enter recovery key</p>

</div></li>
</ol>
&nbsp;</div>
<div class="content_block" id="custom_post_widget-5892"><h2>Manage gateways and configure the schedule</h2>
Once that the gateway is installed we will configure it and add the connection strings.
<ol>
 	<li>The next step is to go to manage gateway
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-go-to-manage-gateway.png"><img loading="lazy" decoding="async" class="size-full wp-image-2912" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-go-to-manage-gateway.png" alt="Power BI - Manage Gateway Setting" width="1068" height="380" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-go-to-manage-gateway.png 1068w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-go-to-manage-gateway-300x107.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-go-to-manage-gateway-768x273.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-go-to-manage-gateway-1024x364.png 1024w" sizes="(max-width: 1068px) 100vw, 1068px" /></a>
<p class="wp-caption-text">Power BI - Manage Gateway Setting</p>

</div></li>
 	<li>In order to get the connection string, we will need the connection string of the ZappySys JSON Driver. In the first section of this post, we explained how to configure it. Press<strong> Copy Connection String</strong>
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-data-source-copy-connection-string.png"><img loading="lazy" decoding="async" class="size-full wp-image-2866" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-data-source-copy-connection-string.png" alt="ZappySys connection properties" width="607" height="599" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-data-source-copy-connection-string.png 607w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-data-source-copy-connection-string-300x296.png 300w" sizes="(max-width: 607px) 100vw, 607px" /></a>
<p class="wp-caption-text">Connection properties</p>

</div></li>
 	<li>Once that the data is copied, add a New data Source. In <strong>Data Source Name</strong>, enter the Data Source Name of the ZappySys JSON driver in step 13 and in Data Source Type, select ODBC. In connection string copy and paste from the clipboard of the step 13 and press <strong>Add</strong>.
<div class="wp-caption">

[caption id="attachment_10113" align="alignnone" width="720"]<a href="https://zappysys.com/blog/wp-content/uploads/2019/01/gateway-data-source-name-connection-string.png"><img loading="lazy" decoding="async" class="wp-image-10113 size-large" src="https://zappysys.com/blog/wp-content/uploads/2019/01/gateway-data-source-name-connection-string-1024x536.png" alt="gateway-data-source-name-connection-string" width="720" height="377" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/gateway-data-source-name-connection-string-1024x536.png 1024w, https://zappysys.com/blog/wp-content/uploads/2019/01/gateway-data-source-name-connection-string-300x157.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/gateway-data-source-name-connection-string-768x402.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/01/gateway-data-source-name-connection-string.png 1043w" sizes="(max-width: 720px) 100vw, 720px" /></a> ZappySys connection properties in Power BI[/caption]
<p class="wp-caption-text">ZappySys connection properties in Power BI</p>

</div></li>
 	<li>Once added the gateway. You can see the schedule refresh to <strong>On </strong>and Add another time to add the time where you want to refresh the data.
<div class="wp-caption">

<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-schedule.png"><img loading="lazy" decoding="async" class="size-full wp-image-2875" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-schedule.png" alt="Schedule gateway" width="451" height="401" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-schedule.png 451w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-schedule-300x267.png 300w" sizes="(max-width: 451px) 100vw, 451px" /></a>
<p class="wp-caption-text">Schedule gateway</p>

</div></li>
</ol>
&nbsp;</div>
<h2>Conclusion</h2>
<p style="text-align: justify;">Today we learned how to call Microsoft Graph API methods using <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> and load response data into Power BI without any ETL procedures. Particularly, we used OneDrive, Calendar and OneNote Graph API endpoints to achieve that. We created two ODBC data sources based on JSON and XML ODBC Driver to query those endpoints, which let us read data directly in a Power BI report. Finally, we examined how to refresh data source on Power BI using on-premises Power BI gateway.</p>
<h2>References</h2>
<p><a href="https://powerbi.microsoft.com/en-us/" target="_blank" rel="noopener">https://powerbi.microsoft.com/en-us/</a></p>
<p><a href="https://apps.dev.microsoft.com/" target="_blank" rel="noopener">https://apps.dev.microsoft.com/</a></p>
<p><a href="https://developer.microsoft.com/en-us/graph/graph-explorer/" target="_blank" rel="noopener">https://developer.microsoft.com/en-us/graph/graph-explorer/</a></p>
<p><a href="https://docs.microsoft.com/en-us/graph/overview" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/graph/overview</a></p>
<p><a href="https://docs.microsoft.com/en-us/graph/onedrive-concept-overview" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/graph/onedrive-concept-overview</a></p>
<p><a href="https://docs.microsoft.com/en-us/graph/outlook-calendar-concept-overview" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/graph/outlook-calendar-concept-overview</a></p>
<p><a href="https://docs.microsoft.com/en-us/graph/integrate-with-onenote" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/graph/integrate-with-onenote</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/get-office-365-data-in-power-bi-using-microsoft-graph-api-and-odbc/">Get Office 365 data in Power BI using Microsoft Graph API and ODBC</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
