<?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>ssis json source Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/ssis-json-source/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/ssis-json-source/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Tue, 23 Dec 2025 14:14:42 +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>ssis json source Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/ssis-json-source/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to read large XML / JSON file in SSIS (3 Million Rows in 3 Mins)</title>
		<link>https://zappysys.com/blog/read-large-xml-json-file-ssis-fast-process-million-rows/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 08 Jan 2018 16:55:09 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[performance tips]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[ssis xml source]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2467</guid>

					<description><![CDATA[<p>Introduction In this post we will learn how to use ZappySys SSIS XML Source or ZappySys SSIS JSON Source  to read large XML or JSON File (Process 3 Million rows in 3 minutes &#8211; 1.2 GB file). If you use default settings to read data then it may result into OutOfMemory Exception so we will outline [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-large-xml-json-file-ssis-fast-process-million-rows/">How to read large XML / JSON file in SSIS (3 Million Rows in 3 Mins)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this post we will learn how to use <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys SSIS XML Source</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys SSIS JSON Source</a>  to read large XML or JSON File (Process 3 Million rows in 3 minutes &#8211; 1.2 GB file).</p>
<p>If you use default settings to read data then it may result into OutOfMemory Exception so we will outline few techniques which will enable high performance Streaming Mode rather than In-memory load of entire file.</p>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we parse very large XML or JSON files using SSIS , you will need to make sure following prerequisites are met.</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<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>You have at least two sample files&#8230; One file must be small dataset (less than 10 MB if possible). We will  use small dataset file during design mode to get metadata and see data preview on the Component UI.</li>
<li>Second XML file is the big file with full dataset you like to parse at runtime.</li>
<li>Make sure <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>SSIS PowerPack</em></a> is installed. <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">Click here to download</a>.</li>
</ol>
<p>&nbsp;</p>
<h2>Step-By-Step : Reading large XML file (SSIS XML Source)</h2>
<p>Now let&#8217;s look at how to read large XML file (e.g. 3 Million rows or more) using <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys XML Source</a> in SSIS. Below steps are identical for  <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON Source</a>  too (Except Step#7).</p>
<ol>
<li>Open SSIS Designer and drag Data Flow from SSIS Toolbox</li>
<li>Double click Data Flow Task to switch to Data flow designer</li>
<li>Now drag ZS XML Source on the surface from SSIS Toolbox.</li>
<li>Double click ZS XML Source and specify <pre class="crayon-plain-tag">small dataset file</pre>  path you like to parse. (e.g.  c:\data\customer_small.xml )</li>
<li>Click on Select Filter button to find Node which will be treated as Array. Once you close the Filter Browse Dialog. Append <pre class="crayon-plain-tag">--FAST</pre>  Your Expression may look like below.<br />
<pre class="crayon-plain-tag">$.Root.Row--FAST</pre></li>
<li>Now <strong>uncheck  </strong> <pre class="crayon-plain-tag">Include Parent Columns option</pre></li>
<li><strong>Check </strong><pre class="crayon-plain-tag">Enable Performance Option</pre><strong><strong><strong>  (For JSON Source Skip this step)</strong></strong></strong><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: Try to enable Performance mode setting after you Select Filter (by using smaller dataset file). Once filter is set you can check enable performance mode and make sure following two settings are correctly set (Option#2 needs new version &#8211; SSIS v4.1+ / ODBC v1.4+).<br />
(1) On <strong>Array Handling Tab</strong> &#8211; Set Array node name (must be <strong>only one entry</strong>). For example your Filter is $.DATA.ORDER[*] then you can enter <pre class="crayon-plain-tag">ORDER</pre>
(2) On <strong>Advanced Filter Options Tab</strong> &#8211; Enter all unwanted Tag names you like to Skip. For example if you have other arrays like PRODUCT or CUSTOMER then enter <pre class="crayon-plain-tag">PRODUCT,CUSTOMER</pre>
</div></div><strong><strong><br />
</strong></strong></li>
<li>Your setting may look like below<br />
<strong><strong><br />
</strong></strong></p>
<div id="attachment_2472" style="width: 1006px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-2472" class="size-full wp-image-2472" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode.png" alt="Configure XML source or JSON Source for Very Large Data File (Streaming mode for High Performance)" width="996" height="708" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode.png 996w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode-300x213.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode-768x546.png 768w" sizes="(max-width: 996px) 100vw, 996px" /></a><p id="caption-attachment-2472" class="wp-caption-text">Configure XML source or JSON Source for Very Large Data File (Streaming mode for High Performance)</p></div></li>
<li>Click Preview to verify data (Adjust Filter if needed to extract correct Hierarchy)
<div id="attachment_2473" style="width: 667px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-preview-sample-xml-json-data.png"><img decoding="async" aria-describedby="caption-attachment-2473" class="size-full wp-image-2473" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-preview-sample-xml-json-data.png" alt="Preview XML or JSON File data using SSIS XML Source or JSON Source" width="657" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-preview-sample-xml-json-data.png 657w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-preview-sample-xml-json-data-300x176.png 300w" sizes="(max-width: 657px) 100vw, 657px" /></a><p id="caption-attachment-2473" class="wp-caption-text">Preview XML or JSON File data using SSIS XML Source or JSON Source</p></div></li>
<li>Click on Columns Tab</li>
<li>Change Scan Row count to 3000 or more and Click on <pre class="crayon-plain-tag">Refresh Column</pre> .</li>
<li>Select Guess 4x , Check Lock, Check Reset and Click OK like below. At runtime if you ever get error about Data Type Issue you can always adjust this later on too. Make sure Lock column is set to avoid setting reset for manually changed columns. For more information on metadata changes <a href="https://zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">check this article</a>
<div id="attachment_2470" style="width: 987px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing.png"><img decoding="async" aria-describedby="caption-attachment-2470" class="size-full wp-image-2470" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing.png" alt="SSIS Metadata Options - JSON / XML File Parsing" width="977" height="661" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing.png 977w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing-300x203.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing-768x520.png 768w" sizes="(max-width: 977px) 100vw, 977px" /></a><p id="caption-attachment-2470" class="wp-caption-text">SSIS Metadata Options &#8211; JSON / XML File Parsing</p></div></li>
<li>Click OK to save settings.</li>
<li>Now Right click on XML Component &gt; Click Properties. Change <pre class="crayon-plain-tag">DirectPath</pre>  property to original file path (large file) (e.g. <pre class="crayon-plain-tag">c:\data\customers_large.xml</pre>  ). Save Package.</li>
<li>Now you can run your SSIS Package from Designer or Command line. As you see in the below screenshot that there is virtually no memory pressure when you enable stream mode. Thanks to ZappySys unique XML / JSON Parsing Engine. When streaming mode is enabled file is not loaded into memory for parsing rather than that it only reads record by record to process very large JSON or XML file.In our below example we used <strong>Windows 7 Desktop, 16GB RAM, 4 Core i7 64 bit CPU</strong>. It took around <pre class="crayon-plain-tag">3 Minutes to Parse 3 Million Records (1.2 GB big XML file)</pre> . If you Parse JSON file then it can be even faster due to compact size.
<div id="attachment_2471" style="width: 1048px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2471" class="size-full wp-image-2471" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example.png" alt="Reading Very Large XML or JSON File using SSIS (Stream Mode for High Performance)" width="1038" height="696" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example.png 1038w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example-300x201.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example-768x515.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example-1024x687.png 1024w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example-272x182.png 272w" sizes="(max-width: 1038px) 100vw, 1038px" /></a><p id="caption-attachment-2471" class="wp-caption-text">Reading Very Large XML or JSON File using SSIS (Stream Mode for High Performance)</p></div></li>
</ol>
<h2>Step-By-Step : Reading very large JSON file (SSIS JSON Source)</h2>
<p>Reading very large JSON file using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON Source</a>  has exact same steps described in above section except two changes. You have to use ZS JSON Source and skip Step#7 (Check Enable Performance Mode &#8211; This option is not available JSON Source).</p>
<h2>Parsing very large XML File with Multiple Arrays</h2>
<p>Now let&#8217;s discuss a scenario which can result in OutOfMemory Exception unless you tweak some extra options. Assume you have file structure like below.<br />
NOTE: This will only work in version <strong>4.1.0</strong> or later (in SSIS PowerPack) or <strong>1.4.0</strong> or later for ODBC PowerPack</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Data&gt;
	&lt;Product&gt;....&lt;Product&gt;
	&lt;Product&gt;....&lt;Product&gt;
	.... many more....
	&lt;Product&gt;....&lt;Product&gt;
	
	&lt;Customer&gt;....&lt;Customer&gt;
	&lt;Customer&gt;....&lt;Customer&gt;
	.... many more....
	&lt;Customer&gt;....&lt;Customer&gt;
	
	&lt;Row&gt;....&lt;Row&gt;
	&lt;Row&gt;....&lt;Row&gt;
	.... many more....
	&lt;Row&gt;....&lt;Row&gt;
&lt;/Data&gt;</pre><p>
Notice that in above XML it has 3 different nodes (For Product, Customer and Order). If you try to extract Orders it might fail with OutOfMemory Exception because it needs to scan large XML before it can hit First Order node. To solve this issue you can adjust following 2 settings.</p>
<ol>
<li>On Array Handling Tab you have following<br />
<pre class="crayon-plain-tag">Row</pre>
</li>
<li>On Advanced Filter Options tab enter Following two nodes which we dont want to extract.<br />
<pre class="crayon-plain-tag">Product,Customer</pre>
</li>
</ol>
<p>Thats it. This will avoid excessive Memory pressure to find very first node before it can start Stream.</p>
<div id="attachment_9286" style="width: 453px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-array-extract.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9286" class="size-full wp-image-9286" src="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-array-extract.png" alt="Parse XML Array - Performance Mode Setting" width="443" height="150" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-array-extract.png 443w, https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-array-extract-300x102.png 300w" sizes="(max-width: 443px) 100vw, 443px" /></a><p id="caption-attachment-9286" class="wp-caption-text">Parse XML Array &#8211; Performance Mode Setting</p></div>
<p>&nbsp;</p>
<div id="attachment_9287" style="width: 680px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-exclude-nodes-by-name.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9287" class="size-full wp-image-9287" src="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-exclude-nodes-by-name.png" alt="Parse Large XML - Exclude nodes by name" width="670" height="149" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-exclude-nodes-by-name.png 670w, https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-exclude-nodes-by-name-300x67.png 300w" sizes="(max-width: 670px) 100vw, 670px" /></a><p id="caption-attachment-9287" class="wp-caption-text">Parse Large XML &#8211; Exclude nodes by name</p></div>
<h2>Conclusion</h2>
<p>As you saw in this article that ZappySys SSIS PowerPack is designed to handle very large dataset in JSON or XML. We also support very large CSV and Excel files too which are not covered in this article. <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Download SSIS PowerPack</a> to explore 70+ more components by yourself to make your ETL simple and Fast.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/read-large-xml-json-file-ssis-fast-process-million-rows/">How to read large XML / JSON file in SSIS (3 Million Rows in 3 Mins)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to configure Zendesk OAuth Application and Connection for REST API</title>
		<link>https://zappysys.com/blog/configure-zendesk-oauth-application-for-rest-api-call/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 19 Dec 2017 16:44:40 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[zendesk]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2384</guid>

					<description><![CDATA[<p>Introduction To consume Zendesk data using the REST API, you can use different methods. Now, let&#8217;s see how to create an OAuth Application so you don&#8217;t have to rely on a static Token or a UserID/Password to access data. The OAuth method is more secure and recommended over other methods, so whenever possible, use it. [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/configure-zendesk-oauth-application-for-rest-api-call/">How to configure Zendesk OAuth Application and Connection for REST API</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/zendesk-connector/">API Connector for Zendesk Online</a>, which makes it much simpler to <strong>Read/Write Zendesk Data in SSIS</strong> compared to the steps listed in this article. You can still use the steps from this article, but if you are new to APIs or want to avoid the learning curve, use a newer approach.</p>
<p><span style="box-sizing: border-box; margin: 0px; padding: 0px;">Please visit <a href="https://zappysys.com/api/integration-hub/" target="_blank" rel="noopener">this page to see all</a> pre-configured, ready-to-use API connectors<span style="box-sizing: border-box; margin: 0px; padding: 0px;"> you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/" target="_blank" rel="noopener">SSIS API Source</a>/<a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/" target="_blank" rel="noopener">SSIS API Destination</a> or the <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/" target="_blank" rel="noopener">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, and </span>Informatica).</span></p>
</div></div>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/zendesk-api-integration.png"><img loading="lazy" decoding="async" class=" wp-image-1628 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2015/10/zendesk-api-integration.png" alt="" width="90" height="90" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/zendesk-api-integration.png 200w, https://zappysys.com/blog/wp-content/uploads/2015/10/zendesk-api-integration-150x150.png 150w" sizes="(max-width: 90px) 100vw, 90px" /></a>To consume Zendesk data using the REST API, you can use <a href="https://zappysys.com/blog/tag/zendesk/" target="_blank" rel="noopener">different methods</a>. Now, let&#8217;s see how to create an OAuth Application so you don&#8217;t have to rely on a static Token or a UserID/Password to access data.</p>
<p>The OAuth method is more secure and recommended over other methods, so whenever possible, use it.</p>
<h2></h2>
<h2>Create Zendesk OAuth Application</h2>
<p>To create an OAuth App for Zendesk, perform the following steps.</p>
<ol>
<li>Log in to your Zendesk Portal. And go tothe  following URL (This step assumes you have admin rights to createan  OAuth App)<br />
<pre class="crayon-plain-tag">https://zappysys.zendesk.com/agent/admin/api/oauth_clients</pre>
<div id="attachment_2385" style="width: 878px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/create-configure-zendesk-oauth-application.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2385" class="size-full wp-image-2385" src="https://zappysys.com/blog/wp-content/uploads/2017/12/create-configure-zendesk-oauth-application.png" alt="How to create Zendesk OAuth Application for REST API Access in SSIS" width="868" height="384" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/create-configure-zendesk-oauth-application.png 868w, https://zappysys.com/blog/wp-content/uploads/2017/12/create-configure-zendesk-oauth-application-300x133.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/create-configure-zendesk-oauth-application-768x340.png 768w" sizes="(max-width: 868px) 100vw, 868px" /></a><p id="caption-attachment-2385" class="wp-caption-text">How to create a Zendesk OAuth Application for REST API Access</p></div></li>
<li>After clicking on the plus sign and entering app information (e.g., Display name, Unique ID, also known as ClientId or AppId )
<div id="attachment_2386" style="width: 1318px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/zendesk-create-oauth-application-for-rest-api-access.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2386" class="size-full wp-image-2386" src="https://zappysys.com/blog/wp-content/uploads/2017/12/zendesk-create-oauth-application-for-rest-api-access.png" alt="Configure Zendesk OAuth App" width="1308" height="926" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/zendesk-create-oauth-application-for-rest-api-access.png 1308w, https://zappysys.com/blog/wp-content/uploads/2017/12/zendesk-create-oauth-application-for-rest-api-access-300x212.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/zendesk-create-oauth-application-for-rest-api-access-768x544.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/12/zendesk-create-oauth-application-for-rest-api-access-1024x725.png 1024w" sizes="(max-width: 1308px) 100vw, 1308px" /></a><p id="caption-attachment-2386" class="wp-caption-text">Configure Zendesk OAuth App</p></div></li>
<li>All the way at the bottom of that page, you will see <strong>Secret (i.e.</strong>,<strong> Client Secret)</strong>. Save that along with a unique identifier for later use.</li>
<li>That&#8217;s it. Now you can start using the Zendesk OAuth App to access the REST API</li>
</ol>
<p>Understanding Scopes</p>
<p>In the next section, you will learn how to configure an OAuth connection. During that, you will need to specify scopes (Token Permissions you want to grant).</p>
<p>The syntax to define the scope is as follows. Scope can be <strong>read-only</strong>, <strong>write-only,</strong> or read-write. The resource is an optional part. If you omit the scope, it will be applied to all.</p><pre class="crayon-plain-tag">resource:scope</pre><p>
<p class="p">You can use the following resource scope for the following resources:</p>
<div class="p">
<ul id="topic_gql_kbd_gt__ul_idz_gcd_gt" class="ul">
<li class="li">tickets</li>
<li class="li">users</li>
<li class="li">auditlogs (read only)</li>
<li class="li">organizations</li>
<li class="li">hc</li>
<li class="li">apps</li>
<li class="li">triggers</li>
<li class="li">automations</li>
<li class="li">targets</li>
</ul>
<p><strong>Examples of scopes for Zendesk Tickets APIs</strong></p>
</div>
<div class="p">
<pre class="crayon-plain-tag">read
write
read write
users:read
users:read users:write
users:read users:write organizations:write</pre>
</div>
<p><strong>Examples of scopes for Zendesk Chat APIs</strong></p><pre class="crayon-plain-tag">read
chat</pre><p>
<h2>Calling Zendesk REST API using SSIS PowerPack OAuth Connection</h2>
<p>Here is how you can use Zerdesk OAuth to access the API using the SSIS PowerPack <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON / REST Source</a></p>
<ol>
<li>First, drag the <strong>ZS JSON Source</strong> from the SSIS Toolbox into the Data Flow designer</li>
<li>Configure JSON Source as below. Make sure you update the URL to your domain.<br />
URL for Zendesk Tickets API<br />
<pre class="crayon-plain-tag">https://{YOUR-DOMAIN}.zendesk.com/api/v2/tickets</pre>
URL for Zendesk Chat API<br />
<pre class="crayon-plain-tag">https://{YOUR-DOMAIN}.zopim.com/api/v2/chats</pre>
</li>
<li><strong>Configure the OAuth Connection</strong> As below for the <strong>Zendesk Ticket API</strong>. Scopes differ for the Ticket and Chat APIs; please enter the appropriate ones.
<div id="attachment_2387" style="width: 685px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-oauth-zendesk-connection-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2387" class="size-full wp-image-2387" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-oauth-zendesk-connection-1.png" alt="Configure SSIS OAuth connection for Zendesk API Access" width="675" height="615" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-oauth-zendesk-connection-1.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-oauth-zendesk-connection-1-300x273.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-2387" class="wp-caption-text">Configure SSIS OAuth connection for Zendesk API Access</p></div>
<div id="attachment_2388" style="width: 679px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-oauth-zendesk-connection-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2388" class="size-full wp-image-2388" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-oauth-zendesk-connection-2.png" alt="Configure OAuth Redirect URL for Zendesk" width="669" height="556" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-oauth-zendesk-connection-2.png 669w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-oauth-zendesk-connection-2-300x249.png 300w" sizes="(max-width: 669px) 100vw, 669px" /></a><p id="caption-attachment-2388" class="wp-caption-text">Configure OAuth Redirect URL and Content Type</p></div></li>
<li><strong>Configure the OAuth Connection</strong> As below for the <strong>Zendesk Chat API</strong>. Scopes differ for the Ticket and Chat APIs; please enter the appropriate ones.
<div id="attachment_9134" style="width: 789px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9134" class="size-full wp-image-9134" src="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-1.png" alt="Zendesk Chat OAuth Settings - General Tab" width="779" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-1.png 779w, https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-1-300x252.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-1-768x645.png 768w" sizes="(max-width: 779px) 100vw, 779px" /></a><p id="caption-attachment-9134" class="wp-caption-text">Zendesk Chat OAuth Settings &#8211; General Tab</p></div>
<div id="attachment_9133" style="width: 790px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9133" class="size-full wp-image-9133" src="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-2.png" alt="Zendesk Chat OAuth Settings - Advanced Tab" width="780" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-2.png 780w, https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-2-300x252.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-2-768x644.png 768w" sizes="(max-width: 780px) 100vw, 780px" /></a><p id="caption-attachment-9133" class="wp-caption-text">Zendesk Chat OAuth Settings &#8211; Advanced Tab</p></div>
<div id="attachment_9132" style="width: 789px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9132" class="size-full wp-image-9132" src="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-3.png" alt="Zendesk Chat OAuth Settings - OAuth2 Grant Options Tab" width="779" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-3.png 779w, https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-3-300x252.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/Zendesk-Chat-OAuth-3-768x645.png 768w" sizes="(max-width: 779px) 100vw, 779px" /></a><p id="caption-attachment-9132" class="wp-caption-text">Zendesk Chat OAuth Settings &#8211; OAuth2 Grant Options Tab</p></div></li>
<li>After you set the necessary parameters, click <strong>Generate Token</strong> (Login using your account with the required permission needed to access data)<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;">As of now, Zendesk doesn&#8217;t support Refresh Token. So once you click Generate Token, it will only create an Access Token (which doesn&#8217;t expire until you revoke it explicitly). The Refresh Token will be blank, as expected. </div></div><strong>OAuth 2.0 Flow (Google API Example)</strong>
<div id="attachment_6855" style="width: 930px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6855" class="size-full wp-image-6855" src="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png" alt="Connect to Google API using OAuth 2.0 (Youtube API Example)" width="920" height="1032" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png 920w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-267x300.png 267w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-768x861.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-913x1024.png 913w" sizes="(max-width: 920px) 100vw, 920px" /></a><p id="caption-attachment-6855" class="wp-caption-text">Connect to Google API using OAuth 2.0 (YouTube API Example)</p></div></li>
<li>Configure Pagination parameters as below
<div id="attachment_1187" style="width: 559px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-zendesk-api-pagination-settings-nextpage.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1187" class="size-full wp-image-1187" src="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-zendesk-api-pagination-settings-nextpage.png" alt="SSIS JSON Source - Configure Zendesk REST API Pagination" width="549" height="335" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-zendesk-api-pagination-settings-nextpage.png 549w, https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-zendesk-api-pagination-settings-nextpage-300x183.png 300w" sizes="(max-width: 549px) 100vw, 549px" /></a><p id="caption-attachment-1187" class="wp-caption-text">SSIS JSON Source &#8211;<br />Configure Zendesk REST API Pagination</p></div></li>
<li>Select Filter
<div id="attachment_1186" style="width: 706px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-zendesk-api-call-json-path-filter-extract-data-restful-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1186" class="size-full wp-image-1186" src="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-zendesk-api-call-json-path-filter-extract-data-restful-api.png" alt="Select Filter - Extract Data from Zendesk API Response (Read Tickets)" width="696" height="328" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-zendesk-api-call-json-path-filter-extract-data-restful-api.png 696w, https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-zendesk-api-call-json-path-filter-extract-data-restful-api-300x141.png 300w" sizes="(max-width: 696px) 100vw, 696px" /></a><p id="caption-attachment-1186" class="wp-caption-text">Select Filter &#8211; Extract Data from Zendesk API Response (Read Tickets)</p></div></li>
<li>Click Preview to test
<div id="attachment_1188" style="width: 849px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-extract-zendesk-tickets-rest-api-call-json-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1188" class="size-full wp-image-1188" src="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-extract-zendesk-tickets-rest-api-call-json-source.png" alt="SSIS JSON Source - Data Preview - Zendesk REST API Call to extract tickets" width="839" height="579" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-extract-zendesk-tickets-rest-api-call-json-source.png 839w, https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-extract-zendesk-tickets-rest-api-call-json-source-300x207.png 300w" sizes="(max-width: 839px) 100vw, 839px" /></a><p id="caption-attachment-1188" class="wp-caption-text">SSIS JSON Source &#8211; Data Preview &#8211; Zendesk REST API Call to extract tickets</p></div></li>
</ol>
<h3>Adding Retry Settings for HTTP or OAuth connection</h3>
<p>Zendesk enforces an API rate limit, which means you cannot issue too many API calls in a given time frame. <a href="https://developer.zendesk.com/rest_api/docs/support/introduction#rate-limits" target="_blank" rel="noopener">Check this document</a> for exact information.</p>
<p>ZappySys provides API retry settings on both the OAuth Connection and the HTTP Connection. For Zendesk you can retry on a specific status code <strong>429</strong></p>
<ol>
<li>Open connection manager UI</li>
<li>Go to Retry-Settings page</li>
<li>Select <strong>Retry web error on matching response status code</strong>.</li>
<li>Enter <strong>429</strong> for status code</li>
<li>Check <strong>multiply wait time</strong></li>
<li>In the wait time enter <strong>5000</strong> (wait 5 seconds or multiple of 5 seconds)</li>
<li>Set Max retry count as <strong>6</strong></li>
</ol>
<p>See below example (Its not for Zendesk but will give you an idea)</p>
<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>
<h3>Configure Zendesk API Pagination and Filter for SSIS JSON Source</h3>
<p>The post <a href="https://zappysys.com/blog/configure-zendesk-oauth-application-for-rest-api-call/">How to configure Zendesk OAuth Application and Connection for REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to use Office 365 API with SSIS (Mail, Calendar, Contacts, OneDrive, Excel)</title>
		<link>https://zappysys.com/blog/calling-office-365-api-using-ssis-graph-api-mail-calendar-contacts-onedrive-excel/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 12 Aug 2017 23:45:15 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[microsoft graph api]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[office 365]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[ssis web api destination]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1686</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to access Microsoft Graph API  (Office 365 REST API / Sharepoint API) inside SSIS without any coding. Microsoft Graph API is a unified way to access many Microsoft services API including Office 365 API. In this post we will use SSIS JSON Source / REST API Connector to [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/calling-office-365-api-using-ssis-graph-api-mail-calendar-contacts-onedrive-excel/">How to use Office 365 API with SSIS (Mail, Calendar, Contacts, OneDrive, Excel)</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;">NOTE: <strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/outlook-mail-connector/ssis">API Connector for SSIS Outlook Mail (Office 365)</a> which makes it much simpler to <strong>download attachment, read / search Emails, Users, MailFolders, Send email and more in SSIS</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).</div></div>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/08/microsoft-office-365-api-integration.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1694" src="//zappysys.com/blog/wp-content/uploads/2017/08/microsoft-office-365-api-integration.png" alt="" width="100" height="100" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/microsoft-office-365-api-integration.png 241w, https://zappysys.com/blog/wp-content/uploads/2017/08/microsoft-office-365-api-integration-150x150.png 150w" sizes="(max-width: 100px) 100vw, 100px" /></a>In this post you will learn how to access <a href="https://developer.microsoft.com/en-us/graph/docs/concepts/overview" target="_blank" rel="noopener">Microsoft Graph API</a>  (Office 365 REST API / Sharepoint API) inside SSIS without any coding. <a href="https://developer.microsoft.com/en-us/graph/docs/concepts/overview" target="_blank" rel="noopener">Microsoft Graph API</a> is a unified way to access many Microsoft services API including <strong>Office 365 API</strong>. In this post we will use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source / REST API Connector</a> to load data from Office 365 to SQL Server.</p>
<p>&nbsp;</p>
<h2>Use Case of Microsoft Graph API</h2>
<p>Here are some use cases why you want to use Microsoft Graph API</p>
<ul>
<li>Read/Write events from <strong>Outlook Calendar</strong></li>
<li>Send <strong>email</strong>  / Read <strong>emails</strong></li>
<li>Get list of files from <strong>OneDrive</strong></li>
<li>Upload/ Download files to <strong>OneDrive</strong></li>
<li>Read/Write <strong>Excel Sheet</strong> (Use range or specific range of specific sheet)</li>
<li>Read <strong>Sharepoint</strong> Document library</li>
<li>Search content from <strong>Sharepoint</strong> document library</li>
<li>Get AD users for your Organization (AD Accounts)</li>
<li>Update OneNote</li>
<li>Track changes to Users, Events, Calendar Items using <a href="https://developer.microsoft.com/en-us/graph/docs/concepts/delta_query_overview" target="_blank" rel="noopener">delta API</a></li>
</ul>
<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>
<h2>Step-By-Step : Access Outlook.com Emails using SSIS</h2>
<p>Now lets look at examples to access your outlook.com emails using SSIS. You can use same techniques to call pretty much any Office 365 API.</p>
<h3>Configure SSIS OAuth Connection for Graph REST API</h3>
<p>First step to access any Graph API is configure OAuth connection</p>
<ol>
<li>Open Visual Studio</li>
<li>Open existing SSIS Project or create new using File &gt; New &gt; Project &gt; Choose “Integration Services Project” Type under Business Intelligence template category</li>
<li>Open Package</li>
<li>Right click inside Connection Managers area and click “New Connection…”</li>
<li>From the connection type list select “ZS-OAUTH” connection type.
<div id="attachment_1569" style="width: 687px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1569" class="size-full wp-image-1569" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png" alt="Create new SSIS OAuth API Connection Manager" width="677" height="220" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection-300x97.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-1569" class="wp-caption-text">Create new SSIS OAuth API Connection Manager</p></div></li>
<li>On the OAuth Connection Manager configure following options
<ol>
<li>Select &#8220;Custom&#8221; from Provider dropdown</li>
<li>Select OAuth2 from OAuth version</li>
<li>Enter your Application Id and Secret Key (i.e. App Password) obtained in the previous section <a href="https://apps.dev.microsoft.com/#/appList" target="_blank" rel="noopener">from here</a>.</li>
<li>Enter following URL in the Authorization URL<br />
<pre class="crayon-plain-tag">https://login.microsoftonline.com/common/oauth2/v2.0/authorize</pre>
</li>
<li>Enter the following URL in the token URL field<br />
<pre class="crayon-plain-tag">https://login.microsoftonline.com/common/oauth2/v2.0/token</pre>
</li>
<li>Enter the following <a href="https://developer.microsoft.com/en-us/graph/docs/authorization/permission_scopes" target="_blank" rel="noopener">Graph API Scopes</a> (each scope must be entered in a new line).<br />
<pre class="crayon-plain-tag">user.read
mail.read
offline_access</pre>
<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;">NOTE: Always include <strong>offline_access</strong> scope returns refreh_token which allows you to renew token without going through login process again. For more information about which scopes needed always refer to API help page (e.g. if you want to read mail using <a href="https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_list_messages" target="_blank" rel="noopener">this API</a> then you will see it says you can use <strong>Mail.Read</strong> or <strong>Mail.ReadWrite</strong> scope).</div></div></li>
<li>Go to Advanced tab and enter the following URL in the Callback/Return URL (Assuming exact same URL used when you registered App in the previous section)<br />
<pre class="crayon-plain-tag">https://zappysys.com/oauth</pre>
</li>
<li>Now go back to first tab and Click Generate Token. When prompted Login using your Personal Microsoft Account or Work Account (Office 365 or AD login)</li>
<li>After login you will see Accept option just click it. If things go right then you will see Access Token and Refresh Token fields will be populated.</li>
</ol>
</li>
<li>Once all configured you can click Test to make sure connection works.
<div id="attachment_1691" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-office-365-graph-rest-api-oauth-connection-manager.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1691" class="size-full wp-image-1691" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-office-365-graph-rest-api-oauth-connection-manager.png" alt="SSIS OAuth COnnection Manager for Office 365 REST API / Microsoft Graph API" width="675" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-office-365-graph-rest-api-oauth-connection-manager.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-office-365-graph-rest-api-oauth-connection-manager-300x291.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1691" class="wp-caption-text">SSIS OAuth Connection Manager for Office 365 REST API / Microsoft Graph API</p></div></li>
</ol>
<h3></h3>
<div class="su-note"  style="border-color:#e5da9d;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:#fff4b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> Typically RefreshToken is longed lived but in some cases they may expire soon too. If that&#8217;s the case then you can configure above oauth connection for <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code" target="_blank" rel="noopener">Changing RefreshToken pattern</a>. Simply enter token file path and re-authenticate by clicking Generate Token. After that each time you make an API call it will save new refresh token in file.</div></div>
<h3>Configure SSIS JSON/REST API Source</h3>
<p>Once you configure OAuth connection you are ready to read data from Office 365 API. Lets look at step by step how to read emails using Mail API and save to SQL Server.</p>
<ol>
<li>Drag and drop Data flow task from SSIS toolbox</li>
<li>Goto data flow designer and drag and drop <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source/REST API Connector</a> on the designer</li>
<li>Double click to edit JSON Source.</li>
<li>In the URL field enter below URL<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/v1.0/me/messages</pre>
To customize URL with additional parameters check <a href="https://developer.microsoft.com/en-us/graph/docs/overview/query_parameters" target="_blank" rel="noopener">this help link</a>. It&#8217;s a standard OData Protocol so you can leverage many common OData features (e.g. Use $top parameters to set pageSize. Default is 10 for List Mail but you can include more records per response by changing it such as <strong>&#8230;/messages?$top=50</strong>).</li>
<li>Check Use credentials option</li>
<li>From the connections dropdown select OAuth Connection manager created in the previous section</li>
<li>Change Data Format option to <strong>OData </strong></li>
<li>In the Filter enter following or click &#8220;Select Filter&#8221; and select Value Array node &gt; Click OK.<br />
<pre class="crayon-plain-tag">$.value[*]</pre>
</li>
<li>In the Max rows set to 200 so we don&#8217;t pull all data for now 🙂 &#8230; This is our hello world example.</li>
<li>Now click Preview to see data. If all is well then Save UI by clicking OK
<div id="attachment_1693" style="width: 852px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-get-data-from-microsoft-graph-api-office-365-json-rest-api-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1693" class="size-full wp-image-1693" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-get-data-from-microsoft-graph-api-office-365-json-rest-api-source.png" alt="SSIS JSON Source - Get data from Microsoft Graph API (Office 365 API - Read Mail Example)" width="842" height="695" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-get-data-from-microsoft-graph-api-office-365-json-rest-api-source.png 842w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-get-data-from-microsoft-graph-api-office-365-json-rest-api-source-300x248.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-get-data-from-microsoft-graph-api-office-365-json-rest-api-source-768x634.png 768w" sizes="(max-width: 842px) 100vw, 842px" /></a><p id="caption-attachment-1693" class="wp-caption-text">SSIS JSON Source &#8211; Get data from Microsoft Graph API (Office 365 API &#8211; Read Mail Example)</p></div></li>
</ol>
<h3>Loading Graph API / Office 365 data to SQL Server</h3>
<p>Now last step is loading Outlook data to SQL Server. For example purpose we will load data into SQL Server but you can load into any Target (e.g. Flat file, Oracle, Excel) using Microsoft or ZappySys Destination connectors</p>
<p>To load Office 365 data into SQL Server perform the following steps</p>
<ol>
<li>Drag OLEDB destination on Data Flow surface</li>
<li>Connect ZS JSON Source to Destination</li>
<li>On OLEDB destination select / create new SQL Connection and then Click &#8220;New Table&#8221;</li>
<li>Click on Mappings tab and click OK to save</li>
<li>Execute Package</li>
</ol>
<div id="attachment_1617" style="width: 792px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1617" class="size-full wp-image-1617" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png" alt="Configure SSIS OLEDB Destination - Loading Xero Data into SQL Server Table" width="782" height="593" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png 782w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load-300x227.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load-768x582.png 768w" sizes="(max-width: 782px) 100vw, 782px" /></a><p id="caption-attachment-1617" class="wp-caption-text">Configure SSIS OLEDB Destination &#8211; Loading Xero Data into SQL Server Table</p></div>
<div id="attachment_1618" style="width: 744px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1618" class="size-full wp-image-1618" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png" alt="Xero to SQL Server Column Mappings for OLEDB Destination" width="734" height="543" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png 734w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings-300x222.png 300w" sizes="(max-width: 734px) 100vw, 734px" /></a><p id="caption-attachment-1618" class="wp-caption-text">Graph API / Office 365 to SQL Server Column Mappings for OLEDB Destination</p></div>
<div id="attachment_1619" style="width: 293px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1619" class="size-full wp-image-1619" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png" alt="Loading Xero data to SQL Server in SSIS" width="283" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png 283w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server-217x300.png 217w" sizes="(max-width: 283px) 100vw, 283px" /></a><p id="caption-attachment-1619" class="wp-caption-text">Loading Graph REST API  / Office 365 data to SQL Server in SSIS</p></div>
<h2>POST data to Graph API (Insert or Update)</h2>
<p>So far we have seen how to read data from Office 365 API. Now let&#8217;s look at how to write data to Office 365.</p>
<p>There are two ways you can achieve this.</p>
<ol>
<li>Use <a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> in Data Flow</li>
<li>Use <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> in Control Flow</li>
</ol>
<p>Read this article to learn more about <a href="//zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">API POST using SSIS</a></p>
<h3>Using SSIS Web API Task (Write data from SQL Server to Office 365 / Graph API)</h3>
<h3><img decoding="async" src="https://i0.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination-post-json-to-rest-api-url.png?resize=503%2C403" alt="SSIS Web API Destination - POST JSON to REST API Endpoint, Create / Update records" /></h3>
<h3>Using REST API Task to POST data to Graph API</h3>
<p>If you have JSON/XML data already prepared and if you like to POST it to Graph API then REST API Task would be easy to use.</p>
<p>REST API Task Body can be direct string, variable (e.g. {{User::varSomeData}} or <a href="https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/" target="_blank" rel="noopener">Body can come from File </a></p>
<div id="attachment_1616" style="width: 872px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1616" class="size-full wp-image-1616" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png" alt="SSIS REST API Task - POST data to Xero (Create contacts)" width="862" height="602" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png 862w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example-300x210.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example-768x536.png 768w" sizes="(max-width: 862px) 100vw, 862px" /></a><p id="caption-attachment-1616" class="wp-caption-text">SSIS REST API Task &#8211; POST data to Graph API</p></div>
<h2>Download file from OneDrive</h2>
<p>To download file from OneDrive perform these steps</p>
<p><a href="https://zappysys.zendesk.com/hc/en-us/articles/115005010573-How-to-download-file-from-OneDrive-using-Graph-API" target="_blank" rel="noopener">https://zappysys.zendesk.com/hc/en-us/articles/115005010573-How-to-download-file-from-OneDrive-using-Graph-API</a></p>
<h2>Upload file to OneDrive</h2>
<p><a href="https://zappysys.zendesk.com/hc/en-us/articles/115004893713-How-to-upload-file-to-OneDrive-using-Office-365-Graph-API" target="_blank" rel="noopener">https://zappysys.zendesk.com/hc/en-us/articles/115004893713-How-to-upload-file-to-OneDrive-using-Office-365-Graph-API</a></p>
<h2>Reading Office Excel Sheets from OneDrive</h2>
<p>JSON Source also support reading API response which returns 2D arrays. Such as <a href="https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/excel" target="_blank" rel="noopener">Office Excel Spreadsheet API</a> to read excel data. Check <a href="//zappysys.com/blog/get-data-google-spreadsheet-using-ssis/" target="_blank" rel="noopener">this blog post</a> to learn similar scenario to parse 2D arrays. There are few other options for parsing 2D arrays which are <a href="//zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">documented here</a>.</p><pre class="crayon-plain-tag">https://graph.microsoft.com/v1.0/me/drive/items/01CYZLFJDYxxxxxxx/workbook/worksheets('test')/range(address='A1:B200')</pre><p>
<h2>Testing Office 365 API using Graph API Explorer</h2>
<p>If you like to test API request/response inside browser then Microsoft provides really great tool to called Graph API Explorer. <a href="https://developer.microsoft.com/en-us/graph/graph-explorer" target="_blank" rel="noopener">Click here to try Graph API Explorer</a>.</p>
<p>See below screenshot</p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/08/test-office-365-graph-api-from-rest-api-explorer-read-mail-calendar-people-onedrive.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1701" src="//zappysys.com/blog/wp-content/uploads/2017/08/test-office-365-graph-api-from-rest-api-explorer-read-mail-calendar-people-onedrive.png" alt="" width="1085" height="538" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/test-office-365-graph-api-from-rest-api-explorer-read-mail-calendar-people-onedrive.png 1085w, https://zappysys.com/blog/wp-content/uploads/2017/08/test-office-365-graph-api-from-rest-api-explorer-read-mail-calendar-people-onedrive-300x149.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/test-office-365-graph-api-from-rest-api-explorer-read-mail-calendar-people-onedrive-768x381.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/08/test-office-365-graph-api-from-rest-api-explorer-read-mail-calendar-people-onedrive-1024x508.png 1024w" sizes="(max-width: 1085px) 100vw, 1085px" /></a></p>
<h2>Common Errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2><span id="ConclusionWhat8217s_next">Conclusion. What’s next?</span></h2>
<p>In this article we have learned how to load data from Microsoft Graph API to SQL Server using SSIS ( drag and drop approach without coding). We used <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS JSON / REST API Connector</a> to extract data from Outlook Mail using OAuth. JSON Source makes it super simple to parsing complex / large JSON Files or any Web API Response into rows and column so you can load into database like SQL Server. <a href="//zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try many other automation scenarios not discussed in this article.</p>
<p><strong>Keywords:</strong></p>
<p>Office 365 API Integration with SQL Server | How to extract Office 365 data in SSIS? | How to read outlook mail, calendar event and contacts? | Calling Microsoft Graph API using SSIS. | Office 365 to SQL Server | SQL Server to Office 365 | SSIS Office 365 API Integration | SSIS Graph API Integration</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/calling-office-365-api-using-ssis-graph-api-mail-calendar-contacts-onedrive-excel/">How to use Office 365 API with SSIS (Mail, Calendar, Contacts, OneDrive, Excel)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Parse JSON array in SSIS or ODBC Drivers</title>
		<link>https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 03 Aug 2017 02:55:02 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[json array]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1636</guid>

					<description><![CDATA[<p>Introduction In our previous post we saw how to parse JSON arrays. Now let&#8217;s look at more advanced techniques to parse multi-dimensional JSON array in SSIS (  e.g. 2D &#8211; JSON array inside array). We will use SSIS JSON Source to parse complex nested JSON in few clicks. Tips and Tricks mentioned in this article [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/">Parse JSON array in 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 <a href="//zappysys.com/blog/extract-read-multiple-arrays-from-json-data-file-rest-api-response/" target="_blank" rel="noopener">previous post</a> we saw how to <strong>parse JSON arrays</strong>. Now let&#8217;s look at more advanced techniques to parse multi-dimensional JSON array in SSIS (  e.g. 2D &#8211; JSON array inside array). We will use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a> to parse complex nested JSON in few clicks. Tips and Tricks mentioned in this article also apply to <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ODBC PowerPack API Drivers</a>.</p>
<p>2D arrays are used to stuff more data in most compact way. Since you don&#8217;t have to repeat column names you save great amount of space. 2D array JSON format is close to CSV format in data size but it gives advantage and structure of JSON without adding extra fat.</p>
<h2>Parsing JSON Arrays &#8211; Simple hierarchy</h2>
<p>If you have simple JSON / XML Structure then you can use <strong>Select Filter option</strong> to parse array and flatten the hierarchy. You can select top level array or nested array to de-normalize the structure.</p>
<p>For example you can select $.orders[*] to extract all order records or use $.orders[*].items[*] to get each order items for all orders. There is also possibility to use light weight expression (like WHERE clause). Check this article <a href="https://zappysys.com/blog/jsonpath-examples-expression-cheetsheet/" target="_blank" rel="noopener">how to use JSONPath</a> but it has its own limitation,</p>
<div id="attachment_1573" style="width: 685px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1573" class="size-full wp-image-1573" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png" alt="Select Filter" width="675" height="363" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter-300x161.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1573" class="wp-caption-text">Select Filter</p></div>
<p>&nbsp;</p>
<h2>Parsing Multi-Dimensional JSON Arrays</h2>
<p>Now lets look at how to parse various multi-dimensional JSON array patterns in SSIS using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source </a> or ODBC API drivers like JSON Driver</p>
<ol>
<li>2D Value Array with schema information (column names in a separate array) &#8211; <strong>Pattern 1</strong></li>
<li>2D Value Array without schema information &#8211; <strong>Pattern 2</strong></li>
<li>Parse JSON Array using Complex Transformation &#8211; <strong>Pattern 3</strong></li>
<li>Key/Value Transformation &#8211; <strong>Pattern 4</strong></li>
<li>Multiple columns using JSONPath Expression (Google Geocoding API Usecase) &#8211; <strong>Pattern 5</strong></li>
<li>Columnless Array &#8211; <strong>Pattern 6</strong></li>
</ol>
<h3>Pattern 1 &#8211; JSON Array using Simple Transformation (Column names found in JSON)</h3>
<p>This is the most common pattern of multi-dimensional JSON array where column names are stored in a separate array and values are stored in another 2D array</p><pre class="crayon-plain-tag">{
  "columns" : ["Id", "FirstName", "IsActive"],
  "rows" : [ [1,"bob",true], [2,"sam",false], [3,"joe",true] ]
}</pre><p>
<a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1641" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter.png" alt="" width="840" height="578" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter.png 840w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter-300x206.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter-768x528.png 768w" sizes="(max-width: 840px) 100vw, 840px" /></a></p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1640" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png" alt="" width="687" height="165" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation.png 687w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-2d-transformation-300x72.png 300w" sizes="(max-width: 687px) 100vw, 687px" /></a></p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-preview.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1639" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-preview.png" alt="" width="672" height="569" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-preview.png 672w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-preview-300x254.png 300w" sizes="(max-width: 672px) 100vw, 672px" /></a></p>
<h3>Pattern 2 &#8211; JSON Array using Simple Transformation (Column names not found in JSON)</h3>
<p>This is another common pattern of multi-dimensional JSON array where there are no column names. Values are stored in 2D array. <a href="//zappysys.com/blog/get-data-google-spreadsheet-using-ssis/" target="_blank" rel="noopener">Google SpreadSheet API</a> uses this approach. In this pattern you don&#8217;t have column names specified so we have to enter manually (This like a CSV file without column names header). On the 2D array Tab check &#8220;Specify columns list manually&#8221; option. Then enter column names separated by comma. Enter same number of columns in same order as value array.</p><pre class="crayon-plain-tag">{
  "rows" : [ [1,"bob",true], [2,"sam",false], [3,"joe",true] ]
}</pre><p>
<a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-filter.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1647" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-filter.png" alt="" width="840" height="543" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-filter.png 840w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-filter-300x194.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-filter-768x496.png 768w" sizes="(max-width: 840px) 100vw, 840px" /></a></p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-2d-transformation.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1646" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-2d-transformation.png" alt="" width="687" height="166" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-2d-transformation.png 687w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-select-2d-transformation-300x72.png 300w" sizes="(max-width: 687px) 100vw, 687px" /></a></p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-preview.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1645" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-preview.png" alt="" width="672" height="543" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-preview.png 672w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-2-preview-300x242.png 300w" sizes="(max-width: 672px) 100vw, 672px" /></a></p>
<h3>Pattern 3 &#8211; JSON Array using Complex Transformation</h3>
<p>Below is more complex version where column names are found in array of column schema documents. Values are also stored in 2D array with complex structure. <a href="//zappysys.com/blog/get-data-google-bigquery-using-ssis/" target="_blank" rel="noopener">Google BigQuery</a> uses similar complex structure</p><pre class="crayon-plain-tag">{
  "schema" : { 
    "columns" : [
      {"Name":"Id", "Type":"int"}, 
      {"Name":"FirstName", "Type":"string"}, 
      {"Name":"IsActive", "Type":"bool"}
    ]
  },
  "rows" : [ 
    { "rowid":1 , "values" : [1,"bob",true] }, 
    { "rowid":2 , "values" : [2,"sam",false] },
    { "rowid":3 , "values" : [3,"joe",true] }
  ]
}</pre><p>
<a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1641" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter.png" alt="" width="840" height="578" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter.png 840w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter-300x206.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-1-select-filter-768x528.png 768w" sizes="(max-width: 840px) 100vw, 840px" /></a></p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-select-2d-transformation.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1643" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-select-2d-transformation.png" alt="" width="689" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-select-2d-transformation.png 689w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-select-2d-transformation-300x118.png 300w" sizes="(max-width: 689px) 100vw, 689px" /></a></p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-preview.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1642" src="//zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-preview.png" alt="" width="669" height="676" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-preview.png 669w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-preview-297x300.png 297w" sizes="(max-width: 669px) 100vw, 669px" /></a></p>
<p>&nbsp;</p>
<p>Here is another complex variation involving multiple JSON 2D arrays, wherein column names are present within an array of column schema documents. Additionally, values are stored in a 2D array with a sophisticated structure. The <a href="https://developers.google.com/analytics/devguides/reporting/data/v1/rest" target="_blank" rel="noopener">Google Analytics Data API</a> also employs a similar intricate structure for data representation.</p><pre class="crayon-plain-tag">{
	"dimensionHeaders": [{
		"name": "transactionid"
	}, {
		"name": "date"
	}, {
		"name": "CampaignId"
	}, {
		"name": "CampaignName"
	}, {
		"name": "GoogleAdsAdGroupName"
	}, {
		"name": "googleAdsAdGroupId"
	}, {
		"name": "defaultChannelGroup"
	}],
	"metricHeaders": [{
		"name": "sessions",
		"type": "TYPE_INTEGER"
	}],
	"rows": [{
			"dimensionValues": [{
				"value": "(not set)"
			}, {
				"value": "20230709"
			}, {
				"value": "(not set)"
			}, {
				"value": "(referral)"
			}, {
				"value": "(not set)"
			}, {
				"value": ""
			}, {
				"value": "Referral"
			}],
			"metricValues": [{
				"value": "5"
			}]
		},
		{
			"dimensionValues": [{
				"value": "(not set)"
			}, {
				"value": "20230711"
			}, {
				"value": "(not set)"
			}, {
				"value": "(referral)"
			}, {
				"value": "(not set)"
			}, {
				"value": ""
			}, {
				"value": "Referral"
			}],
			"metricValues": [{
				"value": "6"
			}]
		}
	]
}</pre><p>
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-select-filter-2.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10145" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-select-filter-2.png" alt="" width="750" height="859" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-select-filter-2.png 750w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-json-array-pattern-3-select-filter-2-262x300.png 262w" sizes="(max-width: 750px) 100vw, 750px" /></a></p>
<p>In the Column name and Values Filter, instead of specifying individual arrays (e.g., dimensionHeaders and metricHeaders), we need to use the &#8216;*&#8217; wildcard symbol to retrieve data from all arrays in a single output. This allows us to gather all the arrays&#8217; data efficiently and conveniently.</p>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-multiple-2d-json-array-pattern-3-select-2d-transformation.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10144" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-multiple-2d-json-array-pattern-3-select-2d-transformation.png" alt="" width="894" height="507" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-multiple-2d-json-array-pattern-3-select-2d-transformation.png 894w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-multiple-2d-json-array-pattern-3-select-2d-transformation-300x170.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-parse-multiple-2d-json-array-pattern-3-select-2d-transformation-768x436.png 768w" sizes="(max-width: 894px) 100vw, 894px" /></a></p>
<h3></h3>
<h3>Pattern 4 &#8211; Key/Value Transformation</h3>
<p>SSIS PowerPack v2.6.6 and later introduced new transformation type called Key/Value transformation. This option Pivots dynamic Key/Value pairs of some attributes into Columns. Zoho CRM is best use case. <a href="https://zappysys.com/blog/read-write-zoho-crm-data-using-ssis-rest-api-call/" target="_blank" rel="noopener">Fully described here</a>.</p><pre class="crayon-plain-tag">{
  "rows": [
    {
      "rownum": 1,
      "fields": [
        {
          "name": "FirstName",
          "value": "Bob"
        },
        {
          "name": "LastName",
          "value": "Tylor"
        },
        {
          "name": "Phone",
          "value": "111-111-1111"
        }
      ]
    },
    {
      "rownum": 2,
      "fields": [
        {
          "name": "FirstName",
          "value": "Sam"
        },
        {
          "name": "LastName",
          "value": "Smith"
        },
        {
          "name": "Phone",
          "value": "222-222-2222"
        }
      ]
    }
  ]
}</pre><p>
To transform above JSON where fields appear as column (e..g FirstName, LastName and Email) you need to apply following settings on JSON Source UI.</p>
<ol>
<li>Select Filter <strong>$.rows[*]</strong></li>
<li>Goto 2D Array Tab and select following settings
<ol>
<li>Transform Type = Key/Value</li>
<li>Column Name Filter =  <strong>$.fields[*].name</strong></li>
<li>Row Value Filter =  <strong>$.fields[*].value</strong></li>
</ol>
</li>
</ol>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-json-key-value-pivot-transform.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2665" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-json-key-value-pivot-transform.png" alt="" width="673" height="606" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-json-key-value-pivot-transform.png 673w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-json-key-value-pivot-transform-300x270.png 300w" sizes="(max-width: 673px) 100vw, 673px" /></a></p>
<h4>Pattern 4.1 &#8211; Rootless JSON Array Key/Value Transformation</h4>
<p>Sometimes you might get a rootless JSON array is a JSON structure where the top level is an array, not an object. This format is common when representing collections like lists of items or Custom Columns. Parsing it requires direct access to the array and its elements without a surrounding parent object.</p><pre class="crayon-plain-tag">[
    {
        "name": "FirstName",
        "value": "Bob"
    },
    {
        "name": "LastName",
        "value": "Tylor"
    },
    {
        "name": "Phone",
        "value": "111-111-1111"
    }
]</pre><p>
<strong>Output:</strong><br />
From this JSON array&#8217;s element name should be used as the column header, and the corresponding element value should populate the relevant column.</p><pre class="crayon-plain-tag">FirstName  |  LasteName  |  Phone
Bob        |  Tylor      |  111-111-1111</pre><p>
<p>&nbsp;<br />
To parse this type of rootless JSON array, we need to use the &#8220;<strong>EnableSingleRowOutput</strong>&#8221; and &#8220;<strong>RawOutputDataTemplate</strong>&#8221; settings. These settings ensure that the array is treated as individual rows of data and that the raw JSON structure is maintained during parsing, allowing for direct access to each element within the array.<br />
&nbsp;<br />
To do so Right-click on the <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/">JSON Parser Transform</a>, go to &#8220;<strong>Properties</strong>&#8221;</p>
<ul>
<li>Search for &#8220;<strong>EnableSingleRowOutput</strong>&#8220;, and set its value to <code><strong>True</strong></code></li>
<li>Next, search for the property &#8220;<strong>RawOutputDataTemplate</strong>&#8221; and set its value as <code><strong>{data: [$1]}</strong></code></li>
</ul>
<div id="attachment_11149" style="width: 693px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-json-source-enable-single-row-output.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11149" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-json-source-enable-single-row-output.jpg" alt="ssis-json-source-enable-single-row-output" width="683" height="655" class="size-full wp-image-11149" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-json-source-enable-single-row-output.jpg 683w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-json-source-enable-single-row-output-300x288.jpg 300w" sizes="(max-width: 683px) 100vw, 683px" /></a><p id="caption-attachment-11149" class="wp-caption-text">SSIS JSON Source EnableSingleRowOutput and RawOutputDataTemplate Property</p></div>
&nbsp;<br />
Now, under the <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/">JSON Parser Transform</a>.</p>
<ul>
<li>Navigate to the &#8220;<strong>Array Transform</strong>&#8221; tab.</li>
<li>Set the Transform Type to &#8220;<strong>Key/Value to Columns</strong>&#8220;</li>
<li>Then select the desired &#8220;<strong>Column Name Filter</strong>&#8220;</li>
<li>And select the desired &#8220;<strong>Row Values Filter</strong>&#8220;</li>
</ul>
<p>That&#8217;s it! Click the &#8216;Preview&#8217; button in the JSON source, and at runtime, you&#8217;ll get the desired output like this:<br />
<div id="attachment_11150" style="width: 810px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/rootless-json-array-pattern.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11150" src="https://zappysys.com/blog/wp-content/uploads/2017/08/rootless-json-array-pattern.png" alt="rootless-json-array-pattern" width="800" height="747" class="size-full wp-image-11150" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/rootless-json-array-pattern.png 800w, https://zappysys.com/blog/wp-content/uploads/2017/08/rootless-json-array-pattern-300x280.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/rootless-json-array-pattern-768x717.png 768w" sizes="(max-width: 800px) 100vw, 800px" /></a><p id="caption-attachment-11150" class="wp-caption-text">Parse Rootless JSON Array Using JSON Source</p></div>
&nbsp;<br />
If you have multiple JSON array columns in the source/output dataset, in that case you can use multiple JSON Parsers to handle each respective JSON array column. </p>
<p>You can find a sample article and a video tutorial here: <a href="https://zappysys.zendesk.com/hc/en-us/articles/115004905353-Reading-multiple-arrays-from-JSON-XML-in-SSIS">Reading Multiple Arrays from JSON/XML in SSIS.</a><br />
<strong>Multicast approach (the recommended way):</strong></p>
<div><em><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-parser-transform/ssis-json-extract-multiple-array-output-using-parser.png?resize=720%2C513&amp;ssl=1" alt="Extract multiple array output from JSON file / REST API response in (SSIS JSON Source, JSON Parser Transform)" width="702" height="500"></em></div>
<h3>Pattern 5 &#8211; Multiple Columns with Expressions (Google Geocoding API Usecase)</h3>
<p>(<strong>Version 2.7.4 or higher</strong>) If you have a use case to include additional columns in the output based on multiple JSONPath expressions then you can use below option. This is useful for API such as <a href="https://developers.google.com/maps/documentation/geocoding/start" target="_blank" rel="noopener">Google GeoCoding API</a></p>
<p>Assume that you have following JSON as input (For demo use Direct Value Mode). You want to extract Address Components into Columns. Perform the following steps to paste such JSON.</p>
<p>&nbsp;</p><pre class="crayon-plain-tag">{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "1455",
               "short_name" : "1455",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Gateview Circle Northeast",
               "short_name" : "Gateview Cir NE",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Marietta",
               "short_name" : "Marietta",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Cobb County",
               "short_name" : "Cobb County",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Georgia",
               "short_name" : "GA",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "30062",
               "short_name" : "30062",
               "types" : [ "postal_code" ]
            },
            {
               "long_name" : "2176",
               "short_name" : "2176",
               "types" : [ "postal_code_suffix" ]
            }
         ],
         "formatted_address" : "1455 Gateview Cir NE, Marietta, GA 30062, USA",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 33.9863736,
                  "lng" : -84.5125815
               },
               "southwest" : {
                  "lat" : 33.9862069,
                  "lng" : -84.5127193
               }
            },
            "location" : {
               "lat" : 33.9863117,
               "lng" : -84.51265389999999
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 33.98763923029151,
                  "lng" : -84.51130141970849
               },
               "southwest" : {
                  "lat" : 33.98494126970851,
                  "lng" : -84.51399938029151
               }
            }
         },
         "place_id" : "ChIJhUujpoIT9YgRVnSiltZkv0U",
         "types" : [ "premise" ]
      },
      
      {
         "address_components" : [
            {
               "long_name" : "1485",
               "short_name" : "1485",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Gateview Way Northeast",
               "short_name" : "Gateview Way NE",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Marietta",
               "short_name" : "Marietta",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Cobb County",
               "short_name" : "Cobb County",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Georgia",
               "short_name" : "GA",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "30066",
               "short_name" : "30062",
               "types" : [ "postal_code" ]
            },
            {
               "long_name" : "2176",
               "short_name" : "2176",
               "types" : [ "postal_code_suffix" ]
            }
         ],
         "formatted_address" : "1481 Gateview Cir NE, Marietta, GA 30062, USA",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 33.9863736,
                  "lng" : -84.5125815
               },
               "southwest" : {
                  "lat" : 33.9862069,
                  "lng" : -84.5127193
               }
            },
            "location" : {
               "lat" : 33.9863117,
               "lng" : -84.51265389999999
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 33.98763923029151,
                  "lng" : -84.51130141970849
               },
               "southwest" : {
                  "lat" : 33.12233444,
                  "lng" : -84.3434343434
               }
            }
         },
         "place_id" : "DuIJhUujpoIT9YgRVnSiltZkvCH",
         "types" : [ "premise" ]
      }      
   ],
   "status" : "OK"
}</pre><p>
&nbsp;</p>
<p>Steps to Parse JSON using Multiple Expressions</p>
<ol>
<li>Drag and drop ZS JSON Source inside Data Flow Designer surface</li>
<li>Double click to edit component</li>
<li>Select Direct Value Mode and enter sample JSON (See above example)</li>
<li>Select Filter or enter manually  <strong>$.results[*]</strong></li>
<li>Go to <strong>2D Array Transformation</strong> Tab</li>
<li>Select Transformation Type as <strong>Multiple columns using Expressions</strong></li>
<li>Click Configure Columns. You can now enter column name and expression to extract value for that column. Your expression must return only a single value.<br />
For Example, we entered expressions like below<br />
<pre class="crayon-plain-tag">Column =&gt; street_number
Expression =&gt; $.address_components[?(@.types[0]=='street_number')].long_name
--------------------------------------------------------------------------
Column =&gt; street_name
Expression =&gt; $.address_components[?(@.types[0]=='street_name')].long_name
--------------------------------------------------------------------------
Column =&gt; city
Expression =&gt; $.address_components[?(@.types[0]=='city')].long_name
...............
...............
...............</pre>
<div id="attachment_4517" style="width: 835px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-google-geocode-api-example-parse-multiple-columns-jsonpath-expressions.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4517" class="size-full wp-image-4517" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-google-geocode-api-example-parse-multiple-columns-jsonpath-expressions.png" alt="Pattern 5- Multiple Columns Using JSONPath Expressions (Google Geocoding API example)" width="825" height="683" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-google-geocode-api-example-parse-multiple-columns-jsonpath-expressions.png 825w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-google-geocode-api-example-parse-multiple-columns-jsonpath-expressions-300x248.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-google-geocode-api-example-parse-multiple-columns-jsonpath-expressions-768x636.png 768w" sizes="(max-width: 825px) 100vw, 825px" /></a><p id="caption-attachment-4517" class="wp-caption-text">Pattern 5- Multiple Columns Using JSONPath Expressions (Google Geocoding API example)</p></div></li>
<li>Now click Preview to see parsed data. As you see along with other columns we also got additional columns using complex JSONPath expressions.
<div id="attachment_4518" style="width: 820px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/clean-parse-addresses-using-google-geocode-api-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4518" class="size-full wp-image-4518" src="https://zappysys.com/blog/wp-content/uploads/2017/08/clean-parse-addresses-using-google-geocode-api-ssis.png" alt="Preview Cleaned / Parsed Addresses from Google Geocoding API response" width="810" height="566" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/clean-parse-addresses-using-google-geocode-api-ssis.png 810w, https://zappysys.com/blog/wp-content/uploads/2017/08/clean-parse-addresses-using-google-geocode-api-ssis-300x210.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/clean-parse-addresses-using-google-geocode-api-ssis-768x537.png 768w" sizes="(max-width: 810px) 100vw, 810px" /></a><p id="caption-attachment-4518" class="wp-caption-text">Preview Cleaned / Parsed Addresses from Google Geocoding API response</p></div></li>
</ol>
<h2></h2>
<h3>Pattern 6 &#8211; Columnless array</h3>
<p>In this pattern you have 2D array without any property name in JSON like below. For this select Columnless Array option on 2D Transform Tab. You can also define custom columns if you dont like default names.</p><pre class="crayon-plain-tag">[
 [1, "AAA", "2012-01-01"],
 [2, "BBB", "2015-01-21"],
 [3, "CCC", "2017-01-31"]
]</pre><p>
OR API Patterns like <a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/" target="_blank" rel="noopener">Google Sheet API</a></p><pre class="crayon-plain-tag">{
  "range": "Sheet1!A1:D5",
  "majorDimension": "ROWS",
  "values": [
    ["Item", "Cost", "Stocked", "Ship Date"],
    ["Wheel", "$20.50", "4", "3/1/2016"],
    ["Door", "$15", "2", "3/15/2016"],
    ["Engine", "$100", "1", "30/20/2016"],
    ["Totals", "$135.5", "7", "3/20/2016"]
  ],
}</pre><p>
<h4>Manually supply column names</h4>
<p>If you want to enter column names manually then use below setting. If you do not enter comma separated list of columns then system will auto generate names based on total columns found.</p>
<div id="attachment_7101" style="width: 772px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/parse-json-array-muti-dimensional-without-name.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7101" class="size-full wp-image-7101" src="https://zappysys.com/blog/wp-content/uploads/2017/08/parse-json-array-muti-dimensional-without-name.png" alt="Parse JSON Array without any column names / property" width="762" height="499" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/parse-json-array-muti-dimensional-without-name.png 762w, https://zappysys.com/blog/wp-content/uploads/2017/08/parse-json-array-muti-dimensional-without-name-300x196.png 300w" sizes="(max-width: 762px) 100vw, 762px" /></a><p id="caption-attachment-7101" class="wp-caption-text">Parse JSON Array without any column names / property</p></div>
<h4>Auto detect column names from first line</h4>
<p>As we mentioned that API like Google Sheets might send you column names as Row data in first line. In such case you can use new option provided in v3.1.2 or later as below. If you 2D array is nested like below screenshot (e.g. under Values node) then you have to supply Array Filter on Filter Options Tab. In this case its <pre class="crayon-plain-tag">$.values[*]</pre> . As you can see when we checked First line has column names option it autodetected column names.</p>
<div id="attachment_9118" style="width: 645px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9118" class="size-full wp-image-9118" src="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png" alt="JSON With 2D Array with Column names in First Row (Google Sheets API Pattern)" width="635" height="669" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png 635w, https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern-285x300.png 285w" sizes="(max-width: 635px) 100vw, 635px" /></a><p id="caption-attachment-9118" class="wp-caption-text">JSON With 2D Array with Column names in First Row (Google Sheets API Pattern)</p></div>
<h3>Pattern 7 &#8211; JSON Line format (JSONL) &#8211; New line separated</h3>
<p>Version 3.1.2 and later you can use option to parse <a href="http://jsonlines.org/examples/">JSON Line format</a>. In JSON Line (also known as <strong>JSONL</strong> ) record separator is \n or \r\n. There are two versions of JSONL format.</p>
<ol>
<li><span style="text-decoration: underline;">JSON Object Format</span> &#8211; Using <pre class="crayon-plain-tag">{ }</pre>  brackets around record (Also referred as Multi-Content Format). For This format you do not need any special settings in ZappySys. Its automatically detected and parsed correctly.<br />
<strong>Example:</strong><br />
<pre class="crayon-plain-tag">{ Id:1, Name: "AAA" }
{ Id:2, Name: "BBB" }
{ Id:3, Name: "CCC" }</pre>
</li>
<li>JSON Array Format &#8211; Using <pre class="crayon-plain-tag">[ ]</pre>  brackets around record. Typically this format is used with First line as Columns and other lines as Data.<br />
<strong>Example:</strong><br />
<pre class="crayon-plain-tag">["Id","Name"]
[1,"AAA"]
[2,"BBB"]
[3,"CCC"]</pre>
</li>
</ol>
<p>As we said First Example is automatically Parsed by ZappySys but for 2nd example (Array format) you have to use below Settings.</p>
<div id="attachment_8906" style="width: 692px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/parse-json-line-format-jsonl-with-header.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8906" class="size-full wp-image-8906" src="https://zappysys.com/blog/wp-content/uploads/2017/08/parse-json-line-format-jsonl-with-header.png" alt="Parsing JSON Lines / JSONL Data Format (JSON Array Separated by new line)" width="682" height="528" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/parse-json-line-format-jsonl-with-header.png 682w, https://zappysys.com/blog/wp-content/uploads/2017/08/parse-json-line-format-jsonl-with-header-300x232.png 300w" sizes="(max-width: 682px) 100vw, 682px" /></a><p id="caption-attachment-8906" class="wp-caption-text">Parsing JSON Lines / JSONL Data Format (JSON Array Separated by new line)</p></div>
<h2>Pattern 8 &#8211; Columnless Value Array with Pivot</h2>
<p>If you have data like below without any property name and all in single dimension  array then you can use new option introduced after v3.1.3 &#8220;<strong>Pivot &#8211; Columnless Array</strong>&#8221; on array transformation tab. This option is not same as Pivot Option found on Pivot Tab (See next section). This option only works when you have no property name for array you like to transform. If you have property name for array then use option as described in the next section.</p><pre class="crayon-plain-tag">["one","two",null]</pre><p>
<strong>Output:</strong></p><pre class="crayon-plain-tag">data
------------
one
two
null</pre><p>
<div id="attachment_9104" style="width: 492px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/pivot-columnless-json-array.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9104" class="size-full wp-image-9104" src="https://zappysys.com/blog/wp-content/uploads/2017/08/pivot-columnless-json-array.png" alt="Pattern 8 - Pivot Columnless Array" width="482" height="355" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/pivot-columnless-json-array.png 482w, https://zappysys.com/blog/wp-content/uploads/2017/08/pivot-columnless-json-array-300x221.png 300w" sizes="(max-width: 482px) 100vw, 482px" /></a><p id="caption-attachment-9104" class="wp-caption-text">Pattern 8 &#8211; Pivot Columnless Array</p></div>
<p>&nbsp;</p>
<h2>Pivot JSON / XML data</h2>
<p>Now let&#8217;s consider little different scenario. If you don&#8217;t have JSON Array (See below sample) and your values are part of property name (in below case ProductCode &#8211; P001, P002&#8230; is actually Property name rather than value).  In this case you need to use <strong>Pivot Option</strong>. <a href="https://zappysys.com/blog/pivot-json-xml-data-using-ssis-odbc-drivers/" target="_blank" rel="noopener">Check this article for full detail</a>.</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>
<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>
&nbsp;</p>
<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>
<h2></h2>
<h2>Conclusion</h2>
<p>Using <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> or <a href="https://zappysys.com/products/odbc-powerpack/">ODBC PowerPack</a> you can transform complex JSON in a few clicks. Both products support all options listed in this article. Based on your use case you can either use ZappySys Drivers or use SSIS Connectors.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/">Parse JSON array in SSIS or ODBC Drivers</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read/load data in Xero using SSIS</title>
		<link>https://zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 25 Jul 2017 03:02:24 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth1]]></category>
		<category><![CDATA[OAuth2.0]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[ssis oauth connection]]></category>
		<category><![CDATA[X509]]></category>
		<category><![CDATA[Xero]]></category>
		<category><![CDATA[Xero Api]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1602</guid>

					<description><![CDATA[<p>Introduction Xero is well known Cloud based Accounting Software. In this post you will learn how to implement Xero API Integration with SQL Server or any other RDBMS (e.g. Oracle, MySQL, Postgresql) using SSIS in few clicks. We will use SSIS JSON Source to Read data from Xero and Load into SQL Server / other [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/">How to read/load data in Xero using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/07/xero-integration.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1621" src="//zappysys.com/blog/wp-content/uploads/2017/07/xero-integration.png" alt="" width="120" height="120" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/xero-integration.png 375w, https://zappysys.com/blog/wp-content/uploads/2017/07/xero-integration-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/07/xero-integration-300x300.png 300w" sizes="(max-width: 120px) 100vw, 120px" /></a>Xero is well known Cloud based Accounting Software. In this post you will learn how to implement <a href="https://developer.xero.com/documentation/getting-started/getting-started-guide" target="_blank" rel="noopener">Xero API</a> Integration with SQL Server or any other RDBMS (e.g. Oracle, MySQL, Postgresql) using <strong>SSIS</strong> in few clicks. We will use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a> to <strong>Read data from Xero</strong> and Load into SQL Server / other target (Using OAuth Connection). We will also discuss reverse scenario to <strong>Write data to Xero</strong> (API POST for Insert or Update in Xero) using <a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">SSIS Web API Destination</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">SSIS JSON Generator Transform</a></p>
<h2></h2>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we look into Step-By-Step section to extract and load data from <strong>Xero to SQL Server</strong> let’s make sure you met following requirements.</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<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><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>ZappySys SSIS PowerPack</em> installed</a>. Click on the link to download FREE trial.</li>
<li>You have basic familiarity with REST API concepts and Xero API.</li>
</ol>
<h2>Concepts of Xero REST API</h2>
<h3>API Authorization</h3>
<p>Before you can access Xero API you must register account and App. There are 3 types of Apps to access Xero API.</p>
<ol>
<li>Private App (X509 Certificate used to sign requests)</li>
<li>Public App (Use 3-legged OAuth. Token expires in 30 mins and then you have to authorize again from UI)</li>
<li>Partner App (Use 3-legged OAuth. Token expires in 30 mins.. but refresh token supported to get new token for unlimited times without Authorization via Login UI)</li>
<li><a href="https://developer.xero.com/documentation/oauth2/auth-flow" target="_blank" rel="noopener">OAuth2.0 Authentication (Recommended) </a></li>
</ol>
<p>In this article we will use <a href="https://developer.xero.com/documentation/auth-and-limits/private-applications" target="_blank" rel="noopener">Private App</a> to access your company data in Xero.</p>
<h3>Data formats</h3>
<p>Xero API supports Xml and JSON both formats over the same URL (endpoints). If you want data in JSON format then you have to pass following Header (else data in Xml format will be returned). If you are using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a> then make sure following header is added. For <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a> no need to add this header.</p><pre class="crayon-plain-tag">Accept : application/json</pre><p>
<h2>Step-By-Step : Xero API Integration in SSIS</h2>
<p>Now lets look at steps needed to fetch data from Xero and load into SQL Server.</p>
<h3><span id="Configure_OAuth_Connection_for_Google_BigQuery_API">Configure OAuth2.0 Connection for Xero API (Recommended)</span></h3>
<p>So let&#8217;s how to create the Xero OAuth2.0 connection. For more on OAuth2.0 refer to <a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/" target="_blank" rel="noopener">this article</a>.</p>
<ol>
<li>Right-click inside the Connection Managers area again and click “New Connection…”</li>
<li>From the connection type list select “ZS-OAUTH” connection type.
<div id="attachment_1569" style="width: 687px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1569" class="wp-image-1569 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png" alt="Create new SSIS OAuth API Connection Manager" width="677" height="220" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection-300x97.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-1569" class="wp-caption-text">Create new SSIS OAuth API Connection Manager</p></div></li>
<li>Select<em> OAuth Provider </em>which Custom, enter the CleintID and Secret and set the URLs as below and desired <a href="https://developer.xero.com/documentation/oauth2/scopes" target="_blank" rel="noopener">scopes</a> that are required for the API Call.<br />
Auth URL:<br />
<pre class="crayon-plain-tag">https://login.xero.com/identity/connect/authorize</pre>
Token URL:<br />
<pre class="crayon-plain-tag">https://identity.xero.com/connect/token</pre>
Scopes: Add your desired scopes based on your API call requirements.<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;">Note: To get a refresh token, you must request the offline_access scope. A refresh token allows you to refresh your access token and maintain an offline connection.<br />
<strong>offline_access</strong></p>
<p><a href="https://developer.xero.com/documentation/guides/oauth2/scopes/#offline-access" target="_blank" rel="noopener">https://developer.xero.com/documentation/guides/oauth2/scopes/#offline-access</a></div></div>
<div id="attachment_8858" style="width: 681px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-oauth2.0-connection-configuration.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8858" class="wp-image-8858 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-oauth2.0-connection-configuration.png" alt="OAuth2.0 Connection" width="671" height="695" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-oauth2.0-connection-configuration.png 671w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-oauth2.0-connection-configuration-290x300.png 290w" sizes="(max-width: 671px) 100vw, 671px" /></a><p id="caption-attachment-8858" class="wp-caption-text">OAuth2.0 Connection</p></div></li>
<li> Now go to the Advanced tab and set the redirect URL as below and also you need to set the same URL in the Xero API App.<br />
<pre class="crayon-plain-tag">https://zappysys.com/oauth2</pre>
<div id="attachment_1345" style="width: 581px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-setting-redirect-url1.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1345" class="wp-image-1345 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-setting-redirect-url1.png" alt="" width="571" height="123" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-setting-redirect-url1.png 571w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-setting-redirect-url1-300x65.png 300w" sizes="(max-width: 571px) 100vw, 571px" /></a><p id="caption-attachment-1345" class="wp-caption-text">Set Callback/Return Url in OAuth Connection</p></div></li>
<li>Now Click on the Generate Token Button and logged in with Xero username and password and grant permission.</li>
<li>That&#8217;s it your token is generated. If you got the blank Screen like this after following all the steps. Close that window.
<div id="attachment_8859" style="width: 671px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-oauth2.0-connection-blank-screen.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8859" class="wp-image-8859 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-oauth2.0-connection-blank-screen.png" alt="OAuth2.0 connection : Blank Window at last" width="661" height="653" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-oauth2.0-connection-blank-screen.png 661w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-oauth2.0-connection-blank-screen-300x296.png 300w" sizes="(max-width: 661px) 100vw, 661px" /></a><p id="caption-attachment-8859" class="wp-caption-text">OAuth2.0 connection : Blank Window at last</p></div></li>
<li>And it will ask you to use the Different Method to generate the Token using system default browser <strong>click on YES</strong>.
<div id="attachment_8860" style="width: 671px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-connection-default-browser-to-generate-toekn.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8860" class="size-full wp-image-8860" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-connection-default-browser-to-generate-toekn.png" alt="Different Method to generate the Token using system default browser" width="661" height="653" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-connection-default-browser-to-generate-toekn.png 661w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-connection-default-browser-to-generate-toekn-300x296.png 300w" sizes="(max-width: 661px) 100vw, 661px" /></a><p id="caption-attachment-8860" class="wp-caption-text">Different Method to generate the Token using system default browser</p></div></li>
<li>It will open the URL in the browser there you need to log in and grant the permission.</li>
<li>After that, you will able to view the access token in the browser. you can copy from there also.
<div id="attachment_8861" style="width: 738px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-default-browser-generated-token.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8861" class="wp-image-8861 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-default-browser-generated-token.png" alt="Generated Token" width="728" height="347" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-default-browser-generated-token.png 728w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-default-browser-generated-token-300x143.png 300w" sizes="(max-width: 728px) 100vw, 728px" /></a><p id="caption-attachment-8861" class="wp-caption-text">Generated Token</p></div></li>
<li>At the last, it will again focus on the connection and there it will ask you to save the token if you want to store it. if not then you can manually copy and paste that token.
<div id="attachment_8862" style="width: 671px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-popup-to-store-token.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8862" class="wp-image-8862 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-popup-to-store-token.png" alt="OAuth Connection : Store the Tokens" width="661" height="653" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-popup-to-store-token.png 661w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-popup-to-store-token-300x296.png 300w" sizes="(max-width: 661px) 100vw, 661px" /></a><p id="caption-attachment-8862" class="wp-caption-text">OAuth Connection : Store the Tokens</p></div></li>
<li>That&#8217;s it now click on the Test Connection button to test it.
<div id="attachment_6415" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-quickbooks-oauth-test.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6415" class="size-medium_large wp-image-6415" src="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-quickbooks-oauth-test-768x735.png" alt="" width="720" height="689" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-quickbooks-oauth-test-768x735.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-quickbooks-oauth-test-300x287.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-quickbooks-oauth-test.png 771w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-6415" class="wp-caption-text">Generate Token and Test Connection</p></div></li>
</ol>
<h3>Register OAuth App Private for Xero (Private App) OAuth Connection (Depreciated)</h3>
<p>Here is how to configure Xero to use Private App (click on below link).</p>
<p><a href="https://developer.xero.com/documentation/auth-and-limits/private-applications" target="_blank" rel="noopener">https://developer.xero.com/documentation/auth-and-limits/private-applications</a></p>
<p>In the above link during <a href="https://developer.xero.com/documentation/api-guides/create-publicprivate-key" target="_blank" rel="noopener">these steps</a> <strong>openssl</strong> command may throw error about <strong>openssl.cnf is missing</strong> or cannot load. If you face such error then don&#8217;t worry just refer to following workaround.</p>
<p><a href="https://stackoverflow.com/questions/14459078/unable-to-load-config-info-from-usr-local-ssl-openssl-cnf" target="_blank" rel="noopener">https://stackoverflow.com/questions/14459078/unable-to-load-config-info-from-usr-local-ssl-openssl-cnf</a></p>
<p>Basically you can either supply config file path in each command OR set path by issuing SET command before any other command. See below examples (Assuming you installed OpenSSL to c:\OpenSSL-Win64 folder)</p><pre class="crayon-plain-tag">c:\OpenSSL-Win64&amp;gt;openssl req -x509 -config &quot;C:\OpenSSL-Win64\bin\openssl.cnf&quot;</pre><p>
&#8212; OR &#8212;  type before command before any other openssl commands</p><pre class="crayon-plain-tag">c:\OpenSSL-Win64&amp;gt;set OPENSSL_CONF=c:\OpenSSL-Win64\bin\openssl.cnf

c:\OpenSSL-Win64&amp;gt;openssl req -x509 -config &quot;C:\OpenSSL-Win64\bin\openssl.cnf&quot;</pre><p>
Once you generate public key, private key and, pfx file we are ready to <strong>call Xero API in SSIS</strong></p>
<h4><span id="Configure_OAuth_Connection_for_Google_BigQuery_API">Configure Xero (Private App) OAuth Connection</span></h4>
<p>Once you generate certificate using openssl and register Private App for Xero we are ready to move to SSIS piece. Lets see how to do that.</p>
<ol>
<li>Open Visual Studio</li>
<li>Open existing SSIS Project or create new using File &gt; New &gt; Project &gt; Choose &#8220;Integration Services Project&#8221; Type under Business Intelligence template category</li>
<li>Open Package</li>
<li>Right click inside Connection Managers area and click “New Connection…”</li>
<li>From the connection type list select “ZS-OAUTH” connection type.
<div id="attachment_1569" class="wp-caption alignnone">
<p><a href="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png"><img loading="lazy" decoding="async" class="size-full wp-image-1569" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png?resize=677%2C220" sizes="(max-width: 677px) 100vw, 677px" srcset="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png?w=677 677w, https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png?resize=300%2C97 300w" alt="Create new SSIS OAuth API Connection Manager" width="643" height="209" data-attachment-id="1569" data-permalink="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/ssis-oauth-create-new-connection/#main" data-orig-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png?fit=677%2C220&amp;ssl=1" data-orig-size="677,220" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-oauth-create-new-connection" data-image-description="&lt;p&gt;Create new SSIS OAuth API Connection Manager&lt;/p&gt; " data-medium-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png?fit=300%2C97&amp;ssl=1" data-large-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png?fit=677%2C220&amp;ssl=1" /></a></p>
<p class="wp-caption-text">Create new SSIS OAuth API Connection Manager</p>
</div>
</li>
<li>On the connection select “Xero (Private App)” from Service Provider Dropdown</li>
<li>Enter Client ID (Obtain this from <a href="https://app.xero.com/Application/" target="_blank" rel="noopener">App created</a> in Previous section) App Selection leave “Use Default OAuth App” selected. If you <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">created custom OAuth App</a> then select “Use Custom OAuth App” Option</li>
<li>Enter some fake value in Client Secret (not needed when you use Private App). Secret will come from certificate file like below.
<div id="attachment_1612" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-connection-for-xero-private-app-x509-certificate.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1612" class="size-full wp-image-1612" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-connection-for-xero-private-app-x509-certificate.png" alt="SSIS OAuth Connection - Configure Xero API Connectivity using Private App (Certificate File Approach)" width="675" height="512" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-connection-for-xero-private-app-x509-certificate.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-connection-for-xero-private-app-x509-certificate-300x228.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1612" class="wp-caption-text">SSIS OAuth Connection &#8211; Configure Xero API Connectivity using Private App (Certificate File Approach)</p></div></li>
<li>Now go to Certificate tab and Check Use Certificate Enter, Enter certificate location and password like below.
<div id="attachment_1611" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-xero-x509-certificate-public-private-key-example-pfx-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1611" class="size-full wp-image-1611" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-xero-x509-certificate-public-private-key-example-pfx-file.png" alt="SSIS OAuth Connection - Configure X509 Certificate File Option for Xero Private App (Select PFX file)" width="675" height="512" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-xero-x509-certificate-public-private-key-example-pfx-file.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-xero-x509-certificate-public-private-key-example-pfx-file-300x228.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1611" class="wp-caption-text">SSIS OAuth Connection &#8211; Configure X509 Certificate File Option for Xero Private App (Select PFX file)</p></div></li>
<li>Click OK to save OAuth connection manager</li>
</ol>
<p>So <strong>in the next section</strong> from the upper connections, <strong>we need to use any of the one connection only</strong> for Xero API now let&#8217;s try to read data from Xero using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a>.</p>
<p><strong>Xero recently added OAuth 2.0 support so that now recommended way to use as Connection.</strong></p>
<h3>Configure JSON / REST API Source &#8211; Read data from Xero</h3>
<p>Now let&#8217;s look at how to configure SSIS JSON Source to read data from Xero API</p>
<ol>
<li>In the control flow ssis toolbox Drag and drop data flow task</li>
<li>Double click Data flow</li>
<li>Drag ZS JSON Source (REST API or File) from SSIS Toolbox and drop on Data flow designer</li>
<li>Double click <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> to configure it.</li>
<li>Set the following properties
<ol>
<li>Enter URL<br />
<pre class="crayon-plain-tag">https://api.xero.com/api.xro/2.0/Invoices</pre>
</li>
<li>Check Use Credentials and select OAuth connection we created in the previous section</li>
<li>For Headers grid. Click on <strong>Raw Edit</strong> button and remove enter following (remove default headers)<br />
<pre class="crayon-plain-tag">Accept: application/json</pre>
</li>
<li>Click on Select filter and select an array node as below to generate filter expression (e.g. $.Invoices[*] )</li>
</ol>
</li>
</ol>
<div id="attachment_1615" style="width: 1120px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-read-invoices-using-json-rest-api-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1615" class="size-full wp-image-1615" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-read-invoices-using-json-rest-api-source.png" alt="Configure SSIS JSON /REST API Source - Read Xero Invoices" width="1110" height="714" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-read-invoices-using-json-rest-api-source.png 1110w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-read-invoices-using-json-rest-api-source-300x193.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-read-invoices-using-json-rest-api-source-768x494.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-read-invoices-using-json-rest-api-source-1024x659.png 1024w" sizes="(max-width: 1110px) 100vw, 1110px" /></a><p id="caption-attachment-1615" class="wp-caption-text">Configure SSIS JSON /REST API Source &#8211; Read Xero Invoices</p></div>
<p>Also, add following header in case of multiple tenants are being used in XERO environment &#8211;</p><pre class="crayon-plain-tag">xero-tenant-id: &lt;TENANT ID FROM XERO&gt;</pre><p>
<h3>Configure Xero REST API Pagination in SSIS JSON Source</h3>
<p>By default, Xero may not send you all records and you may have to setup pagination to read more data after the first response.</p>
<p>For example, you like to read LineItems from Invoices. For that make sure you use below URL and include page=1 to start with. If you do not include page=1 then Line items are not returned (Yes its ODD but clearly <a href="https://developer.xero.com/documentation/api/invoices" target="_blank" rel="noopener">documented here</a>).</p>
<ol>
<li>Enter URL as<br />
<pre class="crayon-plain-tag">https://api.xero.com/api.xro/2.0/Invoices?page=1</pre>
</li>
<li>Select Filter as <pre class="crayon-plain-tag">$.Invoices[*].LineItems[*]</pre></li>
<li>Go to Pagination tab</li>
<li>Select Pagination by URL Parameter</li>
<li>Enter <strong>page</strong> as pagination parameter name like below
<div id="attachment_457" style="width: 843px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-rest-api-looping-url-parameter-mode.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-457" class="size-full wp-image-457" src="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-rest-api-looping-url-parameter-mode.png" alt="REST API Looping/Pagination via URL Page Number Parameter (Loop until last page detected)" width="833" height="585" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-rest-api-looping-url-parameter-mode.png 833w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-rest-api-looping-url-parameter-mode-300x211.png 300w" sizes="(max-width: 833px) 100vw, 833px" /></a><p id="caption-attachment-457" class="wp-caption-text">REST API Looping/Pagination via URL Page Number Parameter (Loop until last page detected)</p></div></li>
<li>Click OK to save</li>
</ol>
<p>Now when you run package you will see all LineItems for each Invoice will be returned.</p>
<h3>Loading Xero data to SQL Server</h3>
<p>Now last step is loading Xero data to SQL Server. For example purpose we will load data into SQL Server but you can load into any Target (e.g. Flat file, Oracle, Excel) using Microsoft or ZappySys Destination connectors</p>
<p>To load Xero data into SQL Server perform following steps</p>
<ol>
<li>Drag OLEDB destination on Data Flow surface</li>
<li>Connect ZS JSON Source to Destination</li>
<li>On OLEDB destination select / create new SQL Connection and then Click &#8220;New Table&#8221;</li>
<li>Click on Mappings tab and click OK to save</li>
<li>Execute Package</li>
</ol>
<div id="attachment_1617" style="width: 792px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1617" class="size-full wp-image-1617" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png" alt="Configure SSIS OLEDB Destination - Loading Xero Data into SQL Server Table" width="782" height="593" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png 782w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load-300x227.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load-768x582.png 768w" sizes="(max-width: 782px) 100vw, 782px" /></a><p id="caption-attachment-1617" class="wp-caption-text">Configure SSIS OLEDB Destination &#8211; Loading Xero Data into SQL Server Table</p></div>
<div id="attachment_1618" style="width: 744px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1618" class="size-full wp-image-1618" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png" alt="Xero to SQL Server Column Mappings for OLEDB Destination" width="734" height="543" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png 734w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings-300x222.png 300w" sizes="(max-width: 734px) 100vw, 734px" /></a><p id="caption-attachment-1618" class="wp-caption-text">Xero to SQL Server Column Mappings for OLEDB Destination</p></div>
<div id="attachment_1619" style="width: 293px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1619" class="size-full wp-image-1619" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png" alt="Loading Xero data to SQL Server in SSIS" width="283" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png 283w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server-217x300.png 217w" sizes="(max-width: 283px) 100vw, 283px" /></a><p id="caption-attachment-1619" class="wp-caption-text">Loading Xero data to SQL Server in SSIS</p></div>
<h2>POST data to Xero (Insert or Update)</h2>
<p>So far we have seen how to read data from Xero. Now let&#8217;s look at how to write data to Xero.</p>
<p>There are two ways you can achieve this.</p>
<ol>
<li>Use <a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> in Data Flow</li>
<li>Use <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> in Control Flow</li>
</ol>
<p>Read this article to learn more about <a href="//zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">API POST using SSIS</a></p>
<h3>Using SSIS Web API Task (Write data from SQL Server to Xero)</h3>
<h3><img decoding="async" src="https://i0.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination-post-json-to-rest-api-url.png?resize=503%2C403" alt="SSIS Web API Destination - POST JSON to REST API Endpoint, Create / Update records" /></h3>
<h3>Using REST API Task to POST data to Xero</h3>
<p>If you have JSON/XML data already prepared and if you like to POST it to Xero API then REST API Task would be easy to use.</p>
<p>REST API Task Body can be direct string, variable (e.g. {{User::varSomeData}} or <a href="https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/" target="_blank" rel="noopener">Body can come from File </a></p>
<div id="attachment_1616" style="width: 872px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1616" class="size-full wp-image-1616" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png" alt="SSIS REST API Task - POST data to Xero (Create contacts)" width="862" height="602" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png 862w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example-300x210.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example-768x536.png 768w" sizes="(max-width: 862px) 100vw, 862px" /></a><p id="caption-attachment-1616" class="wp-caption-text">SSIS REST API Task &#8211; POST data to Xero (Create contacts)</p></div>
<h2>Read data from Xero Report API</h2>
<p>In previous examples we saw how to read data from various Xero API endpoints but now lets look at how to call <a href="https://developer.xero.com/documentation/api/reports" target="_blank" rel="noopener">Xero Report API</a>. For example if you like to extract data displayed in below then you can extract it in Xml or JSON format. Below report is in HTML format but we will show you how to get similar information in JSON format and load into SQL Server Table.</p>
<div style="width: 460px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://www.xero.com/blog/wp-content/uploads//2008/10/pandlreport.png" alt="Xero Report Example - View Profit and Loss Report in Xero Portal" width="450" height="257" /><p class="wp-caption-text">Xero Report Example &#8211; View Profit and Loss Report in Xero Portal</p></div>
<p>To extract above information you can call below API Endpoint (e.g. <a href="https://developer.xero.com/documentation/api/reports#ProfitAndLoss" target="_blank" rel="noopener">Profit &amp; Loss Report</a>)</p><pre class="crayon-plain-tag">GET 
https://api.xero.com/api.xro/2.0/Reports/ProfitAndLoss?fromDate=2017-02-01&amp;toDate=2017-02-28</pre><p>
You can use Variables to make above URL dynamic in JSON Source as below</p><pre class="crayon-plain-tag">https://api.xero.com/api.xro/2.0/Reports/ProfitAndLoss?fromDate={{User::StartDate,yyyy-MM-dd}}&amp;toDate={{User::EndDate,yyyy-MM-dd}}</pre><p>
Each report has its own API URL so make sure you refer to the connect URL for calling different report.</p>
<p>Here is sample response from API</p><pre class="crayon-plain-tag">{
  "Reports": [
    {
      "ReportID": "ProfitAndLoss",
      "ReportName": "Profit and Loss",
      "ReportType": "ProfitAndLoss",
      "ReportTitles": [
        "Profit &amp; Loss",
        "Demo Company (AU)",
        "1 February 2018 to 28 February 2018"
      ],
      "ReportDate": "25 February 2018",
      "UpdatedDateUTC": "\/Date(1519593468971)\/",
      "Rows": [
        {
          "RowType": "Header",
          "Cells": [
            { "Value": "" },
            { "Value": "28 Feb 18" },
            { "Value": "28 Jan 18" }
          ]
        },
        {
          "RowType": "Section",
          "Title": " Income",
          "Rows": [
            {
              "RowType": "Row",
              "Cells": [
                {
                  "Value": "Sales",
                  "Attributes": [
                    {
                      "Value": "e2bacdc6-2006-43c2-a5da-3c0e5f43b452",
                      "Id": "account"
                    }
                  ]
                },{
                  "Value": "9220.05",
                  "Attributes": [
                    {
                      "Value": "e2bacdc6-2006-43c2-a5da-3c0e5f43b452",
                      "Id": "account"
                    }
                  ]
                },{
                  "Value": "5120.05",
                  "Attributes": [
                    {
                      "Value": "e2bacdc6-2006-43c2-a5da-3c0e5f43b452",
                      "Id": "account"
                    }
                  ]
                }
              ]
            },
            {
              "RowType": "SummaryRow",
              "Cells": [
                { "Value": "Total Income" },
                { "Value": "9220.05" },
                { "Value": "1250.09" }
              ]
            }
          ]
        },{
          "RowType": "Section",
          "Rows": [
            {
              "RowType": "Row",
              "Cells": [
                { "Value": "NET PROFIT" },
                { "Value": "-6250.09" },
                { "Value": "-7250.09" }
              ]
            }
          ]
        }
      ]
    }
  ]
}</pre><p>
&nbsp;</p>
<p>Now lets look at steps to configure JSON Source to extract your Xero Report Data.</p>
<ol>
<li>Drag new JSON Source from SSIS Toolbox</li>
<li>Double click JSON Source to configure it</li>
<li>In the Path / Web URL, enter API Report URL to call desired Report Start / End Date or any other expected Parameter by report (<strong>Refer to API Documentation</strong>). For our example we will enter below URL<br />
<pre class="crayon-plain-tag">https://api.xero.com/api.xro/2.0/Reports/ProfitAndLoss?fromDate=2017-02-01&amp;toDate=2017-02-28</pre>
</li>
<li>Check <strong>Use Credentials</strong> and Select Connection we created in the Previous Section</li>
<li>In the Filter enter <pre class="crayon-plain-tag">$.Reports[*].Rows[*].Rows[*]</pre></li>
<li>Now go to 2D Array Transform Tab and configure like below. If your UI varies then use Properties window to edit property manually.<br />
Basically you need to edit<br />
<strong>Transformation Type:</strong> <pre class="crayon-plain-tag">2-dimensional array</pre>
<strong>Column Name Filter:</strong> <pre class="crayon-plain-tag">$.Reports[0].Rows[*].Cells[*].Value</pre>
<strong>Row Values Filter:</strong> <pre class="crayon-plain-tag">$.Cells[*].Value</pre></li>
<li>Now Click Preview Data. If you get error Column &#8221; does not belong to table nosqldata. Then most likely you using old version with Known Issue (i.e. v2.9.7.10822 or older). Get latest version for fix. For workaround of this issue you must follow next section to specify columns manually. Columns must match count.</li>
</ol>
<p>Here is how it will look like.</p>
<div id="attachment_8037" style="width: 680px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-filter-options-extract-report.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8037" class="size-full wp-image-8037" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-filter-options-extract-report.png" alt="Configure Transform Options for Xero Report API (Dynamic Column Title)" width="670" height="166" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-filter-options-extract-report.png 670w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-api-filter-options-extract-report-300x74.png 300w" sizes="(max-width: 670px) 100vw, 670px" /></a><p id="caption-attachment-8037" class="wp-caption-text">Configure Transform Options for Xero Report API (Dynamic Column Title)</p></div>
<div id="attachment_8039" style="width: 842px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-json-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8039" class="size-full wp-image-8039" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-json-source.png" alt="Read from Xero Report API using JSON Source in SSIS (Dynamic Columns Example)" width="832" height="526" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-json-source.png 832w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-json-source-300x190.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-json-source-768x486.png 768w" sizes="(max-width: 832px) 100vw, 832px" /></a><p id="caption-attachment-8039" class="wp-caption-text">Read from Xero Report API using JSON Source in SSIS (Dynamic Columns Example)</p></div>
<h3>Fixing Dynamic Columns Problem in for Xero Report API</h3>
<p>Now let&#8217;s look at one common scenario which you have to think. SSIS data flow has fixed metadata so if your Report is generating Dynamic Columns each time based on Date Range then it will be trouble for you because all your columns may come as null if initial date range changes.</p>
<p>To address this issue you have to use Static Column Names as below.</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: You must enter exact same number of columns returned in the Header Row section or more. If you enter less number of columns then you will get error. For example in previous sample report screen we have following 6 Columns. Portal HTML report page shows YTD as extra column but API may not return this column so you will have to count it as 5 columns in below example. Best thing is enter 13 or more columns (typically covers 12 months data). If report doesn&#8217;t return all columns then you will get some as NULL but its ok because it will not fail.</div></div>
<pre class="crayon-plain-tag">Account (or sometimes blank) | Oct 08 | Sep 08 | Aug 08 | Jul 08 | YTD</pre>
In above case you have to enable following properties. (Below Screenshot has Col1,Col2&#8230;.. Col13  but you can enter less number of columns based on above logic of column count).</p>
<p><strong>NOTE:</strong> Use <a href="https://zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">REST API Task</a> to obtain Raw JSON and review First Row which contains Number of columns<br />
For example if your API return some thing like below then you can use <strong>5 columns</strong> (<strong>one Blank header + 4 Months</strong>)</p><pre class="crayon-plain-tag">"Rows": [
        {
          "RowType": "Header",
          "Cells": [
            { "Value": "" },
            { "Value": "28 Feb 18" }
            { "Value": "28 Mar 18" }
            { "Value": "28 Apr 18" }
            { "Value": "28 May 18" }
          ]
        },</pre><p>
Once we know how many columns we should expect from API response, we can perform following steps. We will now configure our JSON Source component to use Static Columns.</p>
<ol>
<li>Drag new JSON Source from SSIS Toolbox</li>
<li>Right click JSON Source &gt; Click on Properties (You can do below using UI too but in old version no option for that &#8211; See below this section)</li>
<li>Enter following values for property
<ol>
<li><strong>Filter:</strong> <pre class="crayon-plain-tag">$.Reports[*].Rows[*].Rows[*]</pre></li>
<li><strong>ArrayTransformationType:</strong> <pre class="crayon-plain-tag">TransformComplexTwoDimensionalArray</pre></li>
<li><strong>ArrayTransCustomColumns:</strong> <pre class="crayon-plain-tag">Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13</pre>    <strong>(Assuming you have 12 months to compare)</strong></li>
<li><strong>ArrayEnableCustomColumn:</strong> <pre class="crayon-plain-tag">True</pre></li>
<li><strong>ArrayTransRowValueFilter:</strong> <pre class="crayon-plain-tag">$.Cells[*].Value</pre></li>
</ol>
</li>
<li>Now double click JSON Source to configure</li>
<li>In the Path / Web URL, enter API Report URL to call desired Report Start / End Date or any other expected Parameter by report (<strong>Refer to API Documentation</strong>). For our example we will enter below URL<br />
<pre class="crayon-plain-tag">https://api.xero.com/api.xro/2.0/Reports/ProfitAndLoss?fromDate=2017-02-01&amp;toDate=2017-02-28</pre>
</li>
<li>Check <strong>Use Credentials</strong> and Select Connection we created in the Previous Section</li>
<li>In the Filter enter <pre class="crayon-plain-tag">$.Reports[*].Rows[*].Rows[*]</pre></li>
<li>Now click Preview.</li>
</ol>
<p><strong>For Old Version use Properties Grid</strong></p>
<div id="attachment_8040" style="width: 946px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/configure-json-source-xero-api-extract.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8040" class="size-full wp-image-8040" src="https://zappysys.com/blog/wp-content/uploads/2017/07/configure-json-source-xero-api-extract.png" alt="Configure Xero Report Data Extract using SSIS Property Grid (For Older Version)" width="936" height="321" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/configure-json-source-xero-api-extract.png 936w, https://zappysys.com/blog/wp-content/uploads/2017/07/configure-json-source-xero-api-extract-300x103.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/configure-json-source-xero-api-extract-768x263.png 768w" sizes="(max-width: 936px) 100vw, 936px" /></a><p id="caption-attachment-8040" class="wp-caption-text">Configure Xero Report Data Extract using SSIS Property Grid (For Older Version)</p></div>
<p><strong>For New Version Use UI (It has Specify Columns Manually Option)</strong></p>
<div id="attachment_8038" style="width: 915px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-static-columns.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8038" class="size-full wp-image-8038" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-static-columns.png" alt="Read from Xero Report API using parameters in JSON Source in SSIS (Static Columns Example)" width="905" height="532" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-static-columns.png 905w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-static-columns-300x176.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-read-report-api-static-columns-768x451.png 768w" sizes="(max-width: 905px) 100vw, 905px" /></a><p id="caption-attachment-8038" class="wp-caption-text">Read from Xero Report API using parameters in JSON Source in SSIS (Static Columns Example)</p></div>
<p>&nbsp;</p>
<h2>Common Errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2><span id="ConclusionWhat8217s_next">Conclusion. What’s next?</span></h2>
<p>In this article we have learned how to load data from Xero to SQL Server using SSIS ( drag and drop approach without coding). We used <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS JSON / REST API Connector</a> to extract data from Xero REST API using OAuth. JSON Source makes it super simple to parsing complex / large JSON Files or any Web API Response into rows and column so you can load into database like SQL Server. <a href="//zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try many other automation scenarios not discussed in this article.</p>
<p><strong>Keywords:</strong></p>
<p>Xero Integration with SQL Server | How to extract data from Xero in SSIS? | How to read data from Xero API? | Loading Xero Data into SQL Server. | Xero to SQL Server | SQL Server to Xero | SSIS Xero Integration</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/">How to read/load data in Xero using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read / write data in Google BigQuery using SSIS</title>
		<link>https://zappysys.com/blog/get-data-google-bigquery-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sun, 16 Jul 2017 01:10:44 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[Google BigQuery]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis web api destination]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1563</guid>

					<description><![CDATA[<p>Introduction Google BigQuery is a fully managed Big Data platform to run queries against large scale data. In this article you will learn how to integrate Google BigQuery data into Microsoft SQL Server using SSIS. We will leverage highly flexible JSON based REST API Connector and OAuth Connection to import / export data from Google [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/">How to read / write data in Google BigQuery using SSIS</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-bigquery-connector/">API Connector for BigQuery Online</a> which makes it much simpler to <strong>Read/Write BigQuery Data in SSIS</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).</p>
</div></div>
<p style="text-align: left;"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1959" src="//zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1-150x150.png" alt="Google BigQuery API Integration" width="91" height="91" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1.png 257w" sizes="(max-width: 91px) 100vw, 91px" /></a><a href="https://cloud.google.com/bigquery/" target="_blank" rel="noopener">Google BigQuery</a> is a fully managed <strong>Big Data platform</strong> to run queries against large scale data. In this article you will learn how to integrate <strong>Google BigQuery</strong> data into <strong>Microsoft SQL Server</strong> using <strong>SSIS</strong>. We will leverage highly flexible <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">JSON based REST API Connector</a> and <strong>OAuth Connection</strong> to import / export data from <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/" target="_blank" rel="noopener">Google BigQuery API</a> just in a few clicks.</p>
<p style="text-align: left;">If you are looking for a similar product inside Amazon AWS Cloud then <a href="https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/" target="_blank" rel="noopener">check an article about Amazon Athena</a>.</p>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we look into a Step-By-Step section to extract and load data from BigQuery to SQL Server let&#8217;s make sure you meet the following requirements:</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<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><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>ZappySys SSIS PowerPack</em> installed</a>. Click on the link to download a FREE trial.</li>
<li>You have basic familiarity with REST API concepts and Google BigQuery API. This post uses <a href="https://cloud.google.com/bigquery/public-data/" target="_blank" rel="noopener">free Public Dataset</a> to query BigQuery table so <em>no billing</em> is required to get your hands dirty 🙂 However, if you like to query your own dataset then make sure you have at least one BigQuery dataset and one table with some sample data created (this part <em>does require</em> billing enabled). Read a <a href="https://cloud.google.com/bigquery/quickstart-web-ui" target="_blank" rel="noopener">Google Quickstart article</a> for more information on how to create a new BigQuery dataset and a table.</li>
</ol>
<h2>Understanding Google BigQuery Object Heirarchy</h2>
<p>Google BigQuery has 3 main concepts below.</p>
<ul style="list-style-type: circle;">
<li>Project
<ul style="list-style-type: circle;">
<li>Dataset
<ul style="list-style-type: circle;">
<li>Table
<ul style="list-style-type: circle;">
<li>Query requests (each query creates a unique JobID &#8211; valid for 24 hours from which you can read data)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>So in order to create BigQuery table you always need Project and then Dataset under that project. You can group objects around Project / Datasets. When you query you can supply fully qualified name of your table in FROM clause (e.g. <pre class="crayon-plain-tag">select count(*) from `bigquery-public-data.usa_names.usa_1910_2013`</pre>  Here <strong>bigquery-public-data</strong> is project name, <strong>usa_names</strong> is dataset and <strong>usa_1910_2013</strong>  is table). So lets get started with Read operation first and then we will cover write operation. For Read operation we will use public dataset so we can quickly show you demo without too many steps but later we will cover how to automate create / delete of Dataset / Tables using API calls.</p>
<p>So let&#8217;s get started.</p>
<h2>Read data from Google BigQuery using SSIS</h2>
<p>Basically you can query Google BigQuery data in two ways: In this article we will not cover 2nd method.</p>
<ul>
<li><strong>Method-1</strong>: Query data using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method in BigQuery API</a>. Use it if you expect to get a result in a fairly short amount of time. This API method generates a temp table which gets deleted after 24 hours. You can read data within that time frame using newly created <em>JobId</em> reference.<br />
<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>NOTE:</strong> If you have records that sum up to more than 10MB of data or ~10,000 rows (assuming 1 row uses 1KB of data) then you need to proceed with two-step process as explained below.</div></div></li>
<li><strong>Method-2</strong>: Export SQL query result using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert" target="_blank" rel="noopener"><em>jobs/insert</em> method in BigQuery API</a>. Use this method if you expect a query to take a long time to finish.</li>
</ul>
<p>Now let&#8217;s see how to query Google BigQuery data using SSIS 🙂</p>
<h3>Create Google API Project and Register OAuth App</h3>
<p>To use any <a href="https://developers.google.com/apis-explorer/#p/" target="_blank" rel="noopener">Google API</a> firstly you have to finish two tasks:</p>
<ol>
<li><a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Create Google API Project</a> and obtain projectId (see next section).</li>
<li><a href="https://console.cloud.google.com/apis/library/bigquery.googleapis.com" target="_blank" rel="noopener">Enable BigQuery API</a></li>
<li>Register your own Google OAuth App and obtain <strong>ClientId</strong> and <strong>Client Secret</strong>.</li>
</ol>
<p>Check step-by-step instructions on <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">how to create Google API Project and create OAuth App for Google</a>. During instructions make sure you enable BigQuery API (screenshots may differ).</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: For BigQuery API you must use custom app option on OAuth connection. Google used to allow Default App but recent policy changes requires BigQuery to use Custom App to obtain your own ClientId and Client Secret (Some old Screenshots may use Default App for time being so please adjust your settings to use Custom App)</div></div>
<h3>Get Google API Project ID</h3>
<p>Once you have Google API Project created you can grab <a href="https://console.cloud.google.com/project?_ga=1.106484547.1991223081.1500069328">Project ID</a> (see screenshot below). You will need Project ID in the next step when building API URL.</p>
<div id="attachment_1567" style="width: 583px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1567" class="size-full wp-image-1567" src="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png" alt="How to find Google API Project ID" width="573" height="379" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png 573w, https://zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id-300x198.png 300w" sizes="(max-width: 573px) 100vw, 573px" /></a><p id="caption-attachment-1567" class="wp-caption-text">How to find Google API Project ID?</p></div>
<h3>Configure OAuth Connection for Google BigQuery API</h3>
<p>In order to call most of Google APIs you will need an OAuth App. If you want to use your own app then refer to <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">how to register Google OAuth Application (Get ClientID and ClientSecret)</a> article. For simplicity we will use <em>Default OAuth App</em>:</p>
<ol style="margin-left: 0;">
<li>Right click inside Connection Managers area and click &#8220;New Connection&#8230;&#8221;</li>
<li>From the connection type list select &#8220;ZS-OAUTH&#8221; connection type.
<div id="attachment_1569" style="width: 687px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1569" class="size-full wp-image-1569" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png" alt="Create new SSIS OAuth API Connection Manager" width="677" height="220" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection-300x97.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-1569" class="wp-caption-text">Create new SSIS OAuth API Connection Manager</p></div></li>
<li>For OAuth Provider select &#8220;Google&#8221;.</li>
<li>For OAuth App type options leave &#8220;Use Default OAuth App&#8221; selected. If you <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">created custom OAuth App</a> then you would need to select &#8220;Use Custom OAuth App&#8221; option.</li>
<li>For Scopes enter or select the following URLs (URL is just a permission name). Each URL must be in a separate line. For demo purposes we use only the first 3 scopes but we included a few more in case you like to test API in depth with a different permission set:<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/cloud-platform.read-only
https://www.googleapis.com/auth/bigquery.insertdata
https://www.googleapis.com/auth/devstorage.full_control
https://www.googleapis.com/auth/devstorage.read_only
https://www.googleapis.com/auth/devstorage.read_write</pre>
</li>
<li>Click Generate Token. Login using correct account if needed and then you will be prompted to click &#8220;Approve&#8221; OAuth App.</li>
<li>Once you click OK on the login screen you will see new tokens populated on the connection screen.</li>
<li>Click Test to make sure connection / tokens are valid and then click OK to save the connection.<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> Below screenshot uses Default App but we recommend you to to use Custom OAuth App (Your own Clientid / secret &#8211; Obtained in previous section)</div></div>
<div id="attachment_1568" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1568" class="size-full wp-image-1568" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png" alt="Create SSIS OAuth API Connection for Google BigQuery API" width="675" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection-300x291.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1568" class="wp-caption-text">Create SSIS OAuth API Connection for Google BigQuery API</p></div></li>
</ol>
<h3>Start BigQuery Job and get JobId (Submit Query)</h3>
<p>Once you have SSIS OAuth connection created for BigQuery API it&#8217;s time to read data from BigQuery. So, basically, there are two ways you can read BigQuery data: using <em>query </em>or <em>insert </em>method. For demo purposes we will use <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method</a>. If you want fire complex queries which can run for many minutes then refer to <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert" target="_blank" rel="noopener"><em>jobs/insert</em> method</a>.</p>
<p>If you are expecting more than 10MB of data (~10K records) then you have to split data extract in two steps:</p>
<ol>
<li>Step-1 : Call <em>jobs/query</em> method using REST API Task to submit SQL query. This steps returns <strong>jobComplete: true</strong> if supplied query execution is done within timeoutMs parameter you included. By default its 10 seconds so if your query is going to take longer than 10 seconds then its good idea to add bigger timeout that way you dont need <strong>step#2</strong>. Once API call is done you will Get JobId in the response. Save that JobId in a variable for later use. This job result is valid for 24-hours only.</li>
<li>Step-2 <strong>(Optional)</strong> &#8211; You can add another optional <strong>REST API Task</strong> after previous step to Wait until Job is completed. For simplicity, this article will Omit setting up Status Check but its very simple&#8230;.Use below settings
<ol>
<li>Drag new REST API Task from toolbox. Connect it to Step-1 and double click to configure as below.</li>
<li>Select URL From Connection mode,</li>
<li>Select OAuth connection</li>
<li>Enter URL as <strong>https://www.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/jobs/{{User::JobId}}</strong> , Method: <strong>GET</strong></li>
<li>On Response Settings Tab, Select Response Content Type <strong>JSON</strong> and for content filter enter <strong>$.status.state</strong></li>
<li>On Status Check Tab, check Enable Status Check Loop and enter <strong>DONE</strong> in SuccessValue field</li>
<li>Doing this setup will make sure we do not query data until Job Status is DONE (System keeps checking every 5 seconds)</li>
</ol>
</li>
<li>Step-2 : Read Job result using JSON Source in a Data Flow Task.</li>
</ol>
<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>NOTE</strong> : If you are expecting less than ~10K rows then you can skip this step and just go to the next section &#8211; <a href="#Read_BigQuery_SQL_result_Method1_or_Method2">Read BigQuery SQL result (Method#1 or Method#2)</a>.</div></div>
<p>Now lets see how to configure REST API Task to submit query and extract JobId (which will be used in next section).</p>
<ol style="margin-left: 0;">
<li>In the Control Flow designer drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS REST API Task</a> from the SSIS toolbox.</li>
<li>Double click the task to configure it.</li>
<li>Change Request URL Access Mode to [Url from connection].</li>
<li>From the connection dropdown select OAuth connection created in the previous section.</li>
<li>Enter URL as below (replace YOUR-PROJECT-ID with a valid Project ID obtained in the previous section):<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-PROJECT-ID/queries</pre>
</li>
<li>Select Method as POST.</li>
<li>Enter Body (Request Data) as below (change your query if needed; we used Public dataset for the demo): If you do not specify timeout then default is 10 seconds only. Also in this call we only care about JobID from response so we just added maxResults=10 because in 2nd step we will get all rows by doing pagination.<br />
<pre class="crayon-plain-tag">{
   "timeoutMs": 100000, 
   "maxResults": 10, 
   "query": "SELECT title id,language,wp_namespace,reversion_id ,comment ,num_characters FROM [bigquery-public-data:samples.wikipedia] LIMIT 100000"
}</pre>
To use a <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/" target="_blank" rel="noopener">Standard SQL</a> query instead of <a href="https://cloud.google.com/bigquery/docs/reference/legacy-sql" target="_blank" rel="noopener">Legacy SQL</a>, add <strong>useLegacySql</strong> property and set it to <strong>false</strong>:<br />
<pre class="crayon-plain-tag">{
   "timeoutMs": 100000, 
   "maxResults": 10, 
   "query": "SELECT title id,language,wp_namespace,reversion_id ,comment ,num_characters FROM [bigquery-public-data:samples.wikipedia] LIMIT 100000",
   "useLegacySql": false
}</pre>
For all possible parameters refer to <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method documentation</a>.</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;"><strong>NOTE:</strong> You can also supply location Parameter in the Body JSON to indicate where job should run. For non EU / US datacenters we suggest you to supply this parameter. See details at <a href="https://cloud.google.com/bigquery/docs/locations#specifying_your_location" target="_blank" rel="noopener">https://cloud.google.com/bigquery/docs/locations#specifying_your_location</a>.<br />
Example Use Of Location<br />
<pre class="crayon-plain-tag">{ &quot;location&quot;:&quot;us-east1&quot;,&nbsp; &quot;maxResults&quot;: 10, &quot;query&quot;: &quot;SELECT title FROM [bigquery-public-data:samples.wikipedia] LIMIT 10&quot; }</pre>
</div></div></li>
<li>Select Body Content Type as <strong>application/json</strong>.</li>
<li>Click Test Request/Response. If things go well you will see JSON content. Then just <strong>copy JobId from the response</strong> and save for later use:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2213" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png" alt="" width="677" height="488" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid-300x216.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a></li>
<li>Now go to Response Settings tab.</li>
<li>Select ContentType=Json.</li>
<li>Enter below expression to extract JobId from the response. You will need this Id to read SQL query output (this JobId is valid for 24 hrs):<br />
<pre class="crayon-plain-tag">$.jobReference.jobId</pre>
</li>
<li>Choose save response content to save to a variable. Select &lt;New Variable&#8230;&gt; option. When prompted give a name to your variable (i.e. vJobId) and for the value field paste JobId copied from the above step:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2214" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png" alt="" width="625" height="531" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png 625w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable-300x255.png 300w" sizes="(max-width: 625px) 100vw, 625px" /></a><br />
<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>NOTE</strong>: This JobId expires after 24-hrs so while you are designing a package and not running it then design time value is used for testing/previewing. So make sure your JobId is valid. If needed click Test Request/Response to grab a new JobId and update the variable with a new value so you can preview data without running a full package.</div></div></li>
<li>Click OK to save the UI.</li>
</ol>
<h3>Read BigQuery SQL result (for specified JobID)</h3>
<p>Now let&#8217;s look at how to read data from BigQuery</p>
<p>Configure Google BigQuery Web Request (URL, Method, ContentType, Body etc.)</p>
<ol>
<li>In the Control Flow designer drag and drop Data Flow Task from SSIS toolbox.<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Double click Data Flow Task and drag and drop <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source (For API/File)</a> from SSIS toolbox.<br />
<img decoding="async" class="figureimage" title="SSIS JSON Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="SSIS JSON Source - Drag and Drop" /></li>
<li>Double click JSON Source to edit and configure as below</li>
<li>Enter URL as below. Replace <strong>YOUR-API-PROJECT-ID</strong> with the API Project ID obtained in the <a href="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png" target="_blank" rel="noopener">previous section</a>.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-API-PROJECT-ID/queries/{{User::vJobId}}?maxResults=10000</pre>
&#8211;OR&#8211; (Use below if your Job ran <strong>outside US / EU data center</strong>)<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-API-PROJECT-ID/queries/{{User::vJobId}}?location=YOUR_REGION_ID&amp;maxResults=10000</pre>
<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> location Parameter indicates the geographic location of the job. This is <span style="text-decoration: underline;"><strong>Required parameter except for US and EU</strong></span>. See details at <a href="https://cloud.google.com/bigquery/docs/locations#specifying_your_location">https://cloud.google.com/bigquery/docs/locations#specifying_your_location</a>. You can supply same location parameter for first step when you <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener">submit the query</a></p>
<p>Failure to supply location parameter for non US /EU users may result in <strong>404 NotFound Error</strong>.<br />
</div></div></li>
<li>Check <strong>Use Credentials</strong> option and select <strong>OAuth Connection Manager</strong> created in the previous section.</li>
<li>For HTTP Request Method select <strong>GET</strong>.<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png"><img loading="lazy" decoding="async" class="size-full wp-image-2215" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png" alt="Read data from Google BigQuery from Temp Job result" width="1004" height="661" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png 1004w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source-300x198.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source-768x506.png 768w" sizes="(max-width: 1004px) 100vw, 1004px" /></a></li>
</ol>
<p>Read data from Google BigQuery from Temp Job result</p>
<h4>Configure Filter</h4>
<p>We need to transform a single JSON response into multiple rows so we need to apply a correct filter.</p>
<ol>
<li>On JSON Source go to Filter Options tab.</li>
<li>In the Filter field enter<strong> $.rows[*]</strong> or click [Select Filter] button to browse hierarchy you want to extract.</li>
</ol>
<div id="attachment_1573" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1573" class="wp-image-1573 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png" alt="Select Filter for JSON Response" width="675" height="363" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter-300x161.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1573" class="wp-caption-text">Select Filter for JSON Response</p></div>
<h4>Configure BigQuery API Pagination Settings</h4>
<p>Most of modern APIs usually implement some sort of pagination technique so you get a part of data in each request rather than all in one go. Thus if you want more you can paginate through pages until the last page is reached. You can also read <a href="//zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">Understanding REST API Pagination in SSIS</a> article to learn more about pagination in SSIS.</p>
<p>BigQuery API returns <em>pageToken</em> attribute in response JSON if more data is found for requested query result. You can then pass <em>pageToken</em> in the next URL in this format: <strong>http://my-api-url/?pageToken=xxxxxxxxxx</strong></p>
<p>Now lets configure JSON Source to automate this pagination for us. On JSON Source go to Pagination Tab and enter the following two settings:</p>
<ol>
<li>Set Next Link as <strong>$.pageToken</strong>.</li>
<li>Set Suffix for Next URL as <strong>&amp;pageToken=&lt;%nextlink%&gt;</strong>.</li>
</ol>
<p>See the screenshot below to get more clarity:</p>
<div id="attachment_1572" style="width: 815px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1572" class="size-full wp-image-1572" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png" alt="Configure BigQuery API Pagination on SSIS JSON Source" width="805" height="576" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png 805w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings-300x215.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings-768x550.png 768w" sizes="(max-width: 805px) 100vw, 805px" /></a><p id="caption-attachment-1572" class="wp-caption-text">Configure BigQuery API Pagination on SSIS JSON Source</p></div>
<h4>Configure Array Transformation</h4>
<p>Now the last thing we have to configure is special 2-dimensional JSON array format used by BigQuery API:</p>
<ol>
<li>On the JSON Source UI go to 2D Array Transformation tab.</li>
<li>Enter the following settings:
<ol>
<li>For Transformation Type select <strong>Transform complex 2-dimensional array</strong>.</li>
<li>For Column Name filter enter <strong>$.schema.fields[*].name</strong>.</li>
<li>For Row Values Filter enter <strong>$.f[*].v</strong>.</li>
</ol>
</li>
</ol>
<div id="attachment_1575" style="width: 819px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1575" class="size-full wp-image-1575" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png" alt="JSON Array Transformation Options" width="809" height="317" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png 809w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery-300x118.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery-768x301.png 768w" sizes="(max-width: 809px) 100vw, 809px" /></a><p id="caption-attachment-1575" class="wp-caption-text">JSON Array Transformation Options</p></div>
<h4>Preview Data and Save UI</h4>
<p>That&#8217;s it click Preview to see some data. If you entered sample JobID for your User::vJobID variable then you will see some data. In the next section we will see how to load Google BigQuery data into SQL Server. You can click Columns Tab to review Metadata.</p>
<p>Click OK to save UI and generate Metadata.</p>
<p>&nbsp;</p>
<h3>Configure Target &#8211; Load Google BigQuery data into SQL Server</h3>
<p>Now you can connect your JSON Source to any target such as ZS Trash Destination or a real database destination such as OLEDB Destination.</p>
<p>If you wish to dump data from Google BigQuery to a SQL Server table then just perform the following steps:</p>
<ol>
<li>Drag and drop OLEDB Destination from SSIS Toolbox. Rename it to something like SQL Server Table.</li>
<li>Double click on OLEDB Destination.</li>
<li>Click New to create a new connection &gt; Configure connection &gt; Click OK.</li>
<li>Click on New to create a new table &gt; Rename default table name &gt; Click OK.</li>
<li>Click on Mappings tab and click OK to save UI with default mappings.</li>
</ol>
<div id="attachment_1580" style="width: 918px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1580" class="size-full wp-image-1580" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png" alt="Configure SSIS OLEDB Destination - Google BigQuery to SQL Server Import" width="908" height="558" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png 908w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector-300x184.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector-768x472.png 768w" sizes="(max-width: 908px) 100vw, 908px" /></a><p id="caption-attachment-1580" class="wp-caption-text">Configure SSIS OLEDB Destination &#8211; Google BigQuery to SQL Server Import</p></div>
<h3>Execute Package &#8211; Loading BigQuery data into SQL Server</h3>
<div id="attachment_1578" style="width: 596px" class="wp-caption alignnone"><a href="//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="//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>
<h2>Create / Delete Google BigQuery Dataset using API call</h2>
<p>As we mentioned before, you need dataset before you can create a table. Most common way to create dataset is via User Interface but what if you like to automate from your SSIS Package or other workflow? Here is how you can create or delete. Basically you can use REST API Task to send CREATE or DROP command for Dataset object</p>
<h3><strong>Create Google Dataset</strong></h3>
<p>To create dataset configure REST API Task using below settings (We will <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/insert" target="_blank" rel="noopener">call this API</a>)</p>
<ol>
<li>Drag REST API Task from toolbox<br />
<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Select URL from Connection mode and select connection as <strong>OAuth connection</strong> (Created in previous section)</li>
<li>Enter below URL (assuming you stored your ProjectID in a variable called ProjectId<br />
<pre class="crayon-plain-tag">https://bigquery.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/datasets</pre>
</li>
<li>Request Method as <strong>POST</strong></li>
<li>Enter Request Body as below (change YOUR_DATASET_NAME &#8211; e.g. TestDataset )<br />
<pre class="crayon-plain-tag">{"datasetReference": { "datasetId": "YOUR_DATASET_NAME", "projectId": "{{User::ProjectId}}"} }</pre>
</li>
<li>Select Request Content Type as <strong>application/json</strong> from the dropdown</li>
<li>(Optional) &#8211; If you want to implement Continue if Dataset already exists then you can go to Error Handling Tab (See next section for screenshot) and check <strong>Continue On Error Code</strong> option and set <strong>409 status code</strong></li>
<li>That&#8217;s it. Click Test Request/Response see it works.</li>
</ol>
<h3>Delete Google BigQuery Dataset</h3>
<p>For deleing dataset you have to choose same steps as above except two things</p>
<ol>
<li>Request Method as <strong>DELETE</strong></li>
<li>Request Body as blank</li>
</ol>
<h2>Create / Delete Google BigQuery Table using API call</h2>
<p>Now let&#8217;s look at how to create /drop Table in Google BigQuery using API calls.</p>
<h3>Create Google BigQuery Table</h3>
<p>To send <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#:~:text=%20%20%201%20Open%20the%20BigQuery%20web,table%20appears%20in%20the%20resources%20pane.%20More%20" target="_blank" rel="noopener">CREATE TABLE  SQL statement (DDL)</a> we have to use same approach as we send normal SQL Query <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener">using this API call</a>. So notice we used Standard SQL for this call by supplying  <strong>useLegacySql: false</strong> . DDL Statement must be all in one line</p><pre class="crayon-plain-tag">POST https://www.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/queries

Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
 "query": "CREATE TABLE TestDataset.Table1 (RecordID INT64,CustomerID STRING,CustomerName STRING);",
 "useLegacySql": false,
 "timeoutMs": 100000 
}</pre><p>
To create dataset configure REST API Task using below settings</p>
<ol>
<li>Drag REST API Task from toolbox<br />
<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Select URL from Connection mode and select connection as <strong>OAuth connection</strong> (Created in previous section)</li>
<li>Enter below URL (assuming you stored your ProjectID in a variable called ProjectId<br />
<pre class="crayon-plain-tag">https://bigquery.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/queries</pre>
</li>
<li>Request Method as <strong>POST</strong></li>
<li>Enter Request Body as below<br />
<pre class="crayon-plain-tag">{
 "query": "CREATE TABLE TestDataset.Table1 (RecordID INT64,CustomerID STRING,CustomerName STRING);",
 "useLegacySql": false,
 "timeoutMs": 100000
}</pre>
</li>
<li>Select Request Content Type as <strong>application/json</strong> from the dropdown</li>
<li>(Optional) &#8211; If you want to implement Continue if Table exists then you can go to enable Error Handling Tab and check <strong>Continue On Error Code</strong> option and set <strong>409 status code</strong></li>
<li>That&#8217;s it. Click Test Request/Response see it works.</li>
</ol>
<div id="attachment_8986" style="width: 1008px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8986" class="size-full wp-image-8986" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png" alt="Create Google BigQuery Table - API Call (Continue On Error Setting - Skip CREATE if Table / Dataset Already Exists)" width="998" height="692" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png 998w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists-300x208.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists-768x533.png 768w" sizes="(max-width: 998px) 100vw, 998px" /></a><p id="caption-attachment-8986" class="wp-caption-text">Create Google BigQuery Table &#8211; API Call (Continue On Error Setting &#8211; Skip CREATE if Table / Dataset Already Exists)</p></div>
<h3>Delete Google BigQuery Table</h3>
<p>For deleing table you have to choose same steps as above except two things</p>
<ol>
<li>Request Method as <strong>DELETE</strong></li>
<li>Request Body as blank</li>
</ol>
<h2>Write data to Google BigQuery using SSIS &#8211; 1 Million row insert test (FAST)</h2>
<p>Now let&#8217;s look at how easy it is to import data into Google BigQuery using SSIS. We will use the same OAuth connection we created before. To learn more about inserting data into BigQuery check <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll"><i>tabledata/insertAll </i>method documentation</a>.</p>
<h3>Make sure billing is enabled</h3>
<p>Make sure that billing is enabled for your Google Cloud project. <a href="https://cloud.google.com/billing/docs/how-to/modify-project" target="_blank" rel="noopener">Learn how to confirm billing is enabled for your project</a>.</p>
<p>Streaming is not available via the <a href="https://cloud.google.com/bigquery/pricing#free-tier">free tier</a>. If you attempt to use streaming without enabling billing, you receive the following error: <code translate="no" dir="ltr">BigQuery: Streaming insert is not allowed in the free tier.</code></p>
<p>As long as your API calls fall under Free Tier  limit you wont be charged but you still need to enable billing if you wish to call Streaming insertAll API call (Write  demo).</p>
<h3>Configure OAuth Connection / Permissions</h3>
<p>If you want to perform data insert operation in BigQuery using API calls then include the following scopes in your OAuth Connection Manager and generate a token (see our first section of this article &#8211; We already included scopes for Write operation but incase you didnt do then regenerate token with below scopes):</p><pre class="crayon-plain-tag">https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/bigquery.insertdata</pre><p>
<h3>Create BigQuery Dataset (From UI)</h3>
<p>For this demo first create a test dataset and one table under it like shown below (<em>billing must be enabled on your Google API Project</em>). To do that go to <a href="https://bigquery.cloud.google.com/welcome" target="_blank" rel="noopener">https://bigquery.cloud.google.com/welcome</a> and configure them:</p>
<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>NOTE:</strong> BigQuery now provides a <a href="https://cloud.google.com/bigquery/docs/sandbox">sandbox</a> if you do not want to provide a credit card or enable billing for your project. The steps in this topic work for a project whether or not your project has billing enabled. If you optionally want to enable billing, see <a href="https://cloud.google.com/billing/docs/how-to/modify-project" target="_blank" rel="noopener">Learn how to enable billing</a>. There are some restriction on Sandbox mode (Write API calls will fail &#8211; Check Common Errors section later this article)</div></div>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png"><img loading="lazy" decoding="async" class="size-full wp-image-2354" src="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png" alt="Create sample dataset and table for Google BigQuery Load" width="715" height="599" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png 715w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination-300x251.png 300w" sizes="(max-width: 715px) 100vw, 715px" /></a></p>
<h3>Insert data into BigQuery using API call</h3>
<p>And here is a REST API example to insert data into a BigQuery Table:</p>
<p><strong>Request URL:</strong></p><pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/MY_PROJECT_ID/datasets/MY_DATASET_ID/tables/MY_TABLE_ID/insertAll</pre><p>
<strong>Request Headers:</strong></p><pre class="crayon-plain-tag">Authorization: Bearer ya29.Gl0cBxxxxxxxxxxxxxxxxxxuEIhJIEnxE6GsQPHI
Content-Type: application/json</pre><p>
<strong>Request Body:</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RowId": 1,"CustomerName": "AAA"} }, 
     {"json": {"RowId": 2,"CustomerName": "BBB"} }
   ]
}</pre><p>
<h3></h3>
<p>Here is our data flow setup to achive very high throughput for Google BigQuery Data Load. We will show you how to insert one million rows in Google BigQuery in less than a minute based on below setup. We will use Multi Threading option and New Compression Option (Added in v3.1.4)</p>
<ol>
<li>Dummy Data Source &#8211; Generate sample records</li>
<li>JSON Generator Transform &#8211; Generates JSON documents to send as POST request for above /insertAll API call.</li>
<li>Web API destination  &#8211; Call /insertAll API call to submit our data to BigQuery</li>
<li><strong>(Optional)</strong> JSON Parser Transform &#8211; Parse Error Message for any response</li>
<li><strong>(Optional)</strong> Trash Destination &#8211; Save any errors to text file for review</li>
</ol>
<div id="attachment_8973" style="width: 910px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8973" class="size-full wp-image-8973" src="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png" alt="Google BigQuery Data Load Demo in SSIS - 1 Million Rows Insert with Multi Threads and Compression ON (Fast Upload)" width="900" height="724" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png 900w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on-300x241.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on-768x618.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></a><p id="caption-attachment-8973" class="wp-caption-text">Google BigQuery Data Load Demo in SSIS &#8211; 1 Million Rows Insert with Multi Threads and Compression ON (Fast Upload)</p></div>
<p>&nbsp;</p>
<h3>Configure SSIS JSON Generator &#8211; Generate JSON for BigQuery Table Insert</h3>
<p>Now let&#8217;s see how to build an HTTP request with JSON body and send it to BigQuery:</p>
<ol style="margin-left: 0;">
<li>Drag Data Flow Task and double click on it.<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Drag and configure your Source (for this demo we use Dummy Data Source with Customer Template). See previous section for configuration of Dummy Data Source.<br />
<img decoding="async" class="figureimage" title="SSIS DummyData Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/dummy-data-Source/ssis-dummy-data-source-adapter-drag.png" alt="SSIS DummyData Source - Drag and Drop" /></li>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">ZS JSON Generator Transform</a> to produce JSON from a database or file records. If your source is already sending a valid JSON then you can skip this step (e.g. SQL query is<br />
returning JSON). You can also read raw JSON from a very large file (new-line separated JSON) using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source with Output as Raw Data</a> option checked.<img decoding="async" class="figureimage" title="SSIS JSON Generator - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-generator-transform/ssis-json-generator-transform-drag-2.png" alt="SSIS JSON Generator - Drag and Drop" /></li>
<li>Connect Source to JSON Generator. Double click JSON Generator Transform to start configuring it like below.</li>
<li>Select Output Mode as <strong>Single Dataset Array</strong> and enter Batch Size <strong>10000</strong> (This is Max limit allowed by Google BigQuery API <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll" target="_blank" rel="noopener">insertAll</a>)</li>
<li>First <strong>right click</strong> on Mappings node and select <strong>Add Static Element</strong>
<div id="attachment_8975" style="width: 862px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8975" class="size-full wp-image-8975" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png" alt="Generate JSON for Google BigQuery InsertAll API request - Batch 10000 rows in a single API call" width="852" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png 852w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate-300x138.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate-768x352.png 768w" sizes="(max-width: 852px) 100vw, 852px" /></a><p id="caption-attachment-8975" class="wp-caption-text">Generate JSON for Google BigQuery InsertAll API request &#8211; Batch 10000 rows in a single API call</p></div></li>
<li>Enter Name as <strong>kind</strong> and value as <strong><strong>bigquery#tableDataInsertAllRequest<br />
</strong></strong></p>
<div id="attachment_8976" style="width: 538px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8976" class="size-full wp-image-8976" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png" alt="JSON Generator - Add Static Element" width="528" height="373" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png 528w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value-300x212.png 300w" sizes="(max-width: 528px) 100vw, 528px" /></a><p id="caption-attachment-8976" class="wp-caption-text">JSON Generator &#8211; Add Static Element</p></div></li>
<li>Now right click on Mappings node and select <strong>Add Document Array</strong> option
<div id="attachment_8978" style="width: 464px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8978" class="wp-image-8978 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png" alt="JSON Generator - Add Document Array" width="454" height="349" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png 454w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option-300x231.png 300w" sizes="(max-width: 454px) 100vw, 454px" /></a><p id="caption-attachment-8978" class="wp-caption-text">JSON Generator &#8211; Add Document Array</p></div></li>
<li>Enter <strong>rows</strong> as array title and click OK
<div id="attachment_8979" style="width: 470px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8979" class="size-full wp-image-8979" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png" alt="JSON Generator - Name array" width="460" height="313" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png 460w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-300x204.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a><p id="caption-attachment-8979" class="wp-caption-text">JSON Generator &#8211; Name array</p></div></li>
<li>Select newly added array node and right click &gt; Add <strong>unbound nested element</strong>  enter Output alias as <strong>json </strong>and click OK.
<div id="attachment_8980" style="width: 475px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8980" class="size-full wp-image-8980" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png" alt="JSON Generator - Add unbound nested element" width="465" height="471" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png 465w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element-296x300.png 296w" sizes="(max-width: 465px) 100vw, 465px" /></a><p id="caption-attachment-8980" class="wp-caption-text">JSON Generator &#8211; Add unbound nested element</p></div></li>
<li>Select <strong>json</strong> node and right click &gt; Select <strong>Add Elements below</strong> this node and select multiple columns you like to send to BigQuery. Click OK to save.
<div id="attachment_8981" style="width: 467px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8981" class="size-full wp-image-8981" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png" alt="JSON Generator - Add Multiple Elements" width="457" height="529" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png 457w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements-259x300.png 259w" sizes="(max-width: 457px) 100vw, 457px" /></a><p id="caption-attachment-8981" class="wp-caption-text">JSON Generator &#8211; Add Multiple Elements</p></div></li>
<li>Now let&#8217;s preview our JSON (Copy preview JSON to try in the next step &#8211; Web API destination)<div class="su-note"  style="border-color:#e5da9d;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:#fff4b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: Table name and column names are case-sensitive so make sure your JSON attribute matches exact same way. </div></div>Here is the finished JSON Structure for next Step
<div id="attachment_8982" style="width: 857px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8982" class="size-full wp-image-8982" src="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png" alt="Sample JSON Request body for Google BigQuery insertAll API request" width="847" height="671" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png 847w, https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api-300x238.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api-768x608.png 768w" sizes="(max-width: 847px) 100vw, 847px" /></a><p id="caption-attachment-8982" class="wp-caption-text">Sample JSON Request body for Google BigQuery insertAll API request</p></div></li>
<li>Click OK to save UI.</li>
</ol>
<h3>Configure SSIS Web API destination &#8211; Insert data into BigQuery Table</h3>
<p>Once you have Input JSON prepared,  now let&#8217;s configure destination for BigQuery.</p>
<ol style="margin-left: 0;">
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">ZS Web API Destination</a>.</li>
<li>Connect your JSON Generator Transform to Web API destination.</li>
<li>Configure general properties:
<div id="attachment_2349" style="width: 869px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2349" class="size-full wp-image-2349" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png" alt="SSIS Web API Destination - Configure for BigQuery Data load" width="859" height="583" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png 859w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination-300x204.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination-768x521.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></a><p id="caption-attachment-2349" class="wp-caption-text">SSIS Web API Destination &#8211;<br />Configure for BigQuery Data load</p></div></li>
<li>Make sure to enter URL in this format:<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/MY_PROJECT_ID/datasets/MY_DATASET_ID/tables/MY_TABLE_ID/insertAll</pre>
Make sure to replace 3 parts in above URL (MY_PROJECT_ID, MY_DATASET_ID, MY_TABLE_ID) with actual values from your Google Project and BigQuery dataset/table configuration.</li>
<li>Now you can enable Compression and Multiple Threads for higher throughput as below.<br />
<strong>NOTE:</strong> Compression Property was added in v3.1.4 so you may not see it if you have older version.</p>
<div id="attachment_8983" style="width: 1042px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8983" class="size-full wp-image-8983" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png" alt="Google BigQuery Data Loading Performance Optimization Options - Enable Multiple Threads and Compression Options" width="1032" height="347" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png 1032w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-300x101.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-768x258.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-1024x344.png 1024w" sizes="(max-width: 1032px) 100vw, 1032px" /></a><p id="caption-attachment-8983" class="wp-caption-text">Google BigQuery Data Loading Performance Optimization Options &#8211; Enable Multiple Threads and Compression Options</p></div></li>
<li>If you want to try test insert request from UI without running full package then go back to first tab and edit Body (Use Sample JSON generated by previous JSON Transform &#8211; You can grab from JSON Preview Panel on Generator Transform).Click Test Request / Response and confirm Success as below. You can go back to your BigQuery Portal and check one row is inserted after our test click. If everything looking good then run full package to insert all records.Sample JSON for Body:<br />
<pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RowId": 1,"CustomerName": "AAA"} }, 
     {"json": {"RowId": 2,"CustomerName": "BBB"} }
   ]
}</pre>
<div id="attachment_4919" style="width: 910px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4919" class="size-full wp-image-4919" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png" alt="Test Google BigQuery Table Insert - SSIS Web API Destination UI" width="900" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png 900w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api-300x243.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api-768x623.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></a><p id="caption-attachment-4919" class="wp-caption-text">Test Google BigQuery Table Insert &#8211; SSIS Web API Destination UI</p></div></li>
<li>Hit OK to save UI.</li>
<li>Run the package and verify data in Google BigQuery Console:
<div id="attachment_2351" style="width: 1206px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2351" class="size-full wp-image-2351" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png" alt="Loading data into Google BigQuery using SSIS" width="1196" height="625" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png 1196w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-300x157.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-768x401.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-1024x535.png 1024w" sizes="(max-width: 1196px) 100vw, 1196px" /></a><p id="caption-attachment-2351" class="wp-caption-text">Loading data into Google BigQuery using SSIS</p></div></li>
</ol>
<h2></h2>
<h2>Error Handling for BigQuery Data Load (Bulk Insert API Calls)</h2>
<p>There will be a time when some records you insert may not go well in Google BigQuery. In such case you can read output from Web API destination and parse further with JSON Parser Transform. Check for certain values in the output. You must use JSON Parser after Web API destination (Connect <strong>Blue Arrow</strong> from Web API destination &#8211; Since its Soft Error it won&#8217;t redirect in Red Arrow ).</p>
<p>For example here is the sample JSON in POST Body for testing which produces error due to bad column name. When bad row found in batch all records will be rejected. Notice that error returns index of record in batch so you can identify which row went bad. It also returns column name in location attribute.</p>
<p><strong>NOTE: Bad column name in 2nd record</strong></p>
<p><strong>Test Body (Bad):</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RecordID": 1,"CustomerID": "X1"} }, 
     {"json": {"Bad_Column": 2,"CustomerID": "X2"} }
     {"json": {"RecordID": 3,"CustomerID": "X3"} }, 
   ]
}</pre><p>
&nbsp;</p>
<p><strong>Response (For Bad Input):</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllResponse",
  "insertErrors": [
    {
      "index": 1,
      "errors": [
        {
          "reason": "invalid",
          "location": "bad_column",
          "debugInfo": "",
          "message": "no such field."
        }
      ]
    },
    {
      "index": 0,
      "errors": [
        {
          "reason": "stopped",
          "location": "",
          "debugInfo": "",
          "message": ""
        }
      ]
    },
    {
      "index": 2,
      "errors": [
        {
          "reason": "stopped",
          "location": "",
          "debugInfo": "",
          "message": ""
        }
      ]
    }
  ]
}</pre><p>
&nbsp;</p>
<p>To configure error detection perform following steps.</p>
<ol>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">ZS JSON Parser Transform</a> after Web API destination</li>
<li>Click on Web API destination. Connect Blue arrow  to JSON Parser Transform</li>
<li>Configure JSON Parser Transform like below</li>
<li>Connect JSON Parser TRansform to some Destination to save error information (e.g. SQL Table or Trans destination)</li>
</ol>
<div id="attachment_4920" style="width: 1111px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4920" class="size-full wp-image-4920" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png" alt="Handling BigQuery Insert Errors in SSIS " width="1101" height="739" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png 1101w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-300x201.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-768x515.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-1024x687.png 1024w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-272x182.png 272w" sizes="(max-width: 1101px) 100vw, 1101px" /></a><p id="caption-attachment-4920" class="wp-caption-text">Handling BigQuery Insert Errors in SSIS</p></div>
<h2>Other Common Errors in BigQuery API calls</h2>
<p>In this section we will talk about many common API errors in BigQuery.</p>
<h3>Error: The project XXXXXXX has not enabled BigQuery</h3>
<p>Sometimes you might get below error. To fix this error make sure you go to your Project and <a href="https://console.cloud.google.com/apis/library/bigquery.googleapis.com" target="_blank" rel="noopener">Enable BigQuery API</a></p><pre class="crayon-plain-tag">Status Code: BadRequest

Response Body: {
  "error": {
    "code": 400,
    "message": "The project bigquerytest-281915 has not enabled BigQuery.",
    "errors": [
      {
        "message": "The project bigquerytest-281915 has not enabled BigQuery.",
        "domain": "global",
        "reason": "invalid"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}</pre><p>
<h3>Error: 404 &#8211; Not Found: Table / Job xxxxxx</h3>
<ul>
<li>Make sure you are setting GET request and not POST.</li>
<li>Also make sure your jobId is valid because it expires after 24 hours.</li>
<li>Make sure project-id supplied in URL is valid ID  (DO NOT Specify Alias, use internal ID for project)</li>
<li>
<div>Make sure you supplied location parameter if your outside EU / US region. Reading data using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults" target="_blank" rel="noopener">this API call</a> might fail if you failed to supply <strong>location</strong> in URL</div>
</li>
</ul>
</p><pre class="crayon-plain-tag">{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "Not Found: Table xxxxxx"
   }
  ],
  "code": 404,
  "message": "Not Found: Table xxxxxxx
 }
}</pre><p>
&nbsp;</p>
<h3>Error: 403 &#8211; Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier</h3>
<p>If you trying call certain APIs on sandbox mode or free tier then you might get below error. To overcome this error <a href="https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project" target="_blank" rel="noopener">enable billing on google bigquery</a>. As long as your API calls fall under Free Tier  limit you wont be charged but you still need to enable billing if you wish to call Streaming insertAll API call.</p><pre class="crayon-plain-tag">Response Url: https://www.googleapis.com/bigquery/v2/projects/bigquerytest-281915/datasets/TestDataset/tables/Table1/insertAll

Status Code: Forbidden

Response Body: {
  "error": {
    "code": 403,
    "message": "Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier",
    "errors": [
      {
        "message": "Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier",
        "domain": "global",
        "reason": "accessDenied"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}</pre><p>
&nbsp;</p>
<p>&nbsp;</p>
<h2>Debugging Web API Requests</h2>
<p>If you need to debug actual requests made to Google server then you can use a tool like <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a>. It&#8217;s a very handy tool to troubleshoot JSON format issues. It will allow to see how a request is made to a server.</p>
<div id="attachment_2352" style="width: 1076px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2352" class="size-full wp-image-2352" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png" alt="Using Fiddler to debug Google BigQuery API requests in SSIS" width="1066" height="719" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png 1066w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-300x202.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-768x518.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-1024x691.png 1024w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-272x182.png 272w" sizes="(max-width: 1066px) 100vw, 1066px" /></a><p id="caption-attachment-2352" class="wp-caption-text">Using Fiddler to debug Google BigQuery API requests in SSIS</p></div>
<h2>Common Errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2>Download Sample Package</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/Google_BigQuery_API_Read_Write_Create_Delete_Sample_SSIS2019_2017_2012.zip">Click Here to Download SSIS Sample Package &#8211; Google BigQuery API Read Write Create Delete (SSIS 2019, 2017, 2012)</a></p>
<p>&nbsp;</p>
<h2>Conclusion. What&#8217;s next?</h2>
<p>In this article we have learned how to load data from Google BigQuery into SQL Server using SSIS (drag and drop approach without coding). We used <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS JSON / REST API Connector</a> to extract data from Google BigQuery REST API using OAuth. JSON Source Connector makes it super simple to parse complex/large JSON files or any Web API response into rows and columns so you can load data into a database, e.g. SQL Server database. <a href="//zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try many other automation scenarios that were not discussed in this article.</p>
<p><strong>Keywords:</strong></p>
<p>Google BigQuery Integration with SQL Server | How to extract data from google bigquery in SSIS? | How to read data from Google BigQuery API? | Loading BigQuery Data into SQL Server. | BigQuery to SQL Server | SSIS Google Big Query Integration | SSIS Google BigQuery Import  JSON File | SSIS Google BigQuery Export data</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/">How to read / write data in Google BigQuery using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Handling SSIS Component Metadata Issues</title>
		<link>https://zappysys.com/blog/handling-ssis-component-metadata-issues/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 06 Jun 2017 20:01:41 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[metadata]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1219</guid>

					<description><![CDATA[<p>Introduction In this article you will learn how to edit SSIS Component Metadata and handle most common errors related to SSIS PowerPack Components. If you never heard about SSIS PowerPack then it&#8217;s addon pack to get additional 45+  SSIS components and Task (e.g. Connectivity to REST API, JSON, XML, Azure, AWS, Google, Salesforce etc). &#160; [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/handling-ssis-component-metadata-issues/">Handling SSIS Component Metadata Issues</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/2017/06/ssis-error-handling.png"><img loading="lazy" decoding="async" class="alignleft wp-image-2200" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-error-handling.png" alt="" width="100" height="100" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-error-handling.png 180w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-error-handling-150x150.png 150w" sizes="(max-width: 100px) 100vw, 100px" /></a>In this article you will learn how to edit SSIS Component Metadata and handle most common errors related to <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack Components</a>. If you never heard about SSIS PowerPack then it&#8217;s addon pack to get additional 45+  SSIS components and Task (e.g. Connectivity to REST API, JSON, XML, Azure, AWS, Google, Salesforce etc).</p>
<p>&nbsp;</p>
<h2>SSIS Truncation Error (BufferException)</h2>
<p>By default SSIS PowerPack components scan 300 rows to determine most accurate datatypes. However in many case you need to scan lot more rows to determine correct length and datatypes. If you go with default scan option to determine metadata then there is a chance that it may fail with the following error when you run SSIS package.</p><pre class="crayon-plain-tag">[JSON Source [2]] Error: System.Exception: BufferException: Truncation error with column [tickets[0].collaborator_ids] (to fix this error - see full message &gt;&gt; copy/paste this to text editor)
Error: The value is too large to fit in the column data area of the buffer. &gt;&gt; Source: tickets[0].collaborator_ids, Actual Length: 13, Value: [18726645887]
How to fix=&gt; There are two ways to fix this error (see below steps).
&gt;&gt;&gt; Method 1 &lt;&lt;&lt;
- Goto dataflow designer and double click on the component which failed.
- Once component UI is open, go to [Columns] tab and change column length and DataType so data is not truncated. 
- Optionally you can click [Refresh Columns] and select bigger length for all string columns by changing [Metadata Scan Mode] to more wider option (e.g. Guess2x to Guess4x). Check [Overwrite locked columns] option if needed so all columns are refreshed.
- After you change length/datatype you can check [Lock] option so when metadata is refreshed for some reason your changes are preserved. 
&gt;&gt;&gt; Method 2 &lt;&lt;&lt;
- To know which records causing failure you can also redirect error output by dragging red arrow from component to downstream component (When prompted set Truncate Action=Redirect).
- If you simply dont care about such errors then Set Truncation action=Ignore in above step.
. RowNumber=11</pre><p>
<div id="attachment_1220" style="width: 856px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-bufferexception-truncation-error.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1220" class="size-full wp-image-1220" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-bufferexception-truncation-error.png" alt="SSIS Runtime Error - BufferException / Truncation error" width="846" height="271" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-bufferexception-truncation-error.png 846w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-bufferexception-truncation-error-300x96.png 300w" sizes="(max-width: 846px) 100vw, 846px" /></a><p id="caption-attachment-1220" class="wp-caption-text">SSIS Runtime Error &#8211; BufferException / Truncation error</p></div>
<h3>Possible Reasons</h3>
<p>Such error can occur due to following reasons</p>
<ul>
<li>You used default metadata scanning option to detect metadata. Default option scans only 300 rows to guess datatype and length. If you have more than 300 rows then possible to have data which has longer length than found in first 300 rows.</li>
<li>Underlying data is changed after you configured the component so now you have bigger length for one or more string columns</li>
</ul>
<h3>Possible Fix</h3>
<p>To fix truncation related errors you can use any of the following approach.</p>
<h4>Method-1: Change default scan options and re-scan</h4>
<p>Perform following steps to scan records with custom options.</p>
<ul>
<li>Edit component and goto columns tab</li>
<li>On the columns tab change default scan row count to larger number this will cover bigger scan range (Default is 300).</li>
<li>Click [Refresh Columns] button to scan again.</li>
<li>When prompted change Auto mode to Guess4x (i.e. Set length to 4 times bigger than maximum detected length).</li>
<li>Also check Set lock flag so any future scan wont override your changes. If you want to wipeout existing metadata and start again then check [Overwrite metdadata] option too</li>
<li>Click OK to start scanning. Depending on how many scan rows selected it may take several seconds.</li>
<li>Once scan is Done you will see Grid refresh with new column length and datatype</li>
</ul>
<div id="attachment_1223" style="width: 698px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-powerpack-metadata-scan-options.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1223" class="size-full wp-image-1223" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-powerpack-metadata-scan-options.png" alt="SSIS PowerPack - Advanced Metadata Scan Options" width="688" height="361" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-powerpack-metadata-scan-options.png 688w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-powerpack-metadata-scan-options-300x157.png 300w" sizes="(max-width: 688px) 100vw, 688px" /></a><p id="caption-attachment-1223" class="wp-caption-text">SSIS PowerPack &#8211; Advanced Metadata Scan Options</p></div>
<h4>Method-2: Fix metadata for the column(s) which are causing runtime error</h4>
<p>Another approach to fix metadata related errors you get at runtime is only fix those columns which caused the issue. Carefully read the error message to find which column is causing BufferException (sometimes you have to copy full message into notepad to see it).</p>
<p>Once you know the column name which caused the error, you have two options.</p>
<p>1. <strong>Remove that column from output</strong> : Uncheck from Left side list<br />
&#8212; OR &#8212;<br />
2. <strong>Increase column length</strong> : For this you can go to Columns tab as below screenshot and fix the length (Increase by 3-4 times or more if you expect longer string). If you need more than 4000 chars long string then you have to DT_NTEXT ( or DT_TEXT). After fixing column length (or datatype) click OK and run package again. Keep doing this until you fix all errors.</p>
<div id="attachment_1224" style="width: 1011px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-metadata-edit-json-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1224" class="size-full wp-image-1224" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-metadata-edit-json-source.png" alt="SSIS PowerPack - Column Metadata Editor (i.e. Change DataType, Column Length)" width="1001" height="407" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-metadata-edit-json-source.png 1001w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-metadata-edit-json-source-300x122.png 300w" sizes="(max-width: 1001px) 100vw, 1001px" /></a><p id="caption-attachment-1224" class="wp-caption-text">SSIS PowerPack &#8211; Column Metadata Editor (i.e. Change DataType, Column Length)</p></div>
<h4>Method-3: Redirect bad rows to error output OR Ignore bad rows</h4>
<p>If you want to detect records which are causing errors then you can redirect bad rows to error output using following way.</p>
<p><strong>Redirecting bad rows to error output</strong></p>
<p>To know which records causing failure you can redirect error output by dragging red arrow from component to downstream component (When prompted set Error and Truncation options to [Redirect row]).</p>
<div id="attachment_1264" style="width: 538px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-error-handling-redirect-to-error-output.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1264" class="size-full wp-image-1264" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-error-handling-redirect-to-error-output.png" alt="SSIS Component Error Handling - Redirect bad rows to error output (Attach downstream destination)" width="528" height="496" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-error-handling-redirect-to-error-output.png 528w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-error-handling-redirect-to-error-output-300x282.png 300w" sizes="(max-width: 528px) 100vw, 528px" /></a><p id="caption-attachment-1264" class="wp-caption-text">SSIS Component Error Handling &#8211; Redirect bad rows to error output (Attach to destination)</p></div>
<div id="attachment_1266" style="width: 858px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-error-output-dataviewer-view-bad-row.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1266" class="size-full wp-image-1266" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-error-output-dataviewer-view-bad-row.png" alt="SSIS Component Error Output - Add data viewer to see bad records and error message" width="848" height="532" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-error-output-dataviewer-view-bad-row.png 848w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-component-error-output-dataviewer-view-bad-row-300x188.png 300w" sizes="(max-width: 848px) 100vw, 848px" /></a><p id="caption-attachment-1266" class="wp-caption-text">SSIS Component Error Output &#8211; Add data viewer to see bad records and error message</p></div>
<p><strong>Ignore bad records</strong></p>
<p>If you simply don&#8217;t care about such errors and want to ignore them rather redirect then Set Error and Truncation options to [Ignore failure] in above step.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/handling-ssis-component-metadata-issues/">Handling SSIS Component Metadata Issues</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to get data from HubSpot API with SSIS</title>
		<link>https://zappysys.com/blog/get-data-from-hubspot-api-with-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 02 Jun 2017 15:31:16 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[hubspot]]></category>
		<category><![CDATA[HubSpot API]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[OAuth Connection]]></category>
		<category><![CDATA[RESTful API]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[ssis json source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1175</guid>

					<description><![CDATA[<p>Introduction HubSpot is a popular platform where CRM, Marketing and Sales meet in one place. It&#8217;s a good piece of service, yet sometimes you need to integrate it with your other system. In this article you will learn how to pull contacts from HubSpot API and load them into a SQL Server Database using SSIS and ZappySys [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-hubspot-api-with-ssis/">How to get data from HubSpot API with SSIS</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/hubspot-connector/">API Connector for Hubspot Connector</a> which makes it much simpler to <strong>Read/Write Hubspot Data in SSIS</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).</p>
</div></div>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/06/hubspot-api-integration-2.png"><img loading="lazy" decoding="async" class="wp-image-1862 alignleft" src="//zappysys.com/blog/wp-content/uploads/2017/06/hubspot-api-integration-2.png" alt="" width="110" height="110" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/hubspot-api-integration-2.png 180w, https://zappysys.com/blog/wp-content/uploads/2017/06/hubspot-api-integration-2-150x150.png 150w" sizes="(max-width: 110px) 100vw, 110px" /></a><a href="http://www.hubspot.com" target="_blank" rel="noopener">HubSp</a><a href="http://www.hubspot.com" target="_blank" rel="noopener">ot</a> is a popular platform where CRM, Marketing and Sales meet in one place. It&#8217;s a good piece of service, yet sometimes you need to integrate it with your other system. In this article you will learn how to pull contacts from <a href="https://developers.hubspot.com/docs/overview" target="_blank" rel="noopener">HubSpot API</a> and load them into a SQL Server Database using SSIS and <a href="//zappysys.com/products/ssis-powerpack/">ZappySys SSIS PowerPack</a>.</p>
<p>&nbsp;</p>
<h2>Prerequisites</h2>
<ol>
<li>HubSpot Account registered (an account you will want to get data from).</li>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<a href="https://msdn.microsoft.com/en-us/mt186501" 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>An existing SQL Server Database and table created (we will use it to load data into).</li>
<li><em>ZappySys SSIS PowerPack</em> installed.</li>
</ol>
<h2>Various methods to call HubSpot API</h2>
<p>HubSpot API supports two kinds of authentication:</p>
<ol>
<li>OAuth 2.0.</li>
<li>API Key in URL.</li>
</ol>
<p><em>API Key in URL</em> is simple, with minimal configuration, but it ought to be used only for development and testing purposes.</p>
<p>In this tutorial we will show how to authenticate using <em>OAuth 2.0</em>, which you should use in your production environment.</p>
<h2>Step-by-Step <span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– </span></span>Get data from HubSpot API into SQL Server database</h2>
<ol>
<li>Create HubSpot Developer Account (<a href="https://app.hubspot.com/signup/developers" target="_blank" rel="noopener">https://app.hubspot.com/signup/developers</a>). It&#8217;s an account you will need to use to create HubSpot Apps.</li>
<li>Login with your HubSpot Developer Account (<a href="https://app.hubspot.com/login" target="_blank" rel="noopener">https://app.hubspot.com/login</a>).</li>
<li>Select your newly created HubSpot Developer Account:
<div id="attachment_1205" style="width: 460px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-developer-account1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1205" class="wp-image-1205 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-developer-account1.png" alt="Logging into HubSpot - select HubSpot developer account" width="450" height="149" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-developer-account1.png 450w, https://zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-developer-account1-300x99.png 300w" sizes="(max-width: 450px) 100vw, 450px" /></a><p id="caption-attachment-1205" class="wp-caption-text">Logging into HubSpot &#8211; Select HubSpot developer account</p></div>
<div class="su-note"  style="border-color:#e5e5c6;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:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: Account name should contain &#8220;hubspot-developers&#8221; text.</div></div></li>
<li>Register HubSpot OAuth App for REST API Call for use with OAuth 2.0 by simply pressing &#8220;Create application&#8221; button:
<div id="attachment_1200" style="width: 398px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/create-hubspot-application.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1200" class="wp-image-1200" src="//zappysys.com/blog/wp-content/uploads/2017/06/create-hubspot-application.png" alt="Register HubSpot OAuth App for REST API Call for use with OAuth 2.0 " width="388" height="339" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/create-hubspot-application.png 511w, https://zappysys.com/blog/wp-content/uploads/2017/06/create-hubspot-application-300x262.png 300w" sizes="(max-width: 388px) 100vw, 388px" /></a><p id="caption-attachment-1200" class="wp-caption-text">Register HubSpot OAuth App for REST API Call for use with OAuth 2.0</p></div></li>
<li>Name the application (e.g. &#8220;ContactsApp&#8221;) and choose &#8220;Private&#8221; to make the application hidden from the outer and dangerous world 🙂
<div id="attachment_1201" style="width: 395px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/name-hubspot-application.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1201" class="wp-image-1201" src="//zappysys.com/blog/wp-content/uploads/2017/06/name-hubspot-application.png" alt="Name HubSpot REST API App which will be used from within SSIS" width="385" height="333" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/name-hubspot-application.png 448w, https://zappysys.com/blog/wp-content/uploads/2017/06/name-hubspot-application-300x259.png 300w" sizes="(max-width: 385px) 100vw, 385px" /></a><p id="caption-attachment-1201" class="wp-caption-text">Name HubSpot REST API App which will be used from within SSIS</p></div></li>
<li>Press &#8220;Edit&#8221; button on the app you just created.</li>
<li>Write down <em>Client ID</em> and <em>Client secret</em>. We will need them later for authentication:
<div id="attachment_1203" style="width: 867px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/note-hubspot-client-id-and-client-secret.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1203" class="wp-image-1203" src="//zappysys.com/blog/wp-content/uploads/2017/06/note-hubspot-client-id-and-client-secret-1024x458.png" alt="Write down Client ID and Client Secret which will be used in OAuth Connection SSIS component" width="857" height="383" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/note-hubspot-client-id-and-client-secret-1024x458.png 1024w, https://zappysys.com/blog/wp-content/uploads/2017/06/note-hubspot-client-id-and-client-secret-300x134.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/06/note-hubspot-client-id-and-client-secret.png 1090w" sizes="(max-width: 857px) 100vw, 857px" /></a><p id="caption-attachment-1203" class="wp-caption-text">Write down Client ID and Client Secret which will be used in OAuth Connection SSIS component</p></div></li>
<li>Open <em>SSIS Designer</em> and create a new package.</li>
<li>Drag a new <em>Data Flow </em>task from <em>SSIS Toolbox</em> into the <em><em>Control Flow:<br />
</em></em></p>
<div id="attachment_8028" style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8028" class="size-full wp-image-8028" src="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" alt="" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /><p id="caption-attachment-8028" class="wp-caption-text">Dragging and dropping Data Flow Task into Control Flow</p></div></li>
<li>Edit<em> Data Flow </em>task by double clicking<em>. </em>Then drag <em>ZS JSON Source</em> and <em>OLE DB Destination</em> components from <em>SSIS Toolbox </em>into the<em> Data Flow, </em>but don&#8217;t connect them yet:<em><em><br />
</em></em></p>
<div id="attachment_1207" style="width: 598px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/drag-json-source-into-data-flow.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1207" class="wp-image-1207 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/drag-json-source-into-data-flow.png" alt="Drag ZappySys JSON Source SSIS component into the Data Flow" width="588" height="200" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/drag-json-source-into-data-flow.png 588w, https://zappysys.com/blog/wp-content/uploads/2017/06/drag-json-source-into-data-flow-300x102.png 300w" sizes="(max-width: 588px) 100vw, 588px" /></a><p id="caption-attachment-1207" class="wp-caption-text">Drag ZappySys JSON Source SSIS component into the Data Flow</p></div></li>
<li>Start editing <em>JSON Source</em> component:
<ol>
<li>Set <em>Access Mode</em> to <em>File path or web URL</em>.</li>
<li>Set <em>Web URL</em> to <pre class="crayon-plain-tag">https://api.hubapi.com/contacts/v1/lists/all/contacts/all?count=100</pre><em><em>.<br />
</em></em><div class="su-note"  style="border-color:#e5e5c6;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:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: We are adding URL parameter with value <pre class="crayon-plain-tag">?count=100</pre>, because by default HubSpot API returns 20 contacts and we want to maximize result set and minimize the number of web requests.</div></div></li>
<li>Press <em>Select Filter </em>and select contacts node or simply enter <pre class="crayon-plain-tag">$.contacts[*]</pre>  into the text box<em>.</em></li>
<li>Check <em>Use Credentials</em> checkbox.</li>
<li>Select <em>&lt;New ZS-OAUTH Connection&gt;</em> menu item to create a new connection:
<div id="attachment_1209" style="width: 836px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/edit-json-source-for-getting-data-from-hubspot.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1209" class="wp-image-1209 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/edit-json-source-for-getting-data-from-hubspot.png" alt="JSON Source SSIS component configuration – Get data from HubSpot REST API using OAuth authentication" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/edit-json-source-for-getting-data-from-hubspot.png 826w, https://zappysys.com/blog/wp-content/uploads/2017/06/edit-json-source-for-getting-data-from-hubspot-300x266.png 300w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-1209" class="wp-caption-text">JSON Source SSIS component configuration – Get data from HubSpot API using OAuth authentication</p></div></li>
</ol>
</li>
<li>Configure OAuth 2.0 connection for HubSpot API:
<ol>
<li>Select <em>HubSpot</em> as <em>OAuth Provider</em>.</li>
<li>Select &#8220;Use Custom OAuth (App created by you)&#8221; option.<br />
<div class="su-note"  style="border-color:#e5e5c6;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:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: You can also use Default OAuth App option for a quick test. Select it and press &#8220;<em>Generate Token</em>&#8221; button after you enter the scope.</div></div></li>
<li>Paste <em>Client Id</em> and <em>Client Secret</em> you also saved in Step #7.</li>
<li>Input <pre class="crayon-plain-tag">contacts</pre> as our scope.</li>
<li>Finally, press &#8220;<em>Generate Token&#8221;</em> button:
<div id="attachment_1308" style="width: 781px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/configure-ssis-oauth-connection-for-hubspot-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1308" class="wp-image-1308 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/configure-ssis-oauth-connection-for-hubspot-api.png" alt="OAuth Connection SSIS component configuration - Connect to HubSpot API using OAuth 2.0" width="771" height="697" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/configure-ssis-oauth-connection-for-hubspot-api.png 771w, https://zappysys.com/blog/wp-content/uploads/2017/06/configure-ssis-oauth-connection-for-hubspot-api-300x271.png 300w" sizes="(max-width: 771px) 100vw, 771px" /></a><p id="caption-attachment-1308" class="wp-caption-text">OAuth Connection SSIS component configuration &#8211; Connect to HubSpot API using OAuth 2.0</p></div></li>
</ol>
</li>
<li>Select your <span style="text-decoration: underline;">ordinary</span> HubSpot account you want to get contacts from:
<div id="attachment_1212" style="width: 638px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-ordinary-account.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1212" class="wp-image-1212 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-ordinary-account.png" alt="OAuth Connection SSIS component configuration - Select a HubSpot account to get data from" width="628" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-ordinary-account.png 628w, https://zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-ordinary-account-300x184.png 300w" sizes="(max-width: 628px) 100vw, 628px" /></a><p id="caption-attachment-1212" class="wp-caption-text">OAuth Connection SSIS component configuration &#8211; Select a HubSpot account to get data from</p></div>
<div class="su-note"  style="border-color:#e5e5c6;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:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: Account name should NOT contain &#8220;hubspot-developers&#8221; text.</div></div></li>
<li>Grant access to your HubSpot App:
<div id="attachment_1214" style="width: 818px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/grant-access-to-hubspot-app.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1214" class="wp-image-1214 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/grant-access-to-hubspot-app-e1496844506831.png" alt="OAuth Connection SSIS component configuration - Grant access to HubSpot REST API App" width="808" height="364" /></a><p id="caption-attachment-1214" class="wp-caption-text">OAuth Connection SSIS component configuration &#8211; Grant access to HubSpot API App</p></div></li>
<li>You will get a prompt to save <em>Access</em> and <em>Refresh</em> tokens to a backup file. Press &#8220;Yes&#8221; to save them.<br />
<div class="su-note"  style="border-color:#e5e5c6;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:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: You will need to pass <pre class="crayon-plain-tag">Refresh Token</pre> as the parameter, when you run the package in another machine. Check <em>Deployment to Production</em> section for more info.</div></div></li>
<li>Configure HubSpot API pagination
<div>
<ol>
<li>Set <em>Next Link/Cursor Expression</em> to <pre class="crayon-plain-tag">$.vid-offset</pre>  by pressing &#8220;&#8230;&#8221; button or simply pasting the value into the text box.</li>
<li>In the same way set <em>Stop Indicator/Attribute</em> to <pre class="crayon-plain-tag">$.has-more</pre>.</li>
<li>Input <pre class="crayon-plain-tag">false</pre> as <em>Stop indicator value/Regular expression</em>.</li>
<li>Set <em>Suffix for Next Url</em> to <pre class="crayon-plain-tag">&amp;vidOffset=&lt;%nextlink%&gt;</pre>.
<div id="attachment_1236" style="width: 836px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-source-pagination-configuration-for-hubspot-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1236" class="wp-image-1236 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-source-pagination-configuration-for-hubspot-rest-api.png" alt="JSON Source SSIS component pagination configuration for HubSpot REST API call" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-source-pagination-configuration-for-hubspot-rest-api.png 826w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-source-pagination-configuration-for-hubspot-rest-api-300x266.png 300w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-1236" class="wp-caption-text">JSON Source SSIS component pagination configuration for HubSpot API call</p></div></li>
</ol>
</div>
</li>
<li>Press &#8220;Preview&#8221; button to&#8230; well, obviously to preview the results 🙂
<div id="attachment_1306" style="width: 836px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-source-data-preview-for-hubspot-api-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1306" class="wp-image-1306 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-source-data-preview-for-hubspot-api-data.png" alt="JSON Source SSIS component data preview of HubSpot API call result" width="826" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-source-data-preview-for-hubspot-api-data.png 826w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-source-data-preview-for-hubspot-api-data-300x99.png 300w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-1306" class="wp-caption-text">JSON Source SSIS component data preview of HubSpot API call result</p></div></li>
<li>Close &#8220;Data Preview&#8221; dialog and click &#8220;OK&#8221; button to save and close <em>JSON Source </em>component.</li>
<li>A dialog <em>Metadata Scan Options</em> should appear, to which you should respond &#8220;Ok&#8221; 🙂</li>
<li>Now you can connect <em>JSON Source</em> component with <em><em>OLE DB Destination:<br />
</em></em></p>
<div id="attachment_1243" style="width: 319px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/connect-ssis-json-source-for-hubspot-rest-api-with-ole-db-destination1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1243" class="wp-image-1243 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/connect-ssis-json-source-for-hubspot-rest-api-with-ole-db-destination1.png" alt="Connect JSON Source SSIS component with OLE DB Destination for HubSpot data." width="309" height="252" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/connect-ssis-json-source-for-hubspot-rest-api-with-ole-db-destination1.png 309w, https://zappysys.com/blog/wp-content/uploads/2017/06/connect-ssis-json-source-for-hubspot-rest-api-with-ole-db-destination1-300x245.png 300w" sizes="(max-width: 309px) 100vw, 309px" /></a><p id="caption-attachment-1243" class="wp-caption-text">Connect JSON Source SSIS component with OLE DB Destination for HubSpot data.</p></div></li>
<li>Now modify <em>OLE DB Destination </em>to have a connection to a <em>SQL Server</em> and point to a table, where you want contacts to be stored.</li>
<li>It&#8217;s time to map the columns of <em>JSON Source</em> with destination table columns. With your mouse simply connect corresponding columns or simply map <em>Input Column</em> with <em>Destination Column</em>. Press &#8220;OK&#8221; to close the window.
<div id="attachment_1244" style="width: 852px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/map-ssis-json-source-columns-with-hubspot-destination-table.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1244" class="wp-image-1244 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/map-ssis-json-source-columns-with-hubspot-destination-table.png" alt="Map JSON Source SSIS component columns with destination table columns you will store HubSpot data in" width="842" height="714" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/map-ssis-json-source-columns-with-hubspot-destination-table.png 842w, https://zappysys.com/blog/wp-content/uploads/2017/06/map-ssis-json-source-columns-with-hubspot-destination-table-300x254.png 300w" sizes="(max-width: 842px) 100vw, 842px" /></a><p id="caption-attachment-1244" class="wp-caption-text">Map JSON Source SSIS component columns with destination table columns you will store HubSpot data in</p></div></li>
<li>Finally, funtime! Press &#8220;F5&#8221; to execute the package. You should see a similar view as below. The number you see is the number of contacts were loaded from HubSpot API to your table:
<div id="attachment_1247" style="width: 1008px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1247" class="wp-image-1247 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/how-to-get-hubspot-rest-api-data-with-ssis-final-result.png" alt="The result of getting HubSpot REST API data with SSIS" width="998" height="255" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/how-to-get-hubspot-rest-api-data-with-ssis-final-result.png 998w, https://zappysys.com/blog/wp-content/uploads/2017/06/how-to-get-hubspot-rest-api-data-with-ssis-final-result-300x77.png 300w" sizes="(max-width: 998px) 100vw, 998px" /><p id="caption-attachment-1247" class="wp-caption-text">The result of getting HubSpot API data with SSIS</p></div></li>
</ol>
<h2>API Rate Limit (Throttling)</h2>
<p><a href="https://developers.hubspot.com/apps/api_guidelines" target="_blank" rel="noopener">HubSpot places limits on using its API</a>. Basically, it doesn&#8217;t allow you to make endless number of calls per second. Also it has a ceiling for requests made per day. So if you have paging enabled in <em>JSON Source</em> component, it will make as many requests as it has to retrieve all data. And in this step you may get an error, telling that you exceeded calling rate limit of the API. To avoid that, simply go to the <em>Throttling</em> tab and set the amount of milliseconds component has to sleep after making each call:</p>
<div id="attachment_1294" style="width: 674px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/hubspot-api-calls-throttling.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1294" class="wp-image-1294 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/hubspot-api-calls-throttling.png" alt="HubSpot API calls throttling configuration" width="664" height="130" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/hubspot-api-calls-throttling.png 664w, https://zappysys.com/blog/wp-content/uploads/2017/06/hubspot-api-calls-throttling-300x59.png 300w" sizes="(max-width: 664px) 100vw, 664px" /></a><p id="caption-attachment-1294" class="wp-caption-text">HubSpot API calls throttling configuration</p></div>
<h2><span id="Making_things_Dynamic_eg_URL">Making things Dynamic (e.g. URL)</span></h2>
<p>The URL we used (<a href="https://api.hubapi.com/contacts/v1/lists/all/contacts/all">https://api.hubapi.com/contacts/v1/lists/all/contacts/all</a>) in addition to <pre class="crayon-plain-tag">count</pre> parameter, has others as well. Let&#8217;s say in some scenarios you want to fetch list memberships  for contacts, so you must include <pre class="crayon-plain-tag">&amp;showListMemberships=true</pre>  in the URL as well. To make things more generic, instead of using hard-coded <pre class="crayon-plain-tag">true</pre> value, you can use SSIS variables, then the URL will look like this:</p><pre class="crayon-plain-tag">https://api.hubapi.com/contacts/v1/lists/all/contacts/all?showListMemberships={{User::ShowMemberships}}</pre><p>
<h2>Common Errors</h2>
<p>For detailed instruction to fix common metadata related errors <a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">read this article</a>.</p>
<p><strong>Truncation related error</strong></p>
<p>Most common error you may face when you run SSIS Package is truncation error. During design time only 300 rows scanned to detect datatype but at runtime you may extract far more records than 300. So its possible that you will get longer strings than initially expected. If you get error just copy that to notepad and read error carefully. It will explain the steps needed to fix the problem. Basically you can edit Columns on JSON Source UI &gt; Change Data Length or Datatype (if you need more than 4000 chars change to the type to DT_NTEXT and click on Column Name cell to save change). After you edit default settings then make sure to check Lock option (found all on the right side in same row).</p>
<p><strong>Authentication related error (happens when you run package from SQL Job Agent)</strong></p>
<p>So many times when you run from Visual Studio it works fine but when you deploy to Production and run from SQL Job it fails. If this is your issue then check you passing Token (i.e. Password Property of HTTP connection) using some sort of parameter approach (e.g. from command line or from config file). By default password is encrypted using your account so when you run it from SQL Job it will fail to decrypt it. See more on <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">Package Protection Level</a>.</p>
<h2><a name="deployment"></a>Deployment to Production</h2>
<p>When you are ready to deploy the package to Production consider passing Refresh Tokens and other sensitive data as passwords via SSIS parameters. In this way you don’t face authentication related error described in above section. See more on <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">Package Protection Level</a>.</p>
<h2>Download Sample Package</h2>
<p>Be sure to download a <a href="//zappysys.com/blog/wp-content/uploads/2017/06/Get-data-from-HubSpot-API-with-SSIS.zip">sample SQL Server 2012 SSIS package</a>, in case you encounter problems that you can&#8217;t go through in the step-by-step part.</p>
<div class="su-note"  style="border-color:#e5e5c6;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:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: Once you open the package, you won&#8217;t be able to run it immediately, but don&#8217;t panic. Firstly, it&#8217;s because you have a different SQL destination table. Secondly, you won&#8217;t see any sensitive data in the package, like tokens. Therefore you will have to perform OAuth authentication process to get those. So fix errors one by one and you are good to go. </div></div>
<h2>Conclusion</h2>
<p>In this article we learned how to call HubSpot API <a href="http://www.drdobbs.com/web-development/restful-web-services-a-tutorial/240169069" target="_blank" rel="noopener">RESTful</a> method and retrieve all contacts. Actually, HubSpot API consists of many small APIs and we used <a href="https://developers.hubspot.com/docs/methods/contacts/contacts-overview" target="_blank" rel="noopener">Contacts API</a> method particularly. If you need anything else than simply retrieving the contacts of your account, delve into the vastness of <a href="https://developers.hubspot.com/docs" target="_blank" rel="noopener">HubSpot API methods</a>!</p>
<p>Also it&#8217;s worth mentioning that <em>JSON Source</em> and <em>OAuth Connection </em>SSIS components saved us some valuable time, because we avoided using default SSIS <em>Script Component</em> and doing all the hard work ourselves.</p>
<h2>Keywords</h2>
<p>How to fetch data from HubSpot API | Pull data from HubSpot API into SQL Server | Call HubSpot API with SSIS | Sync HubSpot data to SQL Server | HubSpot data integration with SQL Server database | Load data from HubSpot REST API using SSIS</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-hubspot-api-with-ssis/">How to get data from HubSpot API with SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read data from ServiceNow REST API using SSIS</title>
		<link>https://zappysys.com/blog/how-to-read-data-from-servicenow-rest-api-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 13 Mar 2017 19:40:38 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[api pagination]]></category>
		<category><![CDATA[servicenow api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1081</guid>

					<description><![CDATA[<p>Introduction ServiceNow one of the most popular Incident management platform used by many. In this blog post you will learn how to get data from ServiceNow REST API using SSIS JSON Source (No coding required). You will also learn other API integration scenarios such as POST, DELETE, PUT API calls. You will also learn how to paginate [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/how-to-read-data-from-servicenow-rest-api-ssis/">How to read data from ServiceNow REST API using SSIS</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/servicenow-connector/">API Connector for ServiceNow</a> which makes it much simpler to <a href="https://zappysys.com/api/integration-hub/servicenow-connector/ssis"><strong>Read/Write ServiceNow Data in SSIS</strong></a> 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><img loading="lazy" decoding="async" class="wp-image-1744 alignleft" src="//zappysys.com/blog/wp-content/uploads/2017/03/servicenow-api-integration.png" alt="" width="116" height="116" srcset="https://zappysys.com/blog/wp-content/uploads/2017/03/servicenow-api-integration.png 301w, https://zappysys.com/blog/wp-content/uploads/2017/03/servicenow-api-integration-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/03/servicenow-api-integration-300x300.png 300w" sizes="(max-width: 116px) 100vw, 116px" /></p>
<p>ServiceNow one of the most popular Incident management platform used by many. In this blog post you will learn how to get data from ServiceNow REST API using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a> (No coding required). You will also learn other API integration scenarios such as POST, DELETE, PUT API calls.</p>
<p>You will also learn how to paginate response if you have large amount of data (E.g. more than 10000 rows)</p>
<p>&nbsp;</p>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we look into Step-By-Step section to calling ServiceNow API in SSIS let’s make sure you met following requirements.</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<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><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>ZappySys SSIS PowerPack</em> installed</a>. Click on the link to download FREE trial.</li>
<li>You have basic familiarity with ServiceNow API and you have UserID and Password handy.</li>
</ol>
<h3><span id="Prerequisites">Step-By-Step : Accessing ServiceNow data using SSIS</span></h3>
<p>Now lets look at how to fetch data from ServiceNow API using SSIS JSON Source.</p>
<h3>Configure SSIS HTTP Connection for ServiceNow REST API</h3>
<p>First step to access ServiceNow data is configure HTTP connection on JSON Source. In below example we will use <a href="https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/concept/c_RESTAPI.html" target="_blank" rel="noopener"><strong>ServiceNow REST API</strong></a>. There are many endpoints for ServiceNow REST API but we will use <a href="http://wiki.servicenow.com/index.php?title=Table_API" target="_blank" rel="noopener">Table API Service</a> to query table. Now lets look at steps to configure ServiceNow API connection</p>
<ol>
<li>Open SSIS Package and go to Data Flow designer (Click new data flow if missing)</li>
<li>Drag and drop  <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> from SSIS Data Flow Toolbox</li>
<li>Double click JSON Source to configure it as below
<ol>
<li>First Enter Full URL to access desired API. For example you can enter URL like below (We entered sysparm_limit=2000 to fetch 2000 records in each response. Change this to higher limit to speed up data extract. This number must match on Pagination tab &#8211; see next section). Change <strong>instance001</strong> to your own instance name.<br />
<pre class="crayon-plain-tag">https://instance001.service-now.com/api/now/v2/table/incident?sysparm_limit=2000</pre>
</li>
<li>Check Use Credentials option</li>
<li>Click New Connection and configure HTTP connection like below. Once done click OK
<div id="attachment_11188" style="width: 770px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-rest-api-with-basic-auth.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11188" src="https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-rest-api-with-basic-auth.png" alt="ssis-servicenow-rest-api-with-basic-auth" width="760" height="803" class="size-full wp-image-11188" srcset="https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-rest-api-with-basic-auth.png 760w, https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-rest-api-with-basic-auth-284x300.png 284w" sizes="(max-width: 760px) 100vw, 760px" /></a><p id="caption-attachment-11188" class="wp-caption-text">Configure ServiceNow REST API Connection in SSIS (Basic Auth using UserID, Password)</p></div></li>
<li>Click on Select Filter or enter <strong>$.result[*]</strong> in the filter textbox
<div id="attachment_1738" style="width: 1074px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/03/configure-ssis-json-source-servicenow-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1738" class="size-full wp-image-1738" src="//zappysys.com/blog/wp-content/uploads/2017/03/configure-ssis-json-source-servicenow-rest-api.png" alt="Configure SSIS JSON for ServiceNow REST API - Read data from Table" width="1064" height="741" srcset="https://zappysys.com/blog/wp-content/uploads/2017/03/configure-ssis-json-source-servicenow-rest-api.png 1064w, https://zappysys.com/blog/wp-content/uploads/2017/03/configure-ssis-json-source-servicenow-rest-api-300x209.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/03/configure-ssis-json-source-servicenow-rest-api-768x535.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/03/configure-ssis-json-source-servicenow-rest-api-1024x713.png 1024w" sizes="(max-width: 1064px) 100vw, 1064px" /></a><p id="caption-attachment-1738" class="wp-caption-text">Configure SSIS JSON for ServiceNow REST API &#8211; Read data from Table</p></div></li>
</ol>
</li>
<li>Click Preview to see some data. In next section we will configure Pagination to fetch many records.</li>
<li>If you like to load data to SQL Server then Simply connect your JSON Source to OLEDB Destination and Create New Table &gt; Click Mappings and Click OK</li>
<li>Execute Package</li>
</ol>
<p>&nbsp;</p>
<h3>Configure JSON Source for ServiceNow API Pagination</h3>
<p>By default ServiceNow API doesn&#8217;t return all records from your table. So if you wish to get all records then you must configure Pagination settings like below. For more information on pagination in SSIS <a href="//zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">read this article</a>.</p>
<div id="attachment_11189" style="width: 770px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-rest-api-RFC5988-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11189" src="https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-rest-api-RFC5988-pagination.png" alt="ServiceNow REST API Pagination in SSIS" width="760" height="727" class="size-full wp-image-11189" srcset="https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-rest-api-RFC5988-pagination.png 760w, https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-rest-api-RFC5988-pagination-300x287.png 300w" sizes="(max-width: 760px) 100vw, 760px" /></a><p id="caption-attachment-11189" class="wp-caption-text">ServiceNow REST API RFC-5988 Pagination in SSIS</p></div>
<p>Once you configure API Pagination it will keep fetching data from new URL automatically until no more data found or it hit Max Row limit you specify on UI (In our case we did max 100 rows). Use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">tool like Fiddler</a> to view HTTP requests made by JSON Source.</p>
<div id="attachment_1742" style="width: 782px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/03/fiddler-log-api-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1742" class="size-full wp-image-1742" src="//zappysys.com/blog/wp-content/uploads/2017/03/fiddler-log-api-pagination.png" alt="Debugging Web API requests using Fiddler" width="772" height="189" srcset="https://zappysys.com/blog/wp-content/uploads/2017/03/fiddler-log-api-pagination.png 772w, https://zappysys.com/blog/wp-content/uploads/2017/03/fiddler-log-api-pagination-300x73.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/03/fiddler-log-api-pagination-768x188.png 768w" sizes="(max-width: 772px) 100vw, 772px" /></a><p id="caption-attachment-1742" class="wp-caption-text">Debugging Web API requests using Fiddler</p></div>
<h3>Configure JSON Source for ServiceNow JSONv2 Pagination (older version API)</h3>
<p>In this section you will learn how to use older version of API known as <a href="https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/integrate/inbound-other-web-services/concept/c_JSONv2WebService.html" target="_blank" rel="noopener">ServiceNow JSONv2 Service</a> (another <a href="http://wiki.servicenow.com/index.php?title=JSONv2_Web_Service#gsc.tab=0" target="_blank" rel="noopener">help link here</a>). Syntax for ServiceNow JSONv2 API is below to access table data.</p><pre class="crayon-plain-tag">https://&lt;instance name&gt;.service-now.com/mytable.do?JSONv2
Or
https://&lt;instance name&gt;.service-now.com/mytable.do?JSONv2&amp;param1=val1&amp;param2=val2....</pre><p>
Now lets look at steps to configure ServiceNow API connection</p>
<p>To configure JSONv2 API use above steps for most of the things except following settings</p>
<ol>
<li>Configure URL like below (assuming you want to query sys_db_object table, with 15 record max in each response)<br />
<pre class="crayon-plain-tag">https://instance001.service-now.com/sys_db_object.do?JSONv2&amp;sysparm_record_count=15&amp;sysparm_query=ws_access=true^sys_mod_count=1^ORDERBYsys_id</pre>
</li>
<li>Configure Pagination Settings like below
<ol>
<li>Select Mode = Response Attribute Mode</li>
<li>For NextLink Enter <strong>$.records[-1:].sys_id</strong></li>
<li>For Suffix for Next URL enter <strong>&amp;sysparm_query=sys_id&gt;&lt;%nextlink%&gt;^ws_access=true^sys_mod_count=1^ORDERBYsys_id</strong></li>
<li>For Filter enter <strong>$.records[*]</strong></li>
</ol>
</li>
</ol>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-jsonv2-rest-api-pagination.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1743" src="//zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-jsonv2-rest-api-pagination.png" alt="" width="903" height="819" srcset="https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-jsonv2-rest-api-pagination.png 903w, https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-jsonv2-rest-api-pagination-300x272.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/03/ssis-servicenow-jsonv2-rest-api-pagination-768x697.png 768w" sizes="(max-width: 903px) 100vw, 903px" /></a></p>
<h2><span id="Loading_Graph_API_Office_365_data_to_SQL_Server">Loading ServiceNow data to SQL Server</span></h2>
<p>Once you done configuring JSON Source you can  load data to SQL Server. For example purpose we will load data into SQL Server but you can load into any Target (e.g. Flat file, Oracle, Excel) using Microsoft or ZappySys Destination connectors</p>
<p>To load ServiceNow data into SQL Server perform the following steps (Screenshot is used for demonstration for purpose, your values can be different than below)</p>
<ol>
<li>Drag OLEDB destination on Data Flow surface</li>
<li>Connect ZS JSON Source to Destination</li>
<li>On OLEDB destination select / create new SQL Connection and then Click “New Table”</li>
<li>Click on Mappings tab and click OK to save</li>
<li>Execute Package</li>
</ol>
<div id="attachment_1617" class="wp-caption alignnone">
<p><a href="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png"><img loading="lazy" decoding="async" class="size-full wp-image-1617" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?resize=720%2C546" sizes="(max-width: 720px) 100vw, 720px" srcset="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?w=782 782w, https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?resize=300%2C227 300w, https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?resize=768%2C582 768w" alt="Configure SSIS OLEDB Destination - Loading Xero Data into SQL Server Table" width="702" height="532" data-attachment-id="1617" data-permalink="//zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/ssis-xero-to-sql-server-data-load/#main" data-orig-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?fit=782%2C593" data-orig-size="782,593" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-xero-to-sql-server-data-load" data-image-description="&lt;p&gt;Configure SSIS OLEDB Destination – Loading Xero Data into SQL Server Table&lt;/p&gt; " data-medium-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?fit=300%2C227" data-large-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?fit=720%2C546" /></a></p>
<p class="wp-caption-text">Configure SSIS OLEDB Destination – Loading ServiceNow Data into SQL Server Table</p>
</div>
<div id="attachment_1618" class="wp-caption alignnone">
<p><a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png"><img loading="lazy" decoding="async" class="size-full wp-image-1618" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?resize=720%2C533" sizes="(max-width: 720px) 100vw, 720px" srcset="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?w=734 734w, https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?resize=300%2C222 300w" alt="Xero to SQL Server Column Mappings for OLEDB Destination" width="702" height="519" data-attachment-id="1618" data-permalink="//zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/ssis-xero-sql-server-load-mappings/#main" data-orig-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?fit=734%2C543" data-orig-size="734,543" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-xero-sql-server-load-mappings" data-image-description="&lt;p&gt;Xero to SQL Server Column Mappings for OLEDB Destination&lt;/p&gt; " data-medium-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?fit=300%2C222" data-large-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?fit=720%2C533" /></a></p>
<p class="wp-caption-text">ServiceNow API to SQL Server Column Mappings for OLEDB Destination</p>
</div>
<div id="attachment_1619" class="wp-caption alignnone">
<p><a href="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png"><img loading="lazy" decoding="async" class="size-full wp-image-1619" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?resize=283%2C391" sizes="(max-width: 283px) 100vw, 283px" srcset="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?w=283 283w, https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?resize=217%2C300 217w" alt="Loading Xero data to SQL Server in SSIS" width="275" height="380" data-attachment-id="1619" data-permalink="//zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/ssis-loading-data-from-xero-to-sql-server/#main" data-orig-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?fit=283%2C391" data-orig-size="283,391" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-loading-data-from-xero-to-sql-server" data-image-description="&lt;p&gt;Loading Xero data to SQL Server in SSIS&lt;/p&gt; " data-medium-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?fit=217%2C300" data-large-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?fit=283%2C391" /></a></p>
<p class="wp-caption-text">Loading ServiceNow REST API to SQL Server in SSIS</p>
</div>
<h2>POST Data to ServiceNow API (Insert, Update or Delete)</h2>
<p>There will be a time you like to automate POST actions (e.g. create new incident via API call). <a href="//zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">Check this article</a> to learn more on how to POST , DELETE, PUT data using API calls</p>
<h2>Common Errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2><span id="ConclusionWhats_next"><span id="ConclusionWhat8217s_next">Conclusion. What’s next?</span></span></h2>
<p>In this article we have learned how to load data from ServiceNow API to SQL Server using SSIS ( drag and drop approach without coding). We used <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS JSON / REST API Connector</a> to extract data from ServiceNow table. JSON Source Connector makes it super simple to parsing complex / large JSON Files or any Web API Response into rows and column so you can load into database like SQL Server. <a href="//zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try many other automation scenarios not discussed in this article.</p>
<p><strong>Keywords:</strong></p>
<p>ServiceNow Integration with SQL Server | How to extract ServiceNow data in SSIS? | How to read ServiceNow table? | Calling ServiceNow REST API using SSIS. | ServiceNow to SQL Server | SQL Server to ServiceNow | SSIS ServiceNow API Integration | ServiceNow SOAP API Integration</p>
<p>The post <a href="https://zappysys.com/blog/how-to-read-data-from-servicenow-rest-api-ssis/">How to read data from ServiceNow REST API using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to call eBay REST API in SQL Server with SSIS</title>
		<link>https://zappysys.com/blog/how-to-call-ebay-rest-api-using-ssis-oauth-connection/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 07 Feb 2017 03:36:07 +0000</pubDate>
				<category><![CDATA[REST API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[ebay api]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[SQL Server Integration Services]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[ssis oauth connection]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=981</guid>

					<description><![CDATA[<p> Introduction eBay recently launched brand new REST API with OAuth 2.0 support. This article will explain you how to call eBay REST API using SSIS to automate eBay operations (e.g. Buy/Sell) using SSIS REST API Integration Connectors / OAuth Connection Manager. This article assumes that you have basic knowledge of SSIS (SQL Server Integration Services). [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/how-to-call-ebay-rest-api-using-ssis-oauth-connection/">How to call eBay REST API in SQL Server with SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2> Introduction</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ebay-api-integration.png"><img loading="lazy" decoding="async" class=" wp-image-1626 alignleft" src="//zappysys.com/blog/wp-content/uploads/2017/02/ebay-api-integration.png" alt="" width="154" height="154" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ebay-api-integration.png 250w, https://zappysys.com/blog/wp-content/uploads/2017/02/ebay-api-integration-150x150.png 150w" sizes="(max-width: 154px) 100vw, 154px" /></a>eBay recently launched brand new REST API with OAuth 2.0 support. This article will explain you how to <em>call eBay REST API using SSIS</em> to automate eBay operations (e.g. Buy/Sell) using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-integration-pack/" target="_blank" rel="noopener">SSIS REST API Integration Connectors</a> / <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a>.</p>
<p>This article assumes that you have basic knowledge of SSIS (SQL Server Integration Services). We will use drag and drop approach without coding to do <em>eBay REST API integration</em>. We will use following custom tasks/connectors from <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a></p>
<p><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> REST API Connectors can be used to consume/manage eBay data using API calls. Following connectors will be used in this article.</p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png" alt="Custom SSIS Tasks - Call REST API Webservice (GET, POST, DELETE etc)" width="32" /></td>
<td><u><a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a></u></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/oauth-connection/ssis-oauth-connection-manager.png" alt="SSIS OAuth Connection Manager" width="32" /></td>
<td><a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/SSIS-PowerPack/SSIS-Json-Source-Adapter.png" alt="Custom SSIS Components - JSON Source (File, REST, OData)" width="32" /></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source (File, REST, OData)</a></td>
</tr>
</tbody>
</table>
</div>
<h2>Test Ebay API using Online API Testing Tool</h2>
<p>Before you can dig deep down we suggest you to try few API calls using ebay online testing tool. Here is an example api call using their Online Testing Tool.</p>
<p>For example visit below URL to try sample Search API call.</p><pre class="crayon-plain-tag">https://developer.ebay.com/my/api_test_tool?index=0&amp;env=production&amp;api=browse&amp;call=item_summary_search__GET&amp;variation=json</pre><p>
<div id="attachment_6519" style="width: 1187px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/02/testing-ebay-rest-api-tool.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6519" class="wp-image-6519 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/02/testing-ebay-rest-api-tool.png" alt="Testing Ebay REST API using Online Tool" width="1177" height="770" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/testing-ebay-rest-api-tool.png 1177w, https://zappysys.com/blog/wp-content/uploads/2017/02/testing-ebay-rest-api-tool-300x196.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/02/testing-ebay-rest-api-tool-768x502.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/02/testing-ebay-rest-api-tool-1024x670.png 1024w" sizes="(max-width: 1177px) 100vw, 1177px" /></a><p id="caption-attachment-6519" class="wp-caption-text">Testing Ebay REST API using Online Tool</p></div>
<p>&nbsp;</p>
<h2>Call eBay API using SSIS &#8211; Create new inventory item</h2>
<p>Now lets look at how to make simple eBay REST API call using SSIS. For demo purpose we will use Sandbox API rather than production.</p>
<ol>
<li>First download and install <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack from here</a>.</li>
<li>Create new SSIS Project and open SSIS Package</li>
<li>Drag new ZS REST API Task from SSIS Toolbox on control flow designer</li>
<li>Rename ZS REST API Task to <strong>Create eBay inventory item-1</strong>. Double click the task to configure it.</li>
<li>Select Request mode to [Url from Connection]</li>
<li>Select ZS-OAUTH connection type from connection dropdown.</li>
<li>On OAuth connection. Select <strong>eBay Sandbox</strong> from provider dropdown.</li>
<li>Enter App ID in Client ID field (<a href="http://developer.ebay.com/Devzone/rest/ebay-rest/content/oauth-gen-user-token.html#Getting4" target="_blank" rel="noopener">Obtained from here</a>)</li>
<li>Enter Cert ID in Client Secret field  (<a href="http://developer.ebay.com/Devzone/rest/ebay-rest/content/oauth-gen-user-token.html#Getting4" target="_blank" rel="noopener">Obtained from here</a>)</li>
<li>Select desired Scopes or leave it blank to use default scopes. For this example we need following two scopes<br />
https://api.ebay.com/oauth/api_scope/sell.inventory<br />
https://api.ebay.com/oauth/api_scope/sell.inventory.readonly</li>
<li>Click on Advanced Tab. Enter <strong>RuName</strong> in the Return URL field. Don&#8217;t worry if your RuName doesn&#8217;t look like URL 🙂 (<a href="http://developer.ebay.com/Devzone/rest/ebay-rest/content/oauth-gen-user-token.html#Getting4" target="_blank" rel="noopener">Click here to learn how to get RuName</a> &#8211; Scroll to <strong>Getting the RuName value</strong>)</li>
<li>Now click on first tab again. Click <strong>Generate token</strong> button. When prompted login using Sandbox User Account (<a href="http://www.developer.ebay.com/DevZone/sandboxuser/" target="_blank" rel="noopener">Click here to create test user</a> for Sandbox).<br />
<strong>NOTE:</strong> <span style="text-decoration: underline;">Production account or developer account wont work when you login for eBay Sandbox API Token</span></li>
<li>Click Accept button after login. If everything goes well you will see two tokens populated on your main screen (Access Token and Refresh Token). You will get prompt to save tokens to some backup file&#8230; Do that so same tokens can be used if you wish to deploy JOB to another machine.</li>
<li>Click Test to validate connection. Click OK to save.
<div id="attachment_993" style="width: 731px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-connection-ebay-sandbox-production-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-993" class="size-full wp-image-993" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-connection-ebay-sandbox-production-api.png" alt="SSIS OAuth Connection Manager - Connect to eBay Sandbox API" width="721" height="708" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-connection-ebay-sandbox-production-api.png 721w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-connection-ebay-sandbox-production-api-300x295.png 300w" sizes="(max-width: 721px) 100vw, 721px" /></a><p id="caption-attachment-993" class="wp-caption-text">SSIS OAuth Connection Manager &#8211; Connect to eBay Sandbox API</p></div></li>
<li>Now once you close connection you are back to REST API Task</li>
<li>Enter following URL to <a href="http://developer.ebay.com/devzone/rest/api-ref/inventory/inventory_item-sku__put.html" target="_blank" rel="noopener">create or new eBay inventory item</a> using PUT. Last part of following URL is ID we want to create<br />
<pre class="crayon-plain-tag">https://api.sandbox.ebay.com/sell/inventory/v1/inventory_item/GP-Cam-01</pre>
</li>
<li>Select Method <strong>PUT</strong> from dropdown</li>
<li>Click Edit for Request Body. Enter following data for our sample product<br />
<pre class="crayon-plain-tag">{
	"availability" : {
		"shipToLocationAvailability" : {
			"quantity" : 50
		}
	},
	"condition" : "NEW",
	"product" : {
		"title" : "GoPro Hero4 Helmet Cam",
		"description" : "New GoPro Hero4 Helmet Cam. Unopened box.",
		"aspects" : {
			"Brand" : ["GoPro"],
			"Type" : ["Helmet/Action"],
			"Storage Type" : ["Removable"],
			"Recording Definition" : ["High Definition"],
			"Media Format" : ["Flash Drive (SSD)"],
			"Optical Zoom" : ["10x"]
		},
		"imageUrls" : [
			"http://i.ebayimg.com/images/i/182196556219-0-1/s-l1000.jpg",
			"http://i.ebayimg.com/images/i/182196556219-0-1/s-l1001.jpg",
			"http://i.ebayimg.com/images/i/182196556219-0-1/s-l1002.jpg"
		]
	}
}</pre>
</li>
<li>Change Body content type to JSON from dropdown</li>
<li>Click on [Raw Edit] button in Headers grid toolbar. Enter following headers and click OK.<br />
<pre class="crayon-plain-tag">Content-Language: en-US
Accept: application/json</pre>
&nbsp;</li>
<li>Click Test Request/Response &#8211; If you get success that means product got created.<a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-rest-api-create-new-inventory-item-using-put.png"><img loading="lazy" decoding="async" class="size-full wp-image-994" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-rest-api-create-new-inventory-item-using-put.png" alt="SSIS Rest API Task - Call eBay REST API to create new inventory item" width="604" height="604" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-rest-api-create-new-inventory-item-using-put.png 604w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-rest-api-create-new-inventory-item-using-put-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-rest-api-create-new-inventory-item-using-put-300x300.png 300w" sizes="(max-width: 604px) 100vw, 604px" /></a></li>
<li>You can create more products by simply changing SKU in URL and name/description in Body. Click Test to execute API call.</li>
</ol>
<h2>Read data from eBay and load into SQL Server using SSIS JSON Source</h2>
<p>Now lets look at how to consume eBay REST API and load data into SQL Server. For this you can use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source (File, REST API)</a>. For this demo we will <a href="https://developer.ebay.com/api-docs/buy/browse/resources/item_summary/methods/search" target="_blank" rel="noopener">Call eBay Search API</a> . If you want to explore other API then <a href="https://developer.ebay.com/api-docs/buy/browse/resources/methods" target="_blank" rel="noopener">check this page</a>. Here is</p>
<ol>
<li>Go to Data flow tab</li>
<li>Drag and drop ZS JSON Source from SSIS Toolbox</li>
<li>Double click to configure it.</li>
<li>Enter API URL like below. We added Search parameter and limit parameter (Max rows per response). Refer to API Help page to know more about other available parameters.<br />
<pre class="crayon-plain-tag">https://api.sandbox.ebay.com/buy/browse/v1/item_summary/search?q=phone&amp;amp;limit=100</pre>
</li>
<li>Check Use Credentials option.</li>
<li>Select ZS-OAUTH connection or Create New (See previous section to create new one)</li>
<li>Select Filter (Look for Array Icon and select that node). For example if you calling search API then  enter or select  <pre class="crayon-plain-tag">$.itemSummaries[*]</pre>  like below.
<div id="attachment_996" style="width: 849px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-get-ebay-inventory-items-rest-api-call-oauth.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-996" class="wp-image-996 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-get-ebay-inventory-items-rest-api-call-oauth.png" alt="SSIS JSON Source - Get data from eBay REST API (Use OAuth Connection)" width="839" height="767" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-get-ebay-inventory-items-rest-api-call-oauth.png 839w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-get-ebay-inventory-items-rest-api-call-oauth-300x274.png 300w" sizes="(max-width: 839px) 100vw, 839px" /></a><p id="caption-attachment-996" class="wp-caption-text">SSIS JSON Source &#8211; Get data from eBay REST API (Use OAuth Connection)</p></div></li>
<li>Now click on pagination tab and enter <pre class="crayon-plain-tag">$.next</pre>  expression for next link attribute as below. This will enable pagination (It will keep reading in 100 rows per page until last page reached &#8211; Empty  recordset)
<div id="attachment_6517" style="width: 646px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-ebay-api-pagination-for-search-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6517" class="size-full wp-image-6517" src="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-ebay-api-pagination-for-search-api.png" alt="Ebay REST API Pagination (Search API Example)" width="636" height="582" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-ebay-api-pagination-for-search-api.png 636w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-ebay-api-pagination-for-search-api-300x275.png 300w" sizes="(max-width: 636px) 100vw, 636px" /></a><p id="caption-attachment-6517" class="wp-caption-text">Ebay REST API Pagination (Search API Example)</p></div></li>
<li>That&#8217;s it, now <strong>click Preview</strong> to see data</li>
<li>Once all looking good you can click OK to save JSON Source.</li>
<li>In Next Section we will see how to load Ebay Data into SQL Server.</li>
</ol>
<h2>Loading eBay data into SQL Server</h2>
<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>Pagination for eBay REST API Calls</h2>
<p>In previous example we saw REST API Pagination using Next Link approach but some API may not use same approach in that case <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/">refer to this link</a>.  We looked at Next Link approach in previous section, you can also use Method #2 (URL parameter  &#8211; Offset) but Next Link approach is more simpler.</p>
<h2>Calling eBay XML format API &#8211; Finding / Trading / Shopping API</h2>
<p>eBay converted most of their APIs to JSON format to use OAuth 2.0 standard but there few APIs still there which are not OAuth 2.0 standard. These includes eBay Trading API, eBay Finding API, eBay Shopping API. They all are still in XML format. Below section describe how to call these API. Use <a href="https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx" target="_blank" rel="noopener">eBay API Test tool here</a> to generate desired Request Body and Headers.</p>
<p>Now let&#8217;s look at an example to call eBay XML API (GetItem from Trading API). To support special case like eBay API ZappySys introduced OAuth connection property called CustomAuthHeader in <strong>v2.6.7 or higher</strong> (Only found in Properties grid view).</p>
<ol>
<li>Right click on OAuth connection manager icon &gt; Click Properties &gt; Set <strong>CustomAuthHeader</strong> to <strong>X-EBAY-API-IAF-TOKEN</strong><br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-ebay-xml-api-trading-finding-shopping-using-oauth-token.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2634" src="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-ebay-xml-api-trading-finding-shopping-using-oauth-token.png" alt="" width="615" height="230" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-ebay-xml-api-trading-finding-shopping-using-oauth-token.png 615w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-ebay-xml-api-trading-finding-shopping-using-oauth-token-300x112.png 300w" sizes="(max-width: 615px) 100vw, 615px" /></a></li>
<li>Now drag ZS REST API Task from Control flow SSIS Toolbox</li>
<li>Set Properties like below
<ol>
<li>Set URL as below (Sandbox Url is different than Production)<br />
<pre class="crayon-plain-tag">https://api.sandbox.ebay.com/ws/api.dll</pre>
</li>
<li>Set Body As (this was obtained from  <a href="https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx" target="_blank" rel="noopener">eBay API Test tool here</a> )<br />
<pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;GetItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"&gt;
	&lt;ErrorLanguage&gt;en_US&lt;/ErrorLanguage&gt;
	&lt;WarningLevel&gt;High&lt;/WarningLevel&gt;
      &lt;!--Enter an ItemID--&gt;
  &lt;ItemID&gt;1234&lt;/ItemID&gt;
&lt;/GetItemRequest&gt;</pre>
</li>
<li>Set Headers as below (Click on Raw Edit Button and paste below heades). Again these header were also copied from <a href="https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx" target="_blank" rel="noopener">eBay API Test tool here</a> . Notice that API function name is included in the header. Also site id and compatibility level required.<br />
<pre class="crayon-plain-tag">X-EBAY-API-CALL-NAME: GetItem
X-EBAY-API-SITEID: 0
X-EBAY-API-COMPATIBILITY-LEVEL: 967</pre>
</li>
<li>Now click OK to get response. If things working you will see some valid XML.
<div id="attachment_2635" style="width: 1059px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-trading-api-finding-shopping-xml-format-using-oauth-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2635" class="size-full wp-image-2635" src="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-trading-api-finding-shopping-xml-format-using-oauth-token.png" alt="Call eBay XML API using SSIS REST API Task (eBay Trading API, Shopping API, Finding API using OAuth Token)" width="1049" height="762" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-trading-api-finding-shopping-xml-format-using-oauth-token.png 1049w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-trading-api-finding-shopping-xml-format-using-oauth-token-300x218.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-trading-api-finding-shopping-xml-format-using-oauth-token-768x558.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-call-ebay-trading-api-finding-shopping-xml-format-using-oauth-token-1024x744.png 1024w" sizes="(max-width: 1049px) 100vw, 1049px" /></a><p id="caption-attachment-2635" class="wp-caption-text">Call eBay XML API using SSIS REST API Task (eBay Trading API, Shopping API, Finding API using OAuth Token)</p></div></li>
</ol>
</li>
</ol>
<h2>User Token vs Application Token</h2>
<p>Any time you call eBay API you have to supply token. eBay OAuth supports two types of token. In this article we used User Token. If you wish to use Application Token then you have to use OAuth Client Credentials grant. <a href="https://zappysys.zendesk.com/hc/en-us/articles/360008704413-How-to-call-API-in-SSIS-with-OAuth-2-0-Client-Credentials-Grant-Type" target="_blank" rel="noopener">See this article</a></p>
<p><strong>Difference between eBay Application Token vs User Token</strong></p>
<ol>
<li>Application Token<br />
&#8211; Do not require user login<br />
&#8211; Use this token if you need to perform basic operations which are supported by following permission   https://api.ebay.com/oauth/api_scope</li>
<li>User Token<br />
&#8211; Requires one time user login to create token and then refreshes automatically without login prompt (if you using SSIS PowerPack)<br />
&#8211; Use this token if you need higher privileges behalf of actual use for update/write data using API call</li>
</ol>
<p>Use Application token when you want to perform readonly operations and you don&#8217;t need higher privileges (such as admin access). Certain eBay API calls only possible if you supply user token.</p>
<h2><span id="POST_data_to_Xero_Insert_or_Update">POST data to Ebay (Insert or Update)</span></h2>
<p>In previous section we have seen how to read data from ebay. Now let’s look at how to write data to ebay.</p>
<p>There are two ways you can achieve this.</p>
<ol>
<li>Use <a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> in Data Flow</li>
<li>Use <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> in Control Flow</li>
</ol>
<p>Read this article to learn more about <a href="//zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">API POST using SSIS</a></p>
<h3><span id="Using_SSIS_Web_API_Task_Write_data_from_SQL_Server_to_Xero">Using SSIS Web API Task (Write data from SQL Server to ebay)</span></h3>
<h3><img decoding="async" src="https://i0.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination-post-json-to-rest-api-url.png?resize=503%2C403" alt="SSIS Web API Destination - POST JSON to REST API Endpoint, Create / Update records" /></h3>
<h3><span id="Using_REST_API_Task_to_POST_data_to_Xero">Using REST API Task to POST data to ebay</span></h3>
<p>If you have JSON/XML data already prepared and if you like to POST it to ebay API then REST API Task would be easy to use.</p>
<p>REST API Task Body can be direct string, variable (e.g. {{User::varSomeData}} or <a href="https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/" target="_blank" rel="noopener">Body can come from File </a></p>
<div id="attachment_1616" class="wp-caption alignnone">
<p><a href="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png"><img loading="lazy" decoding="async" class="size-full wp-image-1616" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png?resize=720%2C503" sizes="(max-width: 720px) 100vw, 720px" srcset="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png?w=862 862w, https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png?resize=300%2C210 300w, https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png?resize=768%2C536 768w" alt="SSIS REST API Task - POST data to Xero (Create contacts)" width="702" height="490" data-attachment-id="1616" data-permalink="//zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/ssis-post-data-xero-api-create-contacts-example/#main" data-orig-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png?fit=862%2C602" data-orig-size="862,602" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-post-data-xero-api-create-contacts-example" data-image-description="&lt;p&gt;SSIS REST API Task – POST data to Xero (Create contacts)&lt;/p&gt; " data-medium-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png?fit=300%2C210" data-large-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2017/07/ssis-post-data-xero-api-create-contacts-example.png?fit=720%2C503" /></a></p>
<p class="wp-caption-text">SSIS REST API Task – POST data to ebay (Create contacts)</p>
</div>
<h2>Common Errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2>Conclusion</h2>
<p>REST API integration typically requires coding and good understanding of protocol such as OAuth. SSIS PowerPack REST API connectors and OAuth Connection provides easy to use interface with many options to integrate virtually any API including eBay REST API inside your SQL Server Environment without any coding. Try <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> yourself see what is possible.</p>
<p>The post <a href="https://zappysys.com/blog/how-to-call-ebay-rest-api-using-ssis-oauth-connection/">How to call eBay REST API in SQL Server with SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
