<?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 Template Transform Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/ssis/components/ssis-template-transform/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/ssis/components/ssis-template-transform/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Thu, 05 Mar 2026 01:25:16 +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 Template Transform Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/ssis/components/ssis-template-transform/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to add row numbers in SSIS data flow</title>
		<link>https://zappysys.com/blog/add-row-numbers-ssis-data-flow/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 07 Oct 2022 15:34:28 +0000</pubDate>
				<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[SSIS Tips & How-Tos]]></category>
		<category><![CDATA[format specifiers]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[placeholder functions]]></category>
		<category><![CDATA[row numbers]]></category>
		<category><![CDATA[template transform]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=9828</guid>

					<description><![CDATA[<p>Problem Sometimes Data Flow source does not contain an ID column, or a number indicating a row number, which you need in further steps. To solve this, you may use a free ZappySys PowerPack component Template Transform. So let&#8217;s take a look at how to accomplish that. &#160; &#160; Tip Add Template Transform Go to [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/add-row-numbers-ssis-data-flow/">How to add row numbers in SSIS data flow</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Problem</h2>
<p><img decoding="async" class="size-full wp-image-9829 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2022/10/logo-add-row-number-to-ssis-data-flow.png" alt="" width="120" height="120" />Sometimes Data Flow source does not contain an ID column, or a number indicating a row number, which you need in further steps. To solve this, you may use a <strong>free</strong> <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys PowerPack</a> component <a href="https://zappysys.com/products/ssis-powerpack/ssis-template-transform-free/" target="_blank" rel="noopener">Template Transform</a>. So let&#8217;s take a look at how to accomplish that.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2>Tip</h2>
<h3>Add Template Transform</h3>
<p>Go to the Data Flow, drag and drop Template Transform from SSIS toolbox, and connect it right after the source, which does not provide ID/row number:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9831 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow.png" alt="" width="283" height="536" srcset="https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow.png 283w, https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-158x300.png 158w" sizes="(max-width: 283px) 100vw, 283px" /></p>
<h3>Configure Template Transform</h3>
<p>Template Transform will provide the row number we want. So configure it like this: in the text area enter <code>&lt;&lt;FUN_SEQUENCE&gt;&gt;</code> and optionally you can give this column a name, e.g. <code>RowNumber</code>.</p>
<div id="attachment_9832" style="width: 712px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9832" class="size-full wp-image-9832" src="https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-template-transform.png" alt="" width="702" height="673" srcset="https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-template-transform.png 702w, https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-template-transform-300x288.png 300w" sizes="(max-width: 702px) 100vw, 702px" /><p id="caption-attachment-9832" class="wp-caption-text">Configure Template Transform to get row numbers for each row in SSIS</p></div>
<p>By default <em>Template Transform&#8217;s</em> output type is DT_NTEXT. So if you wish to change the type to, for example, integer, use the <em>Derived Column</em> connector and CAST function to change it, e.g.:</p>
<p><code>(DT_I4)(DT_WSTR,100)RowNumber</code></p>
<div id="attachment_9842" style="width: 707px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9842" class="wp-image-9842" src="https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-derived-column-1.png" alt="" width="697" height="558" srcset="https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-derived-column-1.png 777w, https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-derived-column-1-300x240.png 300w, https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-derived-column-1-768x615.png 768w" sizes="(max-width: 697px) 100vw, 697px" /><p id="caption-attachment-9842" class="wp-caption-text">Derived column added to convert DT_NTEXT column to an integer type.</p></div>
<h3>Result</h3>
<p>In the data viewer you would see that you have a column with a different row number in each row:</p>
<div id="attachment_9835" style="width: 603px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9835" class="wp-image-9835 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-result.png" alt="" width="593" height="410" srcset="https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-result.png 593w, https://zappysys.com/blog/wp-content/uploads/2022/10/add-row-number-to-ssis-data-flow-result-300x207.png 300w" sizes="(max-width: 593px) 100vw, 593px" /><p id="caption-attachment-9835" class="wp-caption-text">Results: How to add row numbers to rows in SSIS data flow</p></div>
<p>The post <a href="https://zappysys.com/blog/add-row-numbers-ssis-data-flow/">How to add row numbers in SSIS data flow</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to compare records in SSIS using hash</title>
		<link>https://zappysys.com/blog/compare-records-ssis-using-hash/</link>
		
		<dc:creator><![CDATA[Sudhir Dandale]]></dc:creator>
		<pubDate>Mon, 12 Sep 2022 21:24:11 +0000</pubDate>
				<category><![CDATA[SSIS Conditional Split Transform]]></category>
		<category><![CDATA[SSIS Merge Join Transform]]></category>
		<category><![CDATA[SSIS Sort Transform]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=9767</guid>

					<description><![CDATA[<p>Introduction In this blog,  we are going to learn to how to compare records in SSIS using hash method. We will use FREE Template Transform component along with Sort Transform, Merge Join Transform and Conditional Split Transform. We will see how to produce hash value from multiple columns and later compare source\target hash values to detect changes\new rows. Data [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/compare-records-ssis-using-hash/">How to compare records in SSIS using hash</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction">Introduction</span></h2>
<p>In this blog,  we are going to learn to how to compare records in SSIS using hash method. We will use <strong>FREE</strong> <a href="https://zappysys.com/products/ssis-powerpack/ssis-template-transform-free/" target="_blank" rel="noopener">Template Transform</a> component along with Sort Transform, Merge Join Transform and Conditional Split Transform. We will see how to produce hash value from multiple columns and later compare source\target hash values to detect changes\new rows.</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:</p>
<ol style="margin-left: 1.5em;">
<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven&#8217;t already).</li>
<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol>
</div>
<h2><span style="font-size: 18pt;">Data Hashing</span></h2>
<p>Here is sample design how to compare records using hash method</p>
<p><img decoding="async" src="https://zappysys.zendesk.com/attachments/token/ZMuL8AR6RmIydJWOP5X6qIDCw/?name=image.png" /></p>
<ol>
<li>In Step 1, we need two data tables for record comparison from source and destination.<strong>Source Data:</strong><br />
<a href="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-1.png"><img loading="lazy" decoding="async" class="alignnone wp-image-9773 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-1.png" alt="" width="342" height="285" srcset="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-1.png 342w, https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-1-300x250.png 300w" sizes="(max-width: 342px) 100vw, 342px" /></a><strong>Target Data:</strong><br />
<a href="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-d.png"><img loading="lazy" decoding="async" class="alignnone wp-image-9774 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-d.png" alt="" width="339" height="285" srcset="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-d.png 339w, https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-d-300x252.png 300w" sizes="(max-width: 339px) 100vw, 339px" /></a></li>
<li>In Step 2, both the source and target data table records would be hash using the ZS Template Transform component as below. You can use <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm#fun_FUN_MD5" target="_blank" rel="noopener">FUN_MD5</a> to produce hash from multiple columns and. Please make sure that you change the Output Column name as below e.g. HashCrm or HashSQL<a href="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-formula.png"><img loading="lazy" decoding="async" class="alignnone wp-image-9775 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-formula.png" alt="" width="836" height="248" srcset="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-formula.png 836w, https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-formula-300x89.png 300w, https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-formula-768x228.png 768w" sizes="(max-width: 836px) 100vw, 836px" /></a></li>
<li>In Step 3, both the source and target data table need to be sorted by primary key using SSIS &#8220;Sort Transformation Editor&#8221; component as shown in above sample design screenshot.</li>
<li>In Step 4, both the source and target data table need to be merge using SSIS &#8220;Merge Join&#8221; component providing appropriate join type and key mapping<br />
as below<a href="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-mergejoin.png"><img loading="lazy" decoding="async" class="alignnone wp-image-9776 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-mergejoin.png" alt="" width="694" height="571" srcset="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-mergejoin.png 694w, https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-mergejoin-300x247.png 300w" sizes="(max-width: 694px) 100vw, 694px" /></a></li>
<li>In Step 4, we adding the conditional split with appropriate condition based on your need e.g. we want to check similar records as below<a href="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-conditionalsplit.png"><img loading="lazy" decoding="async" class="alignnone wp-image-9777 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-conditionalsplit.png" alt="" width="669" height="580" srcset="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-conditionalsplit.png 669w, https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-conditionalsplit-300x260.png 300w" sizes="(max-width: 669px) 100vw, 669px" /></a></li>
<li>From conditional split, we can feed the modified or same records into destination component based on our needs.</li>
<li>This is how we can compare the data for source and target tables for updated records and also we can set up different Merge Join and conditional split for desired set of output records set.</li>
</ol>
<h2>Detect Update/Insert</h2>
<ol>
<li>In previous section, we have chosen the updated records using hash. Here are going to see the Updated/New records using Left Outer Join as below<strong>Left Outer Join</strong><br />
<a href="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-merge-leftjoin.png"><img loading="lazy" decoding="async" class="alignnone wp-image-9781 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-merge-leftjoin.png" alt="" width="694" height="545" srcset="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-merge-leftjoin.png 694w, https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-merge-leftjoin-300x236.png 300w" sizes="(max-width: 694px) 100vw, 694px" /></a></li>
<li>Here is conditional split criteria for Update/New records as below<a href="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-conditionalsplit_new.png"><img loading="lazy" decoding="async" class="alignnone wp-image-9782 size-full" src="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-conditionalsplit_new.png" alt="" width="669" height="578" srcset="https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-conditionalsplit_new.png 669w, https://zappysys.com/blog/wp-content/uploads/2022/09/hash-data-compare-ssis-conditionalsplit_new-300x259.png 300w" sizes="(max-width: 669px) 100vw, 669px" /></a></li>
</ol>
<h2>Conclusion</h2>
<p>In this tutorial we learned how to compare the records in SSIS using hash method. If you want take a look it then download the ZappySys SSIS PowerPack <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">here</a>.</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/compare-records-ssis-using-hash/">How to compare records in SSIS using hash</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Get Office 365 Mail Attachments using SSIS</title>
		<link>https://zappysys.com/blog/get-office-365-mail-attachments-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 22 Feb 2020 08:27:34 +0000</pubDate>
				<category><![CDATA[REST API]]></category>
		<category><![CDATA[SSIS JSON Parser Transform]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[SSIS Trash Destination]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[attachments]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[office 365]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=8791</guid>

					<description><![CDATA[<p>Introduction In our previous article, we saw how to get Office 365 data in Power BI. Now, let’s look at how to get Office 365 Mail Attachments using SSIS without any coding. Microsoft Graph API is a unified way to access many Microsoft services, including the Office 365 API. In this post, we will use the SSIS [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-office-365-mail-attachments-using-ssis/">How to Get Office 365 Mail Attachments 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:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/outlook-mail-connector/ssis">Outlook Mail (Office 365) connector</a>, which makes it much simpler to <strong>download attachments, read/search emails, users, mail folders, send email, and more 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.</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><span style="box-sizing: border-box; margin: 0px; padding: 0px;">In our previous article, we saw <a href="https://zappysys.com/blog/get-office-365-data-in-power-bi-using-microsoft-graph-api-and-odbc/" target="_blank" rel="noopener">how to get Office 365 data in Power BI</a>.</span> Now, let’s look at how to get Office 365 Mail Attachments using 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, including the <strong>Office 365 API</strong>. In this post, we will use the <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON</a><span style="box-sizing: border-box; margin: 0px; padding: 0px;"><a target="_blank" rel="noopener">/REST API Source Connector</a> to retrieve the Outlook Messages list and its attachments</span>.</p>
<h2></h2>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Use Case of Microsoft Graph API</h2>
<p>Here are some use cases for why you want to use the 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 the 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 a specific range of a specific sheet)</li>
<li>Read <b>the SharePoint</b> Document library</li>
<li>Search content from <b>the SharePoint</b> 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 the <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 to call the Microsoft Graph Rest API Using SSIS</h2>
<p>Now, let&#8217;s look at examples to access your Outlook.com emails using SSIS. You can use the same techniques to call pretty much any Office 365 API.</p>
<h3>Configure SSIS OAuth Connection for Graph REST API</h3>
<p>The first step to access any Graph API is to configure an OAuth connection</p>
<ol>
<li>Open Visual Studio</li>
<li>Open an existing SSIS Project or create a new one using File &gt; New &gt; Project &gt; Choose “Integration Services Project” Type under Business Intelligence template category.</li>
<li>Create Package</li>
<li>Right-click inside the Connection Managers area and click <strong>New Connection…</strong></li>
<li>From the connection type list, select the <strong>ZS-OAUTH</strong> connection type.
<div id="attachment_11825" style="width: 959px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/Create-a-new-SSIS-OAuth-API-Connection-Manager.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11825" class="size-full wp-image-11825" src="https://zappysys.com/blog/wp-content/uploads/2020/02/Create-a-new-SSIS-OAuth-API-Connection-Manager.png" alt="" width="949" height="447" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/Create-a-new-SSIS-OAuth-API-Connection-Manager.png 949w, https://zappysys.com/blog/wp-content/uploads/2020/02/Create-a-new-SSIS-OAuth-API-Connection-Manager-300x141.png 300w, https://zappysys.com/blog/wp-content/uploads/2020/02/Create-a-new-SSIS-OAuth-API-Connection-Manager-768x362.png 768w" sizes="(max-width: 949px) 100vw, 949px" /></a><p id="caption-attachment-11825" class="wp-caption-text">Create a new SSIS OAuth API Connection Manager</p></div></li>
<li>On the OAuth Connection Manager, configure the following options
<ol style="list-style-type: lower-alpha;">
<li>Select &#8220;Custom&#8221; from the Provider dropdown</li>
<li>Select OAuth2 from the 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 the following URL in the Authorization URL<br />
<pre class="crayon-plain-tag">https://login.microsoftonline.com/common/oauth2/v2.0/authorize</pre>
</li>
<li>Use 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 on 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>the offline_access</strong> scope, which returns a refresh_token, which allows you to renew the token without going through the login process again. <span style="box-sizing: border-box; margin: 0px; padding: 0px;">For more information about which scopes are needed, always refer to the 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).</span></div></div></li>
<li>Go to the <strong>Advanced tab</strong> and enter the following URL in the Callback/Return URL (assuming the same URL used when you registered the App in the previous section)<br />
<pre class="crayon-plain-tag">https://zappysys.com/oauth</pre>
</li>
<li>Now go back to the first tab and click Generate Token. When prompted, log in using your Personal Microsoft Account or Work Account (Office 365 or AD login)</li>
<li>After logging in, you will see the Accept option. Just click it. If things go right, then you will see the Access Token and Refresh Token fields populated.</li>
</ol>
</li>
<li>Once everything is configured, you can click <strong>Test Connection</strong> to verify the connection works.
<div class="mceTemp"></div>
<div id="attachment_11832" style="width: 713px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-OAuth-Connection-Manager-for-Office-365-REST-API-Microsoft-Graph-API.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11832" class="size-full wp-image-11832" src="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-OAuth-Connection-Manager-for-Office-365-REST-API-Microsoft-Graph-API.png" alt="" width="703" height="754" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-OAuth-Connection-Manager-for-Office-365-REST-API-Microsoft-Graph-API.png 703w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-OAuth-Connection-Manager-for-Office-365-REST-API-Microsoft-Graph-API-280x300.png 280w" sizes="(max-width: 703px) 100vw, 703px" /></a><p id="caption-attachment-11832" class="wp-caption-text">SSIS OAuth Connection Manager for Office 365 REST API Microsoft Graph API</p></div></li>
</ol>
<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: Typically, RefreshToken is long-lived, but in some cases, they may expire soon too. If that’s the case, then you can configure the above OAuth connection to change the refresh token pattern. Simply enter the token file path and re-authenticate by clicking Generate Token. After that, each time you make an API call, it will save a new refresh token in the file.</div></div>
<h3>Download the Messages Attachment Files from Outlook</h3>
<p>Let’s start with an example. We use the SSIS JSON Source and Web API Destination components to make a call to the Microsoft Graph REST API.</p>
<ol>
<li>First of all, drag and drop the <strong>Data Flow Task</strong> from the SSIS Toolbox and double-click it to edit.
<div id="attachment_11784" style="width: 485px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11784" class="size-full wp-image-11784" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png" alt="" width="475" height="178" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png 475w, https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow-300x112.png 300w" sizes="(max-width: 475px) 100vw, 475px" /></a><p id="caption-attachment-11784" class="wp-caption-text">Drag and drop Data flow</p></div></li>
<li>From the SSIS toolbox, drag and drop the<strong> JSON Source</strong> onto the Data Flow Designer surface.
<div class="mceTemp"></div>
<div id="attachment_11533" style="width: 553px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/09/ssis-json-source-adapter-drag.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11533" class="size-full wp-image-11533" src="https://zappysys.com/blog/wp-content/uploads/2015/09/ssis-json-source-adapter-drag.png" alt="" width="543" height="146" srcset="https://zappysys.com/blog/wp-content/uploads/2015/09/ssis-json-source-adapter-drag.png 543w, https://zappysys.com/blog/wp-content/uploads/2015/09/ssis-json-source-adapter-drag-300x81.png 300w" sizes="(max-width: 543px) 100vw, 543px" /></a><p id="caption-attachment-11533" class="wp-caption-text">SSIS JSON Source &#8211; Drag and Drop</p></div></li>
<li>Double-click the <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/?"><strong>JSON Source</strong></a>, then enter the following URL to invoke the Messages API call with search options to retrieve emails with attachments.<br />
<pre class="crayon-plain-tag">https://graph.microsoft.com/v1.0/me/messages?$select=sentDateTime,from,subject,hasAttachments&amp;$search="hasAttachments:True"</pre>
Set the filter to <code>$.value[*]</code> and click the preview.</p>
<div id="attachment_11831" style="width: 837px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-JSON-Source-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Read-Mail-Example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11831" class="size-full wp-image-11831" src="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-JSON-Source-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Read-Mail-Example.png" alt="" width="827" height="887" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-JSON-Source-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Read-Mail-Example.png 827w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-JSON-Source-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Read-Mail-Example-280x300.png 280w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-JSON-Source-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Read-Mail-Example-768x824.png 768w" sizes="(max-width: 827px) 100vw, 827px" /></a><p id="caption-attachment-11831" class="wp-caption-text">SSIS JSON Source – Get data from Microsoft Graph API (Office 365 API – Read Mail Example)</p></div>
<p>To customize the 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’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>…/messages?$top=50</strong>).</li>
<li> Now, let&#8217;s use Template Transform to set the URL using the message ID to make the <a href="https://docs.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&amp;tabs=http" target="_blank" rel="noopener">Get attachment API</a> call.</p><pre class="crayon-plain-tag">https://graph.microsoft.com/v1.0/me/messages/&lt;%id%&gt;/attachments</pre><p>
<div id="attachment_11833" style="width: 848px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Template-Transform-sending-attachment-id.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11833" class="size-full wp-image-11833" src="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Template-Transform-sending-attachment-id.png" alt="" width="838" height="560" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Template-Transform-sending-attachment-id.png 838w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Template-Transform-sending-attachment-id-300x200.png 300w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Template-Transform-sending-attachment-id-768x513.png 768w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Template-Transform-sending-attachment-id-272x182.png 272w" sizes="(max-width: 838px) 100vw, 838px" /></a><p id="caption-attachment-11833" class="wp-caption-text">SSIS Template Transform sending attachment id</p></div>
<div class="mceTemp"></div>
</li>
<li>Now we need to use the <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/?_gl=1*1fgshu4*_up*MQ..*_gs*MQ..&amp;gclid=CjwKCAiAzZ_NBhAEEiwAMtqKy8lyVraD40LVoEOcaJPgdN6RaL8j21-KaDKKbrh3VFlYirORdiQ3MxoCtO8QAvD_BwE&amp;gbraid=0AAAAADhWWLJ5j927a8ePIZceRs447LN9W"><strong>Web API Destination</strong></a> to make the Get Attachment API call by message ID. Select the Input column for URL as that TemplateOutput.
<div id="attachment_11834" style="width: 733px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Web-API-Destination-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Get-Attachment-Example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11834" class="size-full wp-image-11834" src="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Web-API-Destination-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Get-Attachment-Example.png" alt="" width="723" height="775" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Web-API-Destination-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Get-Attachment-Example.png 723w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Web-API-Destination-–-Get-data-from-Microsoft-Graph-API-Office-365-API-–-Get-Attachment-Example-280x300.png 280w" sizes="(max-width: 723px) 100vw, 723px" /></a><p id="caption-attachment-11834" class="wp-caption-text">SSIS Web API Destination – Get data from Microsoft Graph API (Office 365 API – Get Attachment Example)</p></div></li>
<li>Now, the next step is to parse the JSON Response String of the get attachment api call. For that, we need to use a <strong><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/?utm_source=google&amp;utm_medium=cpc&amp;utm_campaign=22259122063&amp;utm_content=&amp;utm_term=&amp;gad_source=1&amp;gad_campaignid=22582753584&amp;gbraid=0AAAAADhWWLJ5j927a8ePIZceRs447LN9W&amp;gclid=CjwKCAiAzZ_NBhAEEiwAMtqKy1ZTPt9tVn9Xy9xU7z27q__H4RRoMa_SfgZg5L8maavtcr5HfzCl0RoC6_sQAvD_BwE">JSON Parser</a></strong>. Select the input as Web PAI Destination ResponseText and use the below sample JSON string to configure the metadata(Columns).<br />
<pre class="crayon-plain-tag">{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('support%40zappysys.com')/messages('AQMkADAwATMwMAItMDkyMC0zZTg4AC0wMAItMDAKAEYAAAP_JUy')/attachments"
,"value":[{"@odata.type":"#microsoft.graph.fileAttachment","@odata.mediaContentType":"text/plain"
,"id":"AQMkADAwATMwMAItMDkyMC0zZTg4AC0wMAItMDAKAEYAAAP_JUy_27M"
,"lastModifiedDateTime":"2020-02-21T07:36:16Z"
,"name":"Test.txt","contentType":"text/plain","size":870,"isInline":false
,"contentId":null,"contentLocation":null,"contentBytes":"VGVzdCBNZXNzYWdl"}]}</pre>
<div id="attachment_11828" style="width: 1043px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-using-JSON-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11828" class="size-full wp-image-11828" src="https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-using-JSON-example.png" alt="" width="1033" height="713" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-using-JSON-example.png 1033w, https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-using-JSON-example-300x207.png 300w, https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-using-JSON-example-1024x707.png 1024w, https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-using-JSON-example-768x530.png 768w" sizes="(max-width: 1033px) 100vw, 1033px" /></a><p id="caption-attachment-11828" class="wp-caption-text">JSON Parser Transform &#8211; using JSON example</p></div>
<div class="mceTemp"></div>
</li>
<li> Now, in the JSON Parser, go to the Go-to columns Tab and set the <strong>contentBytes</strong> DataType to <strong>DT_IMAGE,</strong> and increase the other columns&#8217; <strong>DT_WSTR</strong> lengths by 1000 and 1500. We set contentBytes to the <strong>DT_IMAGE</strong>  datatype, which is like varbinary(MAX).
<div id="attachment_11829" style="width: 838px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-Columns-Tab-fix-the-datatype.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11829" class="size-full wp-image-11829" src="https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-Columns-Tab-fix-the-datatype.png" alt="" width="828" height="611" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-Columns-Tab-fix-the-datatype.png 828w, https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-Columns-Tab-fix-the-datatype-300x221.png 300w, https://zappysys.com/blog/wp-content/uploads/2020/02/JSON-Parser-Transform-Columns-Tab-fix-the-datatype-768x567.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-11829" class="wp-caption-text">JSON Parser Transform Columns Tab fix the datatype</p></div></li>
<li>Furthermore, in the next step, we need to use an SSIS Derived Column to set the FilePath where we want to save the attachments, and then concatenate the local file path with the attachment name column.
<div id="attachment_11830" style="width: 798px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Derived-Column-Add-New-Column-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11830" class="size-full wp-image-11830" src="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Derived-Column-Add-New-Column-1.png" alt="" width="788" height="624" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Derived-Column-Add-New-Column-1.png 788w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Derived-Column-Add-New-Column-1-300x238.png 300w, https://zappysys.com/blog/wp-content/uploads/2020/02/SSIS-Derived-Column-Add-New-Column-1-768x608.png 768w" sizes="(max-width: 788px) 100vw, 788px" /></a><p id="caption-attachment-11830" class="wp-caption-text">SSIS Derived Column: Add New Column</p></div></li>
<li>Finally, we need to use the <a href="https://docs.microsoft.com/en-us/sql/integration-services/data-flow/transformations/export-column-transformation?view=sql-server-ver15" target="_blank" rel="noopener">Export Column</a> Transform (Native) to export attachment bytes to a local file. It needs to know 2 upstream info Bytes and the target file path.
<div id="attachment_11827" style="width: 763px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/Export-Column-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11827" class="size-full wp-image-11827" src="https://zappysys.com/blog/wp-content/uploads/2020/02/Export-Column-configuration.png" alt="" width="753" height="637" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/Export-Column-configuration.png 753w, https://zappysys.com/blog/wp-content/uploads/2020/02/Export-Column-configuration-300x254.png 300w" sizes="(max-width: 753px) 100vw, 753px" /></a><p id="caption-attachment-11827" class="wp-caption-text">Export Column configuration</p></div></li>
<li>Make sure to attach the export column to some destination (e.g., our ZS Trash Destination); the engine might remove it. At the same time, it optimizes the runtime. It may remove all transformations that don&#8217;t have a destination, such as deploying the package to SQL Server, or when you set optimize in Visual Studio.</li>
<li>That&#8217;s it, execute the package, and it will download all the email attachments.
<div id="attachment_11826" style="width: 1050px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2020/02/Downloaded-Mail-Attachments.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11826" class="size-full wp-image-11826" src="https://zappysys.com/blog/wp-content/uploads/2020/02/Downloaded-Mail-Attachments.png" alt="" width="1040" height="559" srcset="https://zappysys.com/blog/wp-content/uploads/2020/02/Downloaded-Mail-Attachments.png 1040w, https://zappysys.com/blog/wp-content/uploads/2020/02/Downloaded-Mail-Attachments-300x161.png 300w, https://zappysys.com/blog/wp-content/uploads/2020/02/Downloaded-Mail-Attachments-1024x550.png 1024w, https://zappysys.com/blog/wp-content/uploads/2020/02/Downloaded-Mail-Attachments-768x413.png 768w" sizes="(max-width: 1040px) 100vw, 1040px" /></a><p id="caption-attachment-11826" class="wp-caption-text">Downloaded Mail Attachments</p></div></li>
</ol>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>After all, in this article, we learned how to make a Microsoft Graph API REST API call. We used the <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. Made the Get attachment API call using the <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> and parsed the JSON response using the <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser</a>. And using the Native SSIS Export Column, we saved the export attachment&#8217;s bytes to a local file. To explore many other scenarios not discussed in this article, download <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here (includes 70+ Components)</a>.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following links for more information:</p>
<ul>
<li style="list-style-type: none;">
<ul>
<li>Help File: <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/json-source.htm" target="_blank" rel="noopener">JSON Source(REST API or File)</a></li>
<li>Help File: <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=ssis-web-api-destination.htm" target="_blank" rel="noopener">Web API Destination</a></li>
<li>Help File: <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=ssis-json-parser-transform.htm" target="_blank" rel="noopener">JSON Parser Transform</a></li>
<li><a href="https://docs.microsoft.com/en-us/graph/overview" target="_blank" rel="noopener">Overview of the Microsoft Graph API</a></li>
</ul>
</li>
</ul>
<p>The post <a href="https://zappysys.com/blog/get-office-365-mail-attachments-using-ssis/">How to Get Office 365 Mail Attachments using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Update or Insert &#8211; Upsert MongoDB Array Items using SSIS</title>
		<link>https://zappysys.com/blog/update-insert-upsert-mongodb-array-items-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 13 Feb 2019 15:36:07 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB Destination]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[upsert]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6346</guid>

					<description><![CDATA[<p>Introduction In our previous blog post we saw how to update / delete mongodb array item. Now let&#8217;s look at how to Upsert MongoDB Array Items (i.e. Insert Item if not found in Array else Update existing record). Upsert into nested MongoDB Array requires two step process, unfortunately there is no easy way to do [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/update-insert-upsert-mongodb-array-items-ssis/">Update or Insert &#8211; Upsert MongoDB Array Items using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In our previous blog post we saw how to <a href="https://zappysys.com/blog/update-mongodb-array-items-using-ssis/" target="_blank" rel="noopener">update / delete mongodb array item</a>. Now let&#8217;s look at how to Upsert MongoDB Array Items (i.e. Insert Item if not found in Array else Update existing record). Upsert into nested MongoDB Array requires two step process, unfortunately there is no easy way to do in a single step. You may see in below screenshot that first we will do Update Step for Existing MongoDB Array Items and then we will insert missing Records in second step. So let&#8217;s get started.</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>MongoDB Array Upsert &#8211; Update / Insert using Custom JOIN condition (such as $ne )</h2>
<p>By default SSIS Mongodb Destination performs Lookup using $eq condition (Match rows using Equal operator). However there will be a time when you like to lookup and update target rows using custom join criteria (e.g. Use Not Equal condition &#8211; $ne ). V2.7.6  and later introduced new property called  <pre class="crayon-plain-tag">EnableCustomLookupQuery</pre> . When you enable this setting, you can supply a document which contains Data and Condition. You can map this XML formatted document to   __DOCUMENT__  (see below)</p>
<p>Here is the description how to use custom Join using this new property.</p><pre class="crayon-plain-tag">Enables use of custom lookup query for Update / Upsert or Delete Operation. 
By default JOIN condition for target record match is generated automatically based on columns you supply in ColumnsForLookup property. 
However in some cases you need to supply custom condition for lookup to perform complex operations, in such case enable this option. 
When you enable this option you must supply map __DOCUMENT__ input column. String you supply to this column should be in this format 

&lt;command&gt;
  &lt;query&gt;YOUR_LOOKUP_QUERY&lt;/query&gt;
  &lt;document&gt;YOUR_JSON_DOC&lt;/document&gt;
&lt;/command&gt;. 

Lookup query in &lt;query&gt; tag can be either Mongo JSON format (e.g. { \"CustomerID\" : \"AAA\", \"Orders.OrderID\" : { \"$ne\" : \"1000\" } }) 
OR
you can use ZappySys SQL query (e.g. select * from mytable where CustomerID='AAA' and [Orders.$.OrderID] != '1000' )</pre><p>
Now lets look at step by step. In below example we have a table called CustomerTest. We will load it with 2 records (With No orders). Then Update array using custom lookup condition, and later step we will insert record in array using custom lookup condition.</p>
<div id="attachment_6299" style="width: 498px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-upsert-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6299" class="size-full wp-image-6299" src="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-upsert-example.png" alt="SSIS MongoDB Array Upsert Example (Update / Insert Array Items based on custom lookup condition)" width="488" height="346" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-upsert-example.png 488w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-upsert-example-300x213.png 300w" sizes="(max-width: 488px) 100vw, 488px" /></a><p id="caption-attachment-6299" class="wp-caption-text">SSIS MongoDB Array Upsert Example (Update / Insert Array Items based on custom lookup condition)</p></div>
<h3>Update Array using Custom Lookup Condition</h3>
<ol>
<li>Lets create few sample rows in MongoDB Collection. You can use following command in SSIS MongoDB Execute SQL Task<br />
<pre class="crayon-plain-tag">{
 scope: 'database',
 db: 'Northwind',
 command: 'eval',
 args: 
 {
 code: 'db.CustomerTest.insert( [ {CustomerID:"AAA", Orders:[]}, {CustomerID:"BBB", Orders:[]}, {CustomerID:"CCC", Orders:[{OrderID:"1004","OrderDate" : "2008-02-05","Qty" : "5"} ]} ] )' 
 
 } 
}</pre>
</li>
<li>Now drag Data flow.</li>
<li>Drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">ZS CSV Source</a> or any other source. For example purpose we will configure CSV Source using Direct Value option with following Sample data. In the first run of package it will update only orders for CCC customer because only that customer will have records after table creation. one row. But in 2nd run all rows updated.<br />
<pre class="crayon-plain-tag">CustomerID,Company,OrderID,OrderDate,Qty,Address
AAA,Anthony Inc,1000,2008-01-01,90,Po Box 111\4612
AAA,Anthony Inc,1001,2010-02-01,91,Po Box 111 / 4612
BBB,Bob Inc,1002,2008-02-01,92,Po Box 222 / 4612
BBB,Bob Inc,1003,2010-01-01,93,Po Box 222 / 4612
CCC,Cindy Inc,1004,2010-01-07,2,Po Box 555 / 2345</pre>
&nbsp;</li>
<li>Click OK to save Source UI</li>
<li>Now drag ZS Template Transform to build XML document (Data + Query). Connect Source to Template transform. You can also use ZS XML Generator Transform but for simplicity we will use Template Transform.</li>
<li>Double click to open Template Transform and enter text as below. Notice how we have entered MongoDB Query and Data in two separate XML nodes. First node is custom query for lookup. Second node is Operation we like to perform (e.g. $set in our case to update existing data). You can use Insert Variable and then select Columns option to insert placeholders. Also in some fields we used JSONENCODE function to make sure we escape double quote and slash correctly.<br />
<pre class="crayon-plain-tag">&lt;command&gt;
	&lt;query&gt;&lt;![CDATA[
{
	"CustomerID": "&lt;%CustomerID%&gt;", 
	"Orders.OrderID": { "$eq" : "&lt;%OrderID%&gt;"}
}
]]&gt;&lt;/query&gt;
	&lt;document&gt;&lt;![CDATA[
{
  $set :
   { "CompanyName":"&lt;%Company,JSONENCODE%&gt;", 
     "Address":"&lt;%Address,JSONENCODE%&gt;", 
     "Orders.$.OrderID": "&lt;%OrderID%&gt;", 
     "Orders.$.OrderDate": "&lt;%OrderDate%&gt;", 
     "Orders.$.Qty": "&lt;%Qty%&gt;" 
    } 
  }
}
]]&gt;&lt;/document&gt;
&lt;/command&gt;</pre>
<div id="attachment_6300" style="width: 851px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-lookup-template-transform.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6300" class="size-full wp-image-6300" src="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-lookup-template-transform.png" alt="Using ZS Template Transform to specify custom JOIN condition for MongoDB Update (Array Items)" width="841" height="697" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-lookup-template-transform.png 841w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-lookup-template-transform-300x249.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-lookup-template-transform-768x636.png 768w" sizes="(max-width: 841px) 100vw, 841px" /></a><p id="caption-attachment-6300" class="wp-caption-text">Using ZS Template Transform to specify custom JOIN condition for MongoDB Update (Array Items)</p></div></li>
<li>Click OK to save Template Transform</li>
<li>Drag ZS MongoDB Destination. Connect Template Transform to Destination</li>
<li>Double click MongoDB Destination to edit. Set Connection, Table name, Operation=Update, <strong>EnableCustomLookupQuery</strong>=True
<div id="attachment_6301" style="width: 638px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-condition-setting.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6301" class="size-full wp-image-6301" src="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-condition-setting.png" alt="Configure MongoDB Destination for Custom Join Condition (EnableCustomLookupQuery Setting)" width="628" height="613" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-condition-setting.png 628w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-custom-condition-setting-300x293.png 300w" sizes="(max-width: 628px) 100vw, 628px" /></a><p id="caption-attachment-6301" class="wp-caption-text">Configure MongoDB Destination for Custom Join Condition (EnableCustomLookupQuery Setting)</p></div></li>
<li>Goto Mappings Tab and attach TemplateOutput to __DOCUMENT__
<div id="attachment_6302" style="width: 717px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-custom-join-mapping.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6302" class="size-full wp-image-6302" src="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-custom-join-mapping.png" alt="MongoDB Mappings - Loading Document for Array Update (Custom Join Criteria)" width="707" height="584" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-custom-join-mapping.png 707w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-custom-join-mapping-300x248.png 300w" sizes="(max-width: 707px) 100vw, 707px" /></a><p id="caption-attachment-6302" class="wp-caption-text">MongoDB Mappings &#8211; Loading Document for Array Update (Custom Join Criteria)</p></div></li>
<li>Click OK to Save</li>
</ol>
<p>&nbsp;</p>
<h3>Insert into Array using Custom Lookup Condition</h3>
<p>Now let&#8217;s look at slightly modified steps to Insert into Array for new records. In this example we will insert Source records if CustomerID found but OrderID is not found. (See Template Transform Step). We will use <strong>Not Equal Condition</strong> this time.</p>
<ol>
<li>Now drag Data flow rename it to something like <strong>[Add records to array]</strong></li>
<li>Drag ZS CSV Source or any other source. For example purpose we will configure CSV Source using Direct Value option with following Sample data<br />
<pre class="crayon-plain-tag">CustomerID,Company,OrderID,OrderDate,Qty
AAA,Anthony Inc,1000,2008-01-01,30
AAA,Anthony Inc,1001,2010-02-01,4
BBB,Bob Inc,1002,2008-02-01,30
BBB,Bob Inc,1003,2010-01-01,4</pre>
&nbsp;</li>
<li>Click OK to save Source UI</li>
<li>Now drag ZS Template Transform to build XML document (Data + Query). Connect Source to Template transform. You can also use ZS XML Generator Transform but for simplicity we will use Template Transform.</li>
<li>Double click to open Template Transform and enter text as below. Notice how we have entered MongoDB Query and Data in two separate XML nodes. First node is custom query for lookup. Second node is Operation we like to perform (e.g. $addToSet in our case to insert into array )<br />
<pre class="crayon-plain-tag">&lt;command&gt;
&lt;query&gt;
{"CustomerID": "&lt;%CustomerID%&gt;", "Orders.OrderID":{ "$ne" : "&lt;%OrderID%&gt;"}}
&lt;/query&gt;
&lt;document&gt;{
  $addToSet :
   { Orders : {"OrderID": "&lt;%OrderID%&gt;", "OrderDate": "&lt;%OrderDate%&gt;", "Qty": "&lt;%Qty%&gt;" } }    
 }
&lt;/document&gt;
&lt;/command&gt;</pre>
</li>
<li>Click OK to save Template Transform</li>
<li>Drag ZS MongoDB Destination. Connect Template Transform to Destination</li>
<li>Double click MongoDB Destination to edit. Set Connection, Table name, Operation=Update, <strong>EnableCustomLookupQuery</strong>=True</li>
<li>Goto Mappings Tab and attach TemplateOutput to __DOCUMENT__</li>
<li>Click OK to Save</li>
</ol>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/01/MongoDB_Upsert_ArrayItem.zip">Download Sample SSIS Package (2012 format) &#8211; MongoDB_Upsert_ArrayItem</a></p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>MongoDB integration can be challenging if you are new to NoSQL world. If you are using SSIS as your primary ETL tool then not to worry because <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> can give super power needed to complete your project on time with drag and drop high performance connectors.</p>
<p>Keywords: ssis mongodb upsert array item | ssis mongodb update array item | ssis mongodb update array elements | mongodb update array documents | MongoDB $set operator | MongoDB $addToSet operator | MongoDB update sub document items | MongoDB CRUD operations | MongoDB Bulk Updates | MongoDB bulk updates to array items</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/update-insert-upsert-mongodb-array-items-ssis/">Update or Insert &#8211; Upsert MongoDB Array Items using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to convert Varbinary to Base64 in SSIS</title>
		<link>https://zappysys.com/blog/convert-varbinary-base64-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 30 Jan 2019 00:38:10 +0000</pubDate>
				<category><![CDATA[SSIS Set Variable Transform]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[SSIS Trash Destination]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6255</guid>

					<description><![CDATA[<p>Introduction In this post we will show you how to convert varbinary to Base64 in SSIS. We will use FREE Tasks provided by ZappySys. Preparing Sample Data First let&#8217;s create a sample table with some Varbinary datatype. Run following command in SSMS to create a sample table with one sample row. [crayon-69d4a66a4ca66885879305/] &#160; Method 1 [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/convert-varbinary-base64-ssis/">How to convert Varbinary to Base64 in SSIS</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 show you how to convert varbinary to Base64 in SSIS. We will use <a href="https://zappysys.com/free-ssis-transformations-components-tasks/">FREE Tasks</a> provided by ZappySys.</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Preparing Sample Data</h2>
<p>First let&#8217;s create a sample table with some Varbinary datatype. Run following command in SSMS to create a sample table with one sample row.</p><pre class="crayon-plain-tag">create table binarydata(
 data varbinary(max)
)
go
insert into binarydata(data )
values(0x5468697320697320612074657374) /*binary of "This is a test"*/</pre><p>
&nbsp;</p>
<h2>Method 1 &#8211; Using Template Transform</h2>
<p>Let&#8217;s use <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-template-transform.htm" target="_blank" rel="noopener">Template Transform</a> to convert Varbinary data to Base64 format. When you use columns with binary data in Template transform it automatically converts to Base64 by default.</p>
<ol>
<li>Go to Data flow</li>
<li>Drag your OLEDB Source and configure it to outputs SQL Data with Varbinary column  (e.g. select data from dbo.binarydata).</li>
<li>Now drag <strong>ZS Template Transform</strong> from SSIS Toolbox</li>
<li>Connect OLEDB Source to Template Transform</li>
<li>Double click Template Transform  to configure. Now you can click <strong>Insert Placeholders</strong> &gt; <strong>Columns</strong> &gt; Select your <strong>Upstream column</strong> name (which has Varbinary data)</li>
<li>You will see Template text as  &lt;%MyVarBinaryColumn%&gt;</li>
<li>Click OK to Save Template Transform</li>
<li>Now connect Template transform to any Destination e.g. OLEDB Destination.  You can <strong>Map TemplateOutput</strong> column to target column. This will contain Base64 representation of Varbinary data. For example purpose we used ZS Trash destination (Check save to file)</li>
</ol>
<p>&nbsp;</p>
<div id="attachment_6256" style="width: 644px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-convert-varbinary-to-base64.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6256" class="size-full wp-image-6256" src="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-convert-varbinary-to-base64.png" alt="Convert Varbinary to BASE64 using SSIS Template Transform" width="634" height="488" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-convert-varbinary-to-base64.png 634w, https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-convert-varbinary-to-base64-300x231.png 300w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-6256" class="wp-caption-text">Convert Varbinary to BASE64 using SSIS Template Transform</p></div>
<h3>Save Base64 string to Variable</h3>
<p>In previous step we saw how Template Transform can convert binary data (i.e. Varbinary datatype) to BASE64 string. Now let&#8217;s look at how to save this value to Variable using <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-set-variable-transform.htm" target="_blank" rel="noopener">Set Variable Transform</a>.</p>
<div id="attachment_6273" style="width: 673px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-set-variable-transform-convert-binary-to-base64.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6273" class="size-full wp-image-6273" src="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-set-variable-transform-convert-binary-to-base64.png" alt="Using SSIS Set Variable Transform in Data flow (Capture binary data as base64 example)" width="663" height="625" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-set-variable-transform-convert-binary-to-base64.png 663w, https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-set-variable-transform-convert-binary-to-base64-300x283.png 300w" sizes="(max-width: 663px) 100vw, 663px" /></a><p id="caption-attachment-6273" class="wp-caption-text">Using SSIS Set Variable Transform in Data flow (Capture binary data as base64 example)</p></div>
<h2>Method 2 &#8211; Using Trash Destination</h2>
<p>Another way to dump Binary data to CSV file is use ZS Trans Destination. See previous screenshot. If you map OLEDB Source directly to Trash destination without Template Transform then you will see something like below.</p><pre class="crayon-plain-tag">data
VGhpcyBpcyBhIHRlc3Q=</pre><p>
&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/convert-varbinary-base64-ssis/">How to convert Varbinary to Base64 in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS Magento data Read / Write using REST API Call</title>
		<link>https://zappysys.com/blog/ssis-magento-data-read-write-using-rest-api-call/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 01 Nov 2018 16:43:04 +0000</pubDate>
				<category><![CDATA[HTTP Connection]]></category>
		<category><![CDATA[REST API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Connection Manager]]></category>
		<category><![CDATA[SSIS CSV Source]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=5267</guid>

					<description><![CDATA[<p>Introduction In this post we will lean SSIS Magento data read / write operations. Magento is a very popular eCommerce platform and they offer JSON based REST API and XML based SOAP API. You can use either API based on your need to automate common integration needs. We recommend using REST API (JSON API) if possible [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-magento-data-read-write-using-rest-api-call/">SSIS Magento data Read / Write using REST API Call</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/2018/11/magento-logo.png"><img loading="lazy" decoding="async" class="wp-image-6392 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/11/magento-logo.png" alt="" width="124" height="112" /></a>In this post we will lean SSIS Magento data read / write operations. Magento is a very popular eCommerce platform and they offer <strong>JSON based REST API</strong> and <strong>XML based SOAP API</strong>. You can use either API based on your need to automate common integration needs.</p>
<p>We recommend using REST API (JSON API) if possible because they are simpler and faster. We will focus only on JSON API in this article but we do have blog post on <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">how to call SOAP API</a>.</p>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>About Calling Magento REST API</h2>
<p>If you are new to Magento API we highly recommend to get familiar with <a href="https://devdocs.magento.com/guides/v2.3/rest/tutorials/index.html" target="_blank" rel="noopener">Magento REST API here</a>. Magento REST API  offers two ways to authenticate.</p>
<ol>
<li><a href="https://devdocs.magento.com/guides/v2.1/get-started/authentication/gs-authentication-token.html" target="_blank" rel="noopener">Token based Authentication</a></li>
<li><a href="https://devdocs.magento.com/guides/v2.1/get-started/authentication/gs-authentication-oauth.html" target="_blank" rel="noopener">OAuth Based Authentication (OAuth 1.0a)</a></li>
</ol>
<p>In this article we will look at only Token based approach. In token based approach we have to get new token using admin / customer account information.</p>
<p>We will cover later how to access admin or customer level API later in this article (See HTTP connection configuration).</p>
<h2>Configure Connection / Call Magento REST API in SSIS</h2>
<p>Now lets look at very simple example how to use Token based method to call Magento REST API in SSIS. We will first configure HTTP connection and then call REST API.</p>
<p>Let&#8217;s get started.</p>
<ol>
<li>First, open SSIS Package after installing <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a></li>
<li>Drag <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS Toolbox on Control Flow Designer. Let&#8217;s rename task to <strong>Get Magento Categories</strong></li>
<li>Enter REST API URL you like to call. For example we can use below URL. Replace **<strong>your-magento-host**</strong> with your own name.<br />
<pre class="crayon-plain-tag">http://**your-magento-host**/index.php/rest/V1/categories</pre>
</li>
<li>Select <strong>Url from Connection</strong> mode</li>
<li>From Connection Dropdown select <strong>new ZS-HTTP</strong> connection
<div id="attachment_5269" style="width: 477px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-connection-rest-api-task.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5269" class="size-full wp-image-5269" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-connection-rest-api-task.png" alt="Create new connection for SSIS REST API Task" width="467" height="267" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-connection-rest-api-task.png 467w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-connection-rest-api-task-300x172.png 300w" sizes="(max-width: 467px) 100vw, 467px" /></a><p id="caption-attachment-5269" class="wp-caption-text">Create new connection for SSIS REST API Task</p></div></li>
<li>Configure General Tab of HTTP Connection like below<br />
URL can be anything for now because we will use override option in next step (On REST API Task).</li>
<li>Select Credentials Type as <a href="https://zappysys.com/blog/call-soap-rest-api-using-dynamic-token-ssis/">Dynamic Token</a>.</li>
<li>Enter Userid / password
<div id="attachment_5268" style="width: 730px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5268" class="size-full wp-image-5268" src="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method.png" alt="Configure Magento REST API Connect for Token based Authentication" width="720" height="483" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method.png 720w, https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method-300x201.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method-272x182.png 272w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-5268" class="wp-caption-text">Configure Magento REST API Connect for Token based Authentication</p></div></li>
<li>Now goto Dynamic Token Tab (Or click <strong>Configure</strong> Link) and configure like below.</li>
<li>Enter Token URL for API Login URL field.<br />
<strong>NOTE</strong>: If you are a customer and want to access your own account (e.g. view your orders) then replace <strong>/admin</strong> with <strong>/customer</strong>  in URL)<br />
Replace <strong>**my-host**</strong> with your host name.<br />
<pre class="crayon-plain-tag">http://***my-host***/index.php/rest/V1/integration/admin/token</pre>
</li>
<li>Change Method to POST.</li>
<li>Enter Body as below (Placeholders are automatically replaced when /token endpoint is called.<br />
<pre class="crayon-plain-tag">{&quot;username&quot;:&quot;[$userid$]&quot;, &quot;password&quot;:&quot;[$password$]&quot;}</pre>
</li>
<li>Select Content Type as Application/Json
<div id="attachment_5270" style="width: 849px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5270" class="size-full wp-image-5270" src="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract.png" alt="Configure Magento Token Request" width="839" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract.png 839w, https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract-300x216.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract-768x552.png 768w" sizes="(max-width: 839px) 100vw, 839px" /></a><p id="caption-attachment-5270" class="wp-caption-text">Configure Magento Token Request</p></div></li>
<li>Now click Dynamic Token &#8211; Response Tab and configure like below.<br />
Select <strong>Regex</strong> and enter Expression as below. This will remove double quotes around token in response.<br />
<pre class="crayon-plain-tag">&quot;(.*)&quot;{{0,1}}</pre>
<div id="attachment_5272" style="width: 541px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/regex-remove-double-quotes-around-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5272" class="size-full wp-image-5272" src="https://zappysys.com/blog/wp-content/uploads/2018/11/regex-remove-double-quotes-around-value.png" alt="Extract Token from response - Remove double quotes around value using Regular Expression" width="531" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/regex-remove-double-quotes-around-value.png 531w, https://zappysys.com/blog/wp-content/uploads/2018/11/regex-remove-double-quotes-around-value-300x218.png 300w" sizes="(max-width: 531px) 100vw, 531px" /></a><p id="caption-attachment-5272" class="wp-caption-text">Extract Token from response &#8211; Remove double quotes around value using Regular Expression</p></div></li>
<li>Click OK to save connection</li>
<li>Now on REST API Task check <strong>Use Direct URL</strong> Option</li>
<li>Click Test Request to confirm its working
<div id="attachment_5273" style="width: 752px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-call-magento-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5273" class="size-full wp-image-5273" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-call-magento-rest-api.png" alt="Call Magento REST API using SSIS REST API Task" width="742" height="701" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-call-magento-rest-api.png 742w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-call-magento-rest-api-300x283.png 300w" sizes="(max-width: 742px) 100vw, 742px" /></a><p id="caption-attachment-5273" class="wp-caption-text">Call Magento REST API using SSIS REST API Task</p></div></li>
</ol>
<p>&nbsp;</p>
<h2>Read data from Magento and Load into SQL Server</h2>
<p>Now lets look at how to read Magento data and load into SQL Server. Assume that you like to read all products.</p>
<h3>Configure JSON Source (Read Magento REST API)</h3>
<ol>
<li>Drag Data flow and double click to edit:
<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>Drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> on data flow and double click to edit</li>
<li>Configure JSON Source like below if you like to get product list for example
<ol>
<li>Enter URL as below (change http to https if your host support secure channel).<br />
<pre class="crayon-plain-tag">http://***yourhost***/index.php/rest/V1/products?searchCriteria[pageSize]=1000
--- to extract only specific fields do below way --
http://***yourhost***/index.php/rest/V1/products?searchCriteria[pageSize]=1000&amp;fields=items[sku,name]</pre>
</li>
<li>Check Use Credentials. Use same HTTP connection we created in previous section</li>
<li>In the Filter enter <strong>$.items[*]</strong> or click Select Filter to Browse and select items node.</li>
<li>Click Preview to confirm</li>
</ol>
</li>
<li>Here is how your setup will look like after configuration.
<div id="attachment_6525" style="width: 871px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6525" class="size-full wp-image-6525" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api.png" alt="SSIS JSON Source Configuration - Read data from Magento REST API" width="861" height="517" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api.png 861w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api-300x180.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api-768x461.png 768w" sizes="(max-width: 861px) 100vw, 861px" /></a><p id="caption-attachment-6525" class="wp-caption-text">SSIS JSON Source Configuration &#8211; Read data from Magento REST API</p></div></li>
<li>If you expecting more than 1000 rows then you have to set up pagination. Now go to <strong>pagination tab</strong> and configure as below (Below options are only available <a href="https://zappysys.com/blog/ssis-powerpack-v2-9-1/" target="_blank" rel="noopener">in v2.9.1 or higher</a>). If you have older version then check next section for workaround.
<ol>
<li>Pagination Mode =<strong>URL Parameter Mode</strong></li>
<li>Page Num Indicator = <strong>searchCriteria[currentPage]</strong></li>
<li>Max Rows Expression = <strong>$.total_count</strong></li>
<li>Page Data Expression = <strong>$.items[*]</strong></li>
</ol>
</li>
<li>Here is how your Magento REST API Pagination Setup will look like.
<div id="attachment_6526" style="width: 578px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/rest-api-pagination-by-max-row-count.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6526" class="size-full wp-image-6526" src="https://zappysys.com/blog/wp-content/uploads/2018/11/rest-api-pagination-by-max-row-count.png" alt="REST API Pagination using Max Row count Mode" width="568" height="376" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/rest-api-pagination-by-max-row-count.png 568w, https://zappysys.com/blog/wp-content/uploads/2018/11/rest-api-pagination-by-max-row-count-300x199.png 300w" sizes="(max-width: 568px) 100vw, 568px" /></a><p id="caption-attachment-6526" class="wp-caption-text">REST API Pagination using Max Row count Mode</p></div></li>
<li>Click OK to save JSON Source. In next section we will see how to load data into Target like SQL Server.</li>
</ol>
<h3>Configure OLEDB Destination (Load into SQL Server)</h3>
<ol>
<li>Drag OLEDB Destination.</li>
<li>Select / Create Connection</li>
<li>Select or create NEW target Table (Click NEW button)</li>
<li>Click Mapping Tab to map source columns to target table</li>
<li>Click OK to save</li>
<li>Execute Package</li>
</ol>
<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>Configure Magento Pagination (For Old Version)</h2>
<p>In previous section we configured pagination using newer version (v2.9.1 or higher). But what if you have older version and you dont see that feature. Use below steps for workaround.</p>
<p>Now let&#8217;s look at another common scenario when you real lots of data. Let&#8217;s say you have 5000 products but API call we saw earlier returns max 1000 rows. In that case we have to keep reading next page until all rows are returned. ZappySys provides many settings to configure various REST APIs out there, unfortunately there is no standard around pagination methods. Since Magento API has <a href="https://github.com/magento/magento2/issues/8099" target="_blank" rel="noopener">some bug in API pagination</a> we have to do following hack. Magento keep sending same data of last page if you try to access page which doesn&#8217;t exists. Here is how to overcome that bug.</p>
<h3>Configure REST API task to get total row count</h3>
<p>First step to configure magento pagination is get total rows returned in our request which you like to paginate (in our case <strong>/products</strong>).</p>
<ol>
<li>Go to Control Flow designer</li>
<li>Drag <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS Toolbox</li>
<li>Let&#8217;s rename task to <strong>Get Magento Product Count</strong></li>
<li>Double click it and configure like below (Change HTTP to HTTPS if needed)<br />
<pre class="crayon-plain-tag">http://***yourhost***/index.php/rest/V1/products?searchCriteria[pageSize]=10</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-get-magento-result-count-for-pagination.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6387" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-get-magento-result-count-for-pagination.png" alt="" width="734" height="497" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-get-magento-result-count-for-pagination.png 734w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-get-magento-result-count-for-pagination-300x203.png 300w" sizes="(max-width: 734px) 100vw, 734px" /></a></li>
<li>Go to Response Tab and configure like below. Enter expression as $.total_count<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-rest-api-task-save-variable.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6388" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-rest-api-task-save-variable.png" alt="" width="672" height="297" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-rest-api-task-save-variable.png 672w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-rest-api-task-save-variable-300x133.png 300w" sizes="(max-width: 672px) 100vw, 672px" /></a></li>
<li>Click OK to save</li>
</ol>
<p>&nbsp;</p>
<h3>Define Expression for JSON Source &#8211; MaxRows Property</h3>
<p>Now next step is to define expression on MaxRows property of JSON Rows so we stop once all rows consumed from Paginated response. If you don&#8217;t do this it will keep paginating forever 🙁</p>
<ol>
<li>On Control Flow designer <strong>select Data Flow</strong> which contains JSON Source for Magento</li>
<li>Right click and go to Properties of that data flow</li>
<li>Find Expression and click Button to add new expression</li>
<li>On Expression dialogbox select [Your JSON Source].[MaxRows] and for expression enter variable name which holds total count (e.g. <strong>@[User::MaxRows]</strong> )<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-dataflow-expression-json-source-maxrows.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6391" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-dataflow-expression-json-source-maxrows.png" alt="" width="666" height="328" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-dataflow-expression-json-source-maxrows.png 666w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-dataflow-expression-json-source-maxrows-300x148.png 300w" sizes="(max-width: 666px) 100vw, 666px" /></a></li>
<li>Click OK to Save</li>
</ol>
<h3>Configure JSON Source for Magento Pagination</h3>
<p>Now last thing we have to do is go to JSON Source and configure few things for pagination.</p>
<ol>
<li>Go to data flow and double click JSON Source</li>
<li>Click on <strong>Pagination tab</strong> and select Pagination by <strong>URL Parameter Mode</strong></li>
<li>Enter Page name as below<br />
<pre class="crayon-plain-tag">searchCriteria[currentPage]</pre>
</li>
<li>Click OK to save UI</li>
<li>Now <strong>run entire page to test</strong> (NOTE: Do not execute just data flow because if you do that way, it will not extract total row count)<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6394" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination.png" alt="" width="784" height="548" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination.png 784w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination-300x210.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination-768x537.png 768w" sizes="(max-width: 784px) 100vw, 784px" /></a></li>
</ol>
<h2>Write data to Magento using SSIS Web API destination</h2>
<p>Now let&#8217;s look at example to load data into Magento. In below example we will create few sample products.</p>
<ol>
<li>Create new data flow and go to data flow designer</li>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">ZS CSV Source</a> from SSIS toolbox. You can use any Data source but for simple demo we will use it.</li>
<li>Double click CSV source and select Direct Value mode from dropdown. Enter following sample data (Lets create 12 sample products.)<br />
<pre class="crayon-plain-tag">SKU,ProductName
PROD-1,Product 1
PROD-2,Product 2
PROD-3,Product 3
PROD-4,Product 4
PROD-5,Product 5
PROD-6,Product 6
PROD-7,Product 7
PROD-8,Product 8
PROD-9,Product 9
PROD-10,Product 10
PROD-11,Product 11
PROD-12,Product 12</pre>
</li>
<li>Now click OK to save UI</li>
<li>Now drag <strong>ZS Template Transform</strong> from toolbox.</li>
<li>Connect CSV Source to Template Transform</li>
<li>Enter following sample text to build request for new product. Refer to <a href="https://devdocs.magento.com/guides/v2.3/rest/tutorials/configurable-product/create-simple-products.html">Magento API help file / tutorial</a> to learn more.<br />
<pre class="crayon-plain-tag">{
  "product": {
    "sku": "&lt;%SKU%&gt;",
    "name": "&lt;%ProductName%&gt;",
    "attribute_set_id": 4,
    "price": 25,
    "status": 1,
    "visibility": 1
   }
}</pre>
</li>
<li>Notice that when you click <strong>Insert Variable</strong> &gt; <strong>Columns</strong> &gt; select desired upstream column placeholder. You can also encode special characters in your data (e.g. new lines) using function like &lt;%MyColumn,JSONENCODE%&gt;<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-create-new-product-api-request-template-transform.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6389" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-create-new-product-api-request-template-transform.png" alt="" width="729" height="493" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-create-new-product-api-request-template-transform.png 729w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-create-new-product-api-request-template-transform-300x203.png 300w" sizes="(max-width: 729px) 100vw, 729px" /></a></li>
<li>Click OK and save UI</li>
<li>Now drag ZS Web API Destination from SSIS Toolbox. Configure like below.Enter URL same as before (used to read product), change Method to <strong>POST</strong>, change content type to Application/JSON.<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6390" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api.png" alt="" width="778" height="660" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api.png 778w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api-300x254.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api-768x652.png 768w" sizes="(max-width: 778px) 100vw, 778px" /></a></li>
<li>Now run entire flow (You can watch your API <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">requests in Fiddler</a> for debugging)</li>
</ol>
<h2>Debug Magento Web Requests using Fiddler</h2>
<p>Click on below article to learn how to debug web requests</p>
<blockquote class="wp-embedded-content" data-secret="dKZ26bWM7i"><p><a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/">How to use Fiddler to analyze HTTP Web Requests</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" src="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/embed/#?secret=dKZ26bWM7i" data-secret="dKZ26bWM7i" width="600" height="338" title="&#8220;How to use Fiddler to analyze HTTP Web Requests&#8221; &#8212; ZappySys Blog" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>&nbsp;</p>
<h2>Magento Integration in Other Apps (e.g. Power BI / Informatica / SQL Server)</h2>
<p>You can use techniques listed on this page with <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ODBC Drivers</a> too for integration in other tools like Power BI, SQL Server code, Informatica etc.</p>
<h2>Conclusion</h2>
<p>In this post we saw how easy it is to perform Magento Integration in SSIS without doing any programming. In few steps you can read or write data in Magento using <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> REST API components. Download FREE Trial and explore many other scenarios.</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/ssis-magento-data-read-write-using-rest-api-call/">SSIS Magento data Read / Write using REST API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Read / Write Zoho CRM data using SSIS REST API Call</title>
		<link>https://zappysys.com/blog/read-write-zoho-crm-data-using-ssis-rest-api-call/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 16 Feb 2018 04:21:06 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[SSIS XML Parser Transform]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[zoho]]></category>
		<category><![CDATA[zoho crm]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2625</guid>

					<description><![CDATA[<p>Introduction In this post, you will learn how to read / write Zoho CRM data using SSIS (Drag and drop approach without any coding).  We will use SSIS JSON/ REST API Source to extract data from Zoho API and use SSIS Web API Destination to write data to Zoho. We will look at step-by-step instructions to read Zoho CRM [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-write-zoho-crm-data-using-ssis-rest-api-call/">Read / Write Zoho CRM data using SSIS REST API Call</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/zoho-crm-connector/">API Connector for Zoho CRM Online</a> which makes it much simpler to <strong>Read/Write Zoho CRM 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>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-crm-api-integration-logo.jpg"><img loading="lazy" decoding="async" class=" wp-image-2655 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-crm-api-integration-logo.jpg" alt="" width="147" height="147" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-crm-api-integration-logo.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-crm-api-integration-logo-150x150.jpg 150w" sizes="(max-width: 147px) 100vw, 147px" /></a>In this post, you will learn how to read / write Zoho CRM data using SSIS (Drag and drop approach without any coding).  We will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON/ REST API Source</a> to extract data from Zoho API and use <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">SSIS Web API Destination</a> to write data to Zoho.</p>
<p>We will look at step-by-step instructions to read Zoho CRM data (e.g. Leads, Accounts, Contacts) and load into SQL Server Database Table. In the next section, we will look at Write scenario too.</p>
<p>Now let’s look at step-by-step approach to call Zoho API  using SSIS.</p>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Authentication Using Zoho V2 REST API (OAuth 2.0)</h2>
<p>Zoho recently released v2 API. It uses OAuth 2.0 instead of static Token based (described in the next section). OAuth approach is more secure an recommended. If you must use static token-method then check next section. Zoho may discontinue Token based method in future.</p>
<h3>Register Zoho OAuth App and get ClientID/ Secret (*** MUST READ ***)</h3>
<p><a href="https://zappysys.com/blog/register-oauth-app-zoho-api/" target="_blank" rel="noopener">Check this article</a> to register your OAuth App and obtain Client ID  /Client Secret</p>
<h3>Create Zoho OAuth Connection in SSIS (for API call)</h3>
<p>Once you create Zoho OAuth App now its time to call some Zoho API. We will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZappySys REST API Task</a> to make simple API call. In the next section we will see how to load data in SQL Server.</p>
<ol>
<li>Open SSIS Package and go to SSIS Designer (Control Flow)</li>
<li>Drag <strong>ZS REST API Task</strong> from Control Flow SSIS Toolbox as below
<div style="width: 565px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="Drag and drop SSIS REST API Task from SSIS Toolbox " width="555" height="199" /><p class="wp-caption-text">Drag and drop SSIS REST API Task from SSIS Toolbox</p></div></li>
<li>Double click the task to configure.</li>
<li>Change URL Access mode to <strong>URL from Connection</strong></li>
<li>Enter API <strong>URL</strong> you like to call. For example you can enter below<br />
<pre class="crayon-plain-tag">https://www.zohoapis.com/crm/v2/settings/modules</pre>
</li>
<li>Select <strong>New ZS-OAUTH</strong> connection from Connection drop down
<div id="attachment_8307" style="width: 511px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-rest-api-oauth-use-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8307" class="size-full wp-image-8307" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-rest-api-oauth-use-connection.png" alt="Call Zoho REST API using OAuth 2.0" width="501" height="406" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-rest-api-oauth-use-connection.png 501w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-rest-api-oauth-use-connection-300x243.png 300w" sizes="(max-width: 501px) 100vw, 501px" /></a><p id="caption-attachment-8307" class="wp-caption-text">Call Zoho REST API using OAuth 2.0</p></div></li>
<li>Configure your OAuth connection General Tab as below
<ol>
<li>OAuth Provider: <strong>Custom</strong></li>
<li>OAuth Version: <strong>OAuth2</strong></li>
<li><strong>Client Id</strong> , <strong>Client Secret </strong></li>
<li>Enter One Scope Per Line (For more info on scope <a href="https://www.zoho.com/crm/help/api/v2/#OAuth2_0" target="_blank" rel="noopener">read here</a>)<br />
<pre class="crayon-plain-tag">ZohoCRM.modules.READ
ZohoCRM.settings.READ</pre>
</li>
<li>Auth URL : <strong>https://accounts.zoho.com/oauth/v2/auth</strong></li>
<li>Token URL:  <strong><strong>https://accounts.zoho.com/oauth/v2/token</strong></strong><a href="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-configure-oauth-token-url-scopes.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-9617" src="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-configure-oauth-token-url-scopes.png" alt="" width="577" height="328" srcset="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-configure-oauth-token-url-scopes.png 577w, https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-configure-oauth-token-url-scopes-300x171.png 300w" sizes="(max-width: 577px) 100vw, 577px" /></a></li>
</ol>
</li>
<li>Configure Advanced tab as below
<ol>
<li>Enter Callback URL : <strong>https://zappysys.com/oauth</strong></li>
<li>Enter Extra Attribute for /Auth : <strong>access_type=offline&amp;prompt=consent</strong><br />
This is needed to obtain refresh_token (if you ommit this then only access_token returned which cannot be renewed once expired after 1hr)</p>
<div class="mceTemp"></div>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-oauth-redirect-callback-url.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-9618" src="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-oauth-redirect-callback-url.png" alt="" width="551" height="320" srcset="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-oauth-redirect-callback-url.png 551w, https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-oauth-redirect-callback-url-300x174.png 300w" sizes="(max-width: 551px) 100vw, 551px" /></a></li>
</ol>
</li>
<li>Now go back to general tab and <strong>Click Generate Token</strong>.
<div id="attachment_3349" style="width: 824px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-oauth-get-token-authenticate-for-rest-api-access.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3349" class="size-full wp-image-3349" src="https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-oauth-get-token-authenticate-for-rest-api-access.png" alt="Generate OAuth Token for Zoho CRM REST API Access" width="814" height="749" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-oauth-get-token-authenticate-for-rest-api-access.png 814w, https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-oauth-get-token-authenticate-for-rest-api-access-300x276.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/zoho-oauth-get-token-authenticate-for-rest-api-access-768x707.png 768w" sizes="(max-width: 814px) 100vw, 814px" /></a><p id="caption-attachment-3349" class="wp-caption-text">Generate OAuth Token for Zoho CRM REST API Access</p></div></li>
<li>Click OK to save the connection UI</li>
</ol>
<h3>Call Zoho API using OAuth Connection</h3>
<ol>
<li>On the REST API Task click Test Request / Response
<div id="attachment_3351" style="width: 790px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-zoho-rest-api-using-oauth.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3351" class="size-full wp-image-3351" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-zoho-rest-api-using-oauth.png" alt="SSIS REST API Task - Call Zoho REST API in SSIS (OAuth 2.0) " width="780" height="679" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-zoho-rest-api-using-oauth.png 780w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-zoho-rest-api-using-oauth-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-zoho-rest-api-using-oauth-768x669.png 768w" sizes="(max-width: 780px) 100vw, 780px" /></a><p id="caption-attachment-3351" class="wp-caption-text">SSIS REST API Task &#8211; Call Zoho REST API in SSIS (OAuth 2.0)</p></div></li>
</ol>
<h2>Read data from Zoho Table in SSIS JSON Source</h2>
<p>In this section we will learn how to read data from Zoho using SSIS JSON Source. We will use OAuth connection created in earlier section.</p>
<p>Now lets look at step by step example of reading Zoho CRM data using SSIS (e.g. read Leads, Accounts, Contacts, Invoice etc). Zoho provides JSON API for read action so we will Use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a> for this purpose. Full sample package is attached at the end of this article but see below steps for high level configuration.</p>
<h3>Configure JSON Source</h3>
<p>So below steps shows example of reading from Zoho Lead modules using <a href="https://www.zoho.com/crm/developer/docs/api/get-records.html" target="_blank" rel="noopener">v2 records API Call</a>.</p>
<ol>
<li>Open SSIS Package</li>
<li>Drag data flow task from Control flow SSIS Toolbox
<div style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="Drag data flow from SSIS Toolbox" width="460" height="155" /><p class="wp-caption-text">Drag data flow from SSIS Toolbox</p></div></li>
<li>Go to data flow and drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> from SSIS Toolbox
<div style="width: 551px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="Drag and drop SSIS JSON Source (REST API or File)" width="541" height="144" /><p class="wp-caption-text">Drag and drop SSIS JSON Source (REST API or File)</p></div></li>
<li>Double click JSON Source to configure. Enter URL as below. You can supply few more parameters. <a href="https://www.zoho.com/crm/developer/docs/api/get-records.html" target="_blank" rel="noopener">Click Here to get full list of parameters and usage</a>. In below example we are reading records from Leads Module but you can replace Leads to something else (e.g. Accounts). Refer to above help link for available Modules.<br />
<pre class="crayon-plain-tag">https://www.zohoapis.com/crm/v2/Leads?per_page=200</pre>
</li>
<li>Check Use Credentials. Select OAuth connection manager we created in the previous section.</li>
<li>Under filter options tab, enter Array Filter as  <pre class="crayon-plain-tag">$.data[*]</pre></li>
<li>Now click Preview to see your data
<div id="attachment_8308" style="width: 947px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-extract-data-based-on-last-modified-date.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8308" class="size-full wp-image-8308" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-extract-data-based-on-last-modified-date.png" alt="Read data from Zoho API v2 using SSIS - OAuth (Use Last Modified Date for Incremental Extract)" width="937" height="806" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-extract-data-based-on-last-modified-date.png 937w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-extract-data-based-on-last-modified-date-300x258.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-extract-data-based-on-last-modified-date-768x661.png 768w" sizes="(max-width: 937px) 100vw, 937px" /></a><p id="caption-attachment-8308" class="wp-caption-text">Read data from Zoho API v2 using SSIS &#8211; OAuth (Use Last Modified Date for Incremental Extract)</p></div></li>
<li>Click OK to save UI. In the next section we will see how to setup pagination and incremental extract of Zoho records. After that we will see how to load data into SQL Server Table.</li>
</ol>
<h3>Zoho API Pagination (Read all rows)</h3>
<p>Just like most API zoho also uses pagination. See below for how to configure pagination in JSON Source for Zoho API.</p>
<ol>
<li>Double click JSON Source</li>
<li>Go to the <strong>Pagination</strong> Tab and select <strong>URL Parameter Mode</strong></li>
<li>For <strong>Page Num Indicator</strong> Enter <pre class="crayon-plain-tag">page</pre></li>
<li>For <strong>Last Page Detection</strong> select <pre class="crayon-plain-tag">Detect last page based on status code</pre></li>
<li>In the Status code field<br />
enter <strong>304</strong> (if you added If-Modified-Since header for incremental extract &#8211; See next section)<br />
enter <strong>204</strong> (if you do not add If-Modified-Since)</li>
</ol>
<p>Once you configure this way now your API will return all records until last page is detected. For more information on pagination <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">check this article</a></p>
<div id="attachment_8309" style="width: 674px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/pagination-stop-detect-based-on-status-code.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8309" class="size-full wp-image-8309" src="https://zappysys.com/blog/wp-content/uploads/2018/02/pagination-stop-detect-based-on-status-code.png" alt="Paginate Zoho API records" width="664" height="243" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/pagination-stop-detect-based-on-status-code.png 664w, https://zappysys.com/blog/wp-content/uploads/2018/02/pagination-stop-detect-based-on-status-code-300x110.png 300w" sizes="(max-width: 664px) 100vw, 664px" /></a><p id="caption-attachment-8309" class="wp-caption-text">Paginate Zoho API records</p></div>
<h3>Incremental Extract based on Last Modified Date/Time field</h3>
<p>Each module in Zoho has Last Modified By and LastModified Date/Time fields. You can filter extracted data for incremental extract by supplying <pre class="crayon-plain-tag">If-Modified-Since</pre>  HTTP header along with your request. Here is how to do.</p>
<ol>
<li>On the JOSN Source, click Raw Edit above HTTP Headers Grid.  We can define Header to extract data after last modified date. Skip this step if you like to extract all records.<br />
For example to read Lead records which are modified after 12/31/2019 you can enter header like below. Date/Time is UTC. When record is created Modified date is set as creation date too so this will include created records too.<br />
<pre class="crayon-plain-tag">If-Modified-Since: 2019-12-31T00:00:00</pre>
If you have local time saved in a variable and you like to use SSIS variable then you can use below way. In this example we converted Local time to UTC.<br />
<pre class="crayon-plain-tag">If-Modified-Since: &lt;&lt;{{User::varExtractDate,yyyy-MM-ddTHH:mm:ss}},FUN_TO_UTC_DATE&gt;&gt;</pre>
</li>
</ol>
<h2></h2>
<h3>Loading Zoho data into SQL Server Table / Other Target</h3>
<div class="content_block" id="custom_post_widget-5617"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination</strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.</p>
<h3>Step 1: Add Upsert Destination to Data Flow</h3>
<ol>
<li>Drag and drop the <strong>Upsert Destination</strong> component from the SSIS Toolbox.</li>
<li>Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png" /></a>
<p class="wp-caption-text">SSIS - Data Flow - Drang and Drop Upsert Destination Component</p>
</div>
<h3>Step 2: Configure Target Connection</h3>
<ol>
<li>Double-click the <strong>Upsert Destination</strong> component to open the configuration window.</li>
<li>Under <strong>Connection</strong>, select an existing target connection or click <strong>NEW</strong> to create a new connection.
<ul>
<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.</li>
</ul>
</li>
</ol>
<h3>Step 3: Select or Create Target Table</h3>
<ol>
<li>In the <strong>Target Table</strong> dropdown, select the table where you want to load data.</li>
<li>Optionally, click <strong>NEW</strong> to create a new table based on the source columns.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png" /></a>
<p class="wp-caption-text">Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS</p>
</div>
<h3>Step 4: Map Columns</h3>
<ol>
<li>Go to the <strong>Mappings</strong> tab.</li>
<li>Click <strong>Auto Map</strong> to map source columns to target columns by name.</li>
<li>Ensure you <strong>check the Primary key column(s)</strong> that will determine whether a record is inserted or updated.</li>
<li>You can manually adjust the mappings if necessary.</li>
</ol>
 <div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination - Columns Mappings</p>
</div>
<h3>Step 5: Save Settings</h3>
<ul>
<li>Click <strong>OK</strong> to save the Upsert Destination configuration.</li>
</ul>
<h3>Step 6: Optional: Add Logging or Analysis</h3>
<ul>
<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.</li>
</ul>
<h3>Step 7: Execute the Package</h3>
<ul>
<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.</li>
</ul>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination Execution</p>
</div></div>
<h3>Write data to Zoho CRM using OAuth 2.0</h3>
<p>If you like to load data from any source (i.e. SQL Server) to Zoho CRM then you can use <a href="https://www.zoho.com/crm/developer/docs/api/insert-records.html" target="_blank" rel="noopener">Records API (POST)</a>. Use combination of the following Transforms  / Components. Later in this article we have some more examples (Older API) which may give you one more ways to load data into Zoho (Use of Template Transform).</p>
<p>Basically you have to build POST Body using JSON Generator Transform or Template Transform and then use that data in Web API Destination to call POST API request to push data to Zoho.</p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr class="su-even">
<td width="36"><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png?w=32&amp;ssl=1" alt="Custom SSIS Tasks - Call REST API Webservice (GET, POST, DELETE etc)" width="32" height="32" /></td>
<td><u><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></u></td>
</tr>
<tr>
<td width="36" height="36"><img loading="lazy" decoding="async" class="alignnone" src="https://zappysys.com/images/SSIS-PowerPack/ssis-json-generator-transform.png" alt="JSON Generator Transform" width="32" height="32" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a></td>
</tr>
<tr class="su-even">
<td width="36"><img loading="lazy" decoding="async" class="alignnone" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-parser-transform/ssis-json-parser-transform.png" alt="XML Parser Transform" width="32" height="32" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></td>
</tr>
</tbody>
</table>
</div>
<div id="attachment_8312" style="width: 678px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-json-generator-single-dataset-zoho-write.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8312" class="size-full wp-image-8312" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-json-generator-single-dataset-zoho-write.png" alt="Create JSON for POST request (Single dataset pattern)" width="668" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-json-generator-single-dataset-zoho-write.png 668w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-json-generator-single-dataset-zoho-write-275x300.png 275w" sizes="(max-width: 668px) 100vw, 668px" /></a><p id="caption-attachment-8312" class="wp-caption-text">Create JSON for POST request (Single dataset pattern)</p></div>
<p>&nbsp;</p>
<div id="attachment_8313" style="width: 757px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-write-data-bulk-insert-leads-accounts.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8313" class="size-full wp-image-8313" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-write-data-bulk-insert-leads-accounts.png" alt="Insert data to Zoho Table using SSIS (Lead, Account Modules) - Bulk Load using POST API call" width="747" height="630" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-write-data-bulk-insert-leads-accounts.png 747w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-write-data-bulk-insert-leads-accounts-300x253.png 300w" sizes="(max-width: 747px) 100vw, 747px" /></a><p id="caption-attachment-8313" class="wp-caption-text">Insert data to Zoho Table using SSIS (Lead, Account Modules) &#8211; Bulk Load using POST API call</p></div>
<h2>Authentication Using Zoho Tokens</h2>
<p>If you don&#8217;t want to use a <a href="https://www.zoho.com/crm/help/api/v2/" target="_blank" rel="noopener">newer version of Zoho API</a> (v2) then you can use Token based Authentication method.</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;">Token based method will be depreciated soon so avoid it if possible. Use OAuth 2.0 described in the previous section whenever possible. </div></div>
<p>In Zoho Portal perform following steps to obtain API token</p>
<ol>
<li>Click on Setup (Toolbox icon at the top-right corner)</li>
<li>Search for &#8220;API&#8221; &gt; Select CRM API  or find under <strong>Developer space</strong> &gt; <strong>APIs</strong></li>
<li>Click on <strong>Gear icon</strong> found above Usage Panel (small icon so find carefully)</li>
<li>Click on <strong>Authentication Token generation</strong></li>
<li>Specify the APP Name and <strong>Click Generate</strong></li>
<li>This will direct to the new page which may contain text like below. Just copy AUTHTOKEN part (i.e. <strong>8a08xxxxxxxxxx13630d</strong> )<br />
<pre class="crayon-plain-tag">#
#Mon May 15 12:21:42 PDT 2017
AUTHTOKEN=8a083f76xxxxxxxxxxxxxxxxxxxdxxxxxxxx13630d
RESULT=TRUE</pre>
</li>
<li>Now use the newly created auth token to your API call.</li>
</ol>
<div id="attachment_2642" style="width: 1091px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-get-zoho-crm-api-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2642" class="size-full wp-image-2642" src="https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-get-zoho-crm-api-token.png" alt="How to get Zoho CRM API Token(For SSIS or other app integration)" width="1081" height="576" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-get-zoho-crm-api-token.png 1081w, https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-get-zoho-crm-api-token-300x160.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-get-zoho-crm-api-token-768x409.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-get-zoho-crm-api-token-1024x546.png 1024w" sizes="(max-width: 1081px) 100vw, 1081px" /></a><p id="caption-attachment-2642" class="wp-caption-text">How to get Zoho CRM API Token (For SSIS or other app integration)</p></div>
<p>&nbsp;</p>
<h3>Read data from Zoho using SSIS (Export Zoho CRM data to SQL Server Table)</h3>
<p>Now lets look at step by step example of reading Zoho CRM data using SSIS (e.g. read Leads, Accounts, Contacts, Invoice etc). Zoho provides JSON API for read action so we will Use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a> for this purpose. Full sample package is attached at the end of this article but see below steps for high level configuration.</p>
<p>So below steps shows example of reading Zoho Lead modules using <a href="https://www.zoho.com/crm/help/api/getrecords.html" target="_blank" rel="noopener">getRecords API Call</a>.</p>
<ol>
<li>Goto SSIS &gt; Variable and create a new string variable called token. Enter your Zoho API token as value (see previous section to get API token)</li>
<li>Drag data flow task from Control flow SSIS Toolbox</li>
<li>Go to data flow and drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> from SSIS Toolbox</li>
<li>Double click JSON Source to configure as below
<ol>
<li>Enter URL as below. Note that we have use Variable for Token to make URL dynamic.To read from different module change URL (e.g. rather than Leads in URL use Accounts).  <a href="https://www.zoho.com/crm/help/api/modules-fields.html" target="_blank" rel="noopener">Click Here to get full list of Modules and Fields</a><br />
<pre class="crayon-plain-tag">https://crm.zoho.com/crm/private/json/Leads/getRecords?newFormat=1&amp;authtoken={{User::token}}&amp;scope=crmapi&amp;fromIndex=0&amp;toIndex=200</pre>
You can also use lastModifiedTime parameter along leads modified after certain date/time (this time is <strong>Local time</strong> and not the UTC). To extract leads modified after certain date (Create a datetime variable called varExtractDate) and use it as below in the URL. You can use any <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm" target="_blank" rel="noopener">valid format specifiers for date time</a><br />
<pre class="crayon-plain-tag">https://crm.zoho.com/crm/private/json/Leads/getRecords?newFormat=1&amp;authtoken={{User::token}}&amp;scope=crmapi&amp;fromIndex=0&amp;toIndex=200&amp;lastModifiedTime={{User::varExtractDate,yyyy-MM-dd HH:mm:ss}}</pre>
</li>
<li>Click on the Select Filter and select node with Array icon as below. Each Module may have different structure for example for Leads module Filter may look like <strong>$.response.result.Leads.row[*]</strong>
<div id="attachment_2643" style="width: 1028px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-using-json-api-source-import-leads.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2643" class="size-full wp-image-2643" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-using-json-api-source-import-leads.png" alt="Configure SSIS JSON Source - Read Zoho CRM Leads (getRecords API call with lastModifiedDate Example)" width="1018" height="759" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-using-json-api-source-import-leads.png 1018w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-using-json-api-source-import-leads-300x224.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-using-json-api-source-import-leads-768x573.png 768w" sizes="(max-width: 1018px) 100vw, 1018px" /></a><p id="caption-attachment-2643" class="wp-caption-text">Configure SSIS JSON Source &#8211; Read Zoho CRM Leads (getRecords API call with lastModifiedDate Example)</p></div></li>
<li>Now go to 2D Array Tab and configure like below
<ol>
<li>Select Transform Type to Key/Value Pivot Mode.</li>
<li>Select or type Column Filter as <strong>$.FL[*].val</strong></li>
<li>Select or type Row Value Filter as <strong>$.FL[*].content</strong></li>
</ol>
</li>
<li>Once you configure 2D Array Transform click Preview to see sample data</li>
<li>.<a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-pivot-attributes-preview-leads.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2644" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-pivot-attributes-preview-leads.png" alt="" width="736" height="460" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-pivot-attributes-preview-leads.png 736w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-pivot-attributes-preview-leads-300x188.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-zoho-crm-data-pivot-attributes-preview-leads-436x272.png 436w" sizes="(max-width: 736px) 100vw, 736px" /></a></li>
<li>Click OK to save JSON Source and attach it to target such as SQL Server Destination like below.</li>
<li>Execute Package to test.
<div id="attachment_2645" style="width: 718px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-to-sql-server-data-table-loading-json-api-source-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2645" class="size-full wp-image-2645" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-to-sql-server-data-table-loading-json-api-source-example.png" alt="SSIS Example : Loading Zoho CRM data to SQL Server Table (JSON API Source)" width="708" height="343" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-to-sql-server-data-table-loading-json-api-source-example.png 708w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-to-sql-server-data-table-loading-json-api-source-example-300x145.png 300w" sizes="(max-width: 708px) 100vw, 708px" /></a><p id="caption-attachment-2645" class="wp-caption-text">SSIS Example : Loading Zoho CRM data to SQL Server Table (JSON API Source)</p></div></li>
</ol>
</li>
</ol>
<h2>Write data to Zoho using SSIS (Import SQL Server Table to Zoho CRM)</h2>
<p>Now you know how to read data from Zoho CRM using JSON API Source next step is to load data to Zoho CRM. For writing data we will use following three components</p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr class="su-even">
<td width="36"><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png?w=32&amp;ssl=1" alt="Custom SSIS Tasks - Call REST API Webservice (GET, POST, DELETE etc)" width="32" height="32" /></td>
<td><u><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></u></td>
</tr>
<tr>
<td width="36" height="36"></td>
<td>Template Transform</td>
</tr>
<tr class="su-even">
<td width="36"><img loading="lazy" decoding="async" class="alignnone" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-parser-transform/ssis-xml-parser-transform.png" alt="XML Parser Transform" width="32" height="32" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-parser-transform/" target="_blank" rel="noopener">XML Parser Transform</a></td>
</tr>
</tbody>
</table>
</div>
<p>For this example we will use hard coded data in CSV Source (Sample Leads ) but in real world you will have data coming from some RDBMS such as SQL Server.</p>
<ol>
<li>Drag Data flow Task and double click to go to Data flow designer.</li>
<li>Drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">ZS CSV Source</a> from the SSIS Toolbox. Change Access mode to Direct Value. Enter following sample data for demo.<br />
<pre class="crayon-plain-tag">Company,First Name,Last Name,Email,Lead Status,Lead Source,Phone
Microsoft,TestMaawia,TestBrito,Maawia@outlook.com,Lunk Lead,Web Download,111-111-3333
Microsoft,Testraja,Testvedaiyan,raja@outlook.com,Lunk Lead,Web Download,111-222-3333
Yahoo,TestJayder,Testelnageib,Jayder@outlook.com,Lunk Lead,Web Download,111-333-3333
Yahoo,TestStephen,TestTjebane,Stephen@outlook.com,Lunk Lead,Web Download,111-444-3333
Google,TestHarold,TestBatista,Harold@gmail.com,Lunk Lead,Web Download,111-555-3333
Google,TestVennon,TestMills,Vennon@gmail.com,Lunk Lead,Web Download,111-666-3333
Google,TestMichael,TestTremblay,Michael@gmail.com,Lunk Lead,Web Download,111-777-3333</pre>
</li>
<li>Now drag ZS Template Transform. Connect it with previous step.</li>
<li>Double click Template Transform to configure it with following sample Text (This transform was introduced in v2.6.6. If you dont see it then update your SSIS PowerPack to latest version). Use of XMLENC is optional for Non string columns or Alphanumeric values but if you not sure about column type then just add it anyways.<br />
<pre class="crayon-plain-tag">&lt;Leads&gt;
 &lt;row no="1"&gt;
  &lt;FL val="Lead Status"&gt;&lt;%Lead Status,XMLENC%&gt;&lt;/FL&gt;
  &lt;FL val="Company"&gt;&lt;%Company,XMLENC%&gt;&lt;/FL&gt;
  &lt;FL val="First Name"&gt;&lt;%First Name,XMLENC%&gt;&lt;/FL&gt;
  &lt;FL val="Last Name"&gt;&lt;%Last Name,XMLENC%&gt;&lt;/FL&gt;
  &lt;FL val="Email"&gt;&lt;%Email,XMLENC%&gt;&lt;/FL&gt;
  &lt;FL val="Phone"&gt;&lt;%Phone,XMLENC%&gt;&lt;/FL&gt;
  &lt;FL val="Lead Source"&gt;Web Download&lt;/FL&gt;
 &lt;/row&gt;
&lt;/Leads&gt;</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-create-xml-body.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2647" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-create-xml-body.png" alt="" width="922" height="762" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-create-xml-body.png 922w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-create-xml-body-300x248.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-create-xml-body-768x635.png 768w" sizes="(max-width: 922px) 100vw, 922px" /></a></li>
<li>Now drag another ZS Template Transform and connect it with previous step.</li>
<li>Double click Template Transform to configure. Enter below text. This is final text we will use as Request Body in the Web API Destination.<br />
<pre class="crayon-plain-tag">xmlData=&lt;%TemplateOutput,URLENC%&gt;</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-encode-post-xml-body.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2648" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-encode-post-xml-body.png" alt="" width="725" height="711" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-encode-post-xml-body.png 725w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-encode-post-xml-body-300x294.png 300w" sizes="(max-width: 725px) 100vw, 725px" /></a></li>
<li>Drag Microsoft Derived Column Transform. Connect with previous step and double click it to configure.</li>
<li>Select <strong>Replace &#8216;TemplateOutput&#8217;</strong> action. Type new column name in the first column e.g. <strong>TemplateOutput_Encoded</strong><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-derived-column-rename.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2649" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-derived-column-rename.png" alt="" width="849" height="386" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-derived-column-rename.png 849w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-derived-column-rename-300x136.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-api-derived-column-rename-768x349.png 768w" sizes="(max-width: 849px) 100vw, 849px" /></a></li>
<li>Now drag ZS Web API Destination, Connect with previous step and double click to configure as below.
<ol>
<li>Select New HTTP Connection. Enter some valid URL e.g. https://zoho.com  (This will be ignored anyways because we will use Dynamic URL on main UI)</li>
<li>Enter URL as below (see how we again added API token as dynamic variable) . If you inserting to different Module (e.g. Accounts rather than Leads then change accordingly).   <a href="https://www.zoho.com/crm/help/api/modules-fields.html" target="_blank" rel="noopener">Click Here to get full list of Modules and Fields</a><br />
<pre class="crayon-plain-tag">https://crm.zoho.com/crm/private/xml/Leads/insertRecords?newFormat=1&amp;authtoken={{User::token}}&amp;scope=crmapi&amp;duplicateCheck</pre>
</li>
<li>Select Input Body column as <strong>TemplateOutput_Encoded</strong></li>
<li>Enter Sample Body as below if you like to use Test feature else ignore this step. Click Test to see its working. Capture Response XML because you may need in the next step to feed as sample to XML Parser Transform (again optional step).<br />
<pre class="crayon-plain-tag">&lt;Leads&gt;
 &lt;row no="1"&gt;
  &lt;FL val="Lead Status"&gt;Junk Lead&lt;/FL&gt;
  &lt;FL val="Company"&gt;ABCD Inc&lt;/FL&gt;
  &lt;FL val="First Name"&gt;Bob&lt;/FL&gt;
  &lt;FL val="Last Name"&gt;Smith&lt;/FL&gt;
  &lt;FL val="Email"&gt;bob@abc.com&lt;/FL&gt;
  &lt;FL val="Phone"&gt;111-222-3333&lt;/FL&gt;
  &lt;FL val="Lead Source"&gt;Web Download&lt;/FL&gt;
 &lt;/row&gt;
&lt;/Leads&gt;</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-web-api-destination-post.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2650" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-web-api-destination-post.png" alt="" width="833" height="615" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-web-api-destination-post.png 833w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-web-api-destination-post-300x221.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-insert-leads-web-api-destination-post-768x567.png 768w" sizes="(max-width: 833px) 100vw, 833px" /></a></li>
</ol>
</li>
<li>Now once API destination is set we can optionally configure below steps if you want to store status and ID of newly created records. If you don&#8217;t care for that then skip below steps.</li>
<li>Drag ZS XML Parser Transform, Connect it Web API Destination (Response Output &#8211; Blue Arrow). Double click XML Parser to configure as below
<ol>
<li>Select Input XMl Column as <strong>ResponseText</strong></li>
<li>Enter Sample Text as below<br />
<pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;response uri="/crm/private/xml/Leads/insertRecords"&gt;
	&lt;result&gt;
		&lt;message&gt;Record(s) added successfully&lt;/message&gt;
		&lt;recorddetail&gt;
			&lt;FL val="Id"&gt;1558554000015597002&lt;/FL&gt;
			&lt;FL val="Created Time"&gt;2018-02-13 16:14:10&lt;/FL&gt;
			&lt;FL val="Modified Time"&gt;2018-02-13 16:14:10&lt;/FL&gt;
			&lt;FL val="Created By"&gt;
				&lt;![CDATA[ZappySys Support]]&gt;
			&lt;/FL&gt;
			&lt;FL val="Modified By"&gt;
				&lt;![CDATA[ZappySys Support]]&gt;
			&lt;/FL&gt;
		&lt;/recorddetail&gt;
	&lt;/result&gt;
&lt;/response&gt;</pre>
&nbsp;</li>
<li>Enter Filter as below<br />
<pre class="crayon-plain-tag">$.response.result.recorddetail[*]</pre>
</li>
<li><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-response-insert-leads-web-api-destination-extract-id.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2651" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-response-insert-leads-web-api-destination-extract-id.png" alt="" width="1042" height="534" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-response-insert-leads-web-api-destination-extract-id.png 1042w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-response-insert-leads-web-api-destination-extract-id-300x154.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-response-insert-leads-web-api-destination-extract-id-768x394.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-response-insert-leads-web-api-destination-extract-id-1024x525.png 1024w" sizes="(max-width: 1042px) 100vw, 1042px" /></a></li>
<li>Now Go to 2D Array Transform Tab. Configure as below</li>
<li>Select Transform Mode to <strong>Key/Value</strong></li>
<li>Column name filter as  <pre class="crayon-plain-tag">$.FL[:3].@val</pre></li>
<li>Row value filter as  <pre class="crayon-plain-tag">$.FL[:3].#text</pre><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-xml-api-response-extract-record-id.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2652" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-xml-api-response-extract-record-id.png" alt="" width="898" height="261" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-xml-api-response-extract-record-id.png 898w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-xml-api-response-extract-record-id-300x87.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-crm-parse-xml-api-response-extract-record-id-768x223.png 768w" sizes="(max-width: 898px) 100vw, 898px" /></a></li>
<li>Now click OK to close.</li>
</ol>
</li>
<li>Drag ZS Trash Destination or some other destination (e.g. SQL Server) and connect Red arrow coming from Web API destination to this component to capture any errors.</li>
<li>Thats it now you ready to run your SSIS sample package which Inserts Leads to Zoho CRM. See below for full package.</li>
</ol>
<div id="attachment_2653" style="width: 808px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-api-call-insert-records-leads.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2653" class="size-full wp-image-2653" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-api-call-insert-records-leads.png" alt="SSIS Example: Import data to Zoho CRM using SSIS Web API Destination (Loading Leads, Accounts, Contacts)" width="798" height="772" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-api-call-insert-records-leads.png 798w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-api-call-insert-records-leads-300x290.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-api-call-insert-records-leads-768x743.png 768w" sizes="(max-width: 798px) 100vw, 798px" /></a><p id="caption-attachment-2653" class="wp-caption-text">SSIS Example: Import data to Zoho CRM using SSIS Web API Destination (Loading Leads, Accounts, Contacts)</p></div>
<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>
<div class="content_block" id="custom_post_widget-2021"><h2>Things have gone bad: Error handling &amp; debugging</h2>
<p style="text-align: justify;">Incidentally, bad things can happen<i>. </i>A remote server may go offline or your server may go out of memory. In any case, you may want to know when that happens and take actions accordingly. For that purpose, you have to redirect bad rows to some other destination. For this example, we will take and use <em>Web API Destination</em>, but basically, you can use any SSIS component:</p>

<h3>Handling errors</h3>
<ol style="margin-left: 0;">
 	<li>Add a <em>Derived Column</em> above <em>Web API Destination</em> with expression <strong>"(DT_WSTR,4000)ZS_JSON_OUT"</strong> and name it <strong>"JsonAsString"</strong>. This will let you see what JSON you are actually passing.</li>
 	<li>Then add a database or file destination or use another <em>Trash Destination</em> for debugging purposes and redirect the bad rows (<span style="color: #d66565;">red arrow</span>) from <em><em>Web API Destination </em></em>into it<em><em>. </em></em>Don't forget to set <span class="lang:default decode:true crayon-inline">Redirect row</span> option for both, <em>Error</em> and <em>Truncation</em> columns:<em><em>
</em></em>
<div class="wp-caption">

<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1487 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" alt="Redirect bad rows from &lt;em&gt;Web API Destination&lt;/em&gt; to &lt;em&gt;Trash Destination&lt;/em&gt; when load from SQL Server to Elasticsearch is failing. Add derived column JsonAsString to be able to read JSON you are using." width="739" height="267" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png 739w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows-300x108.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></a>
<p class="wp-caption-text">Redirected failed requests from <em>Web API Destination</em> to a desired destination when loading from SQL Server to REST API Service is failing. Derived Column <em>JsonAsString</em> added to be able to read JSON which was passed to Elasticsearch</p>

</div></li>
 	<li>Finally, add a <a href="https://technet.microsoft.com/en-us/library/ms140318%28v=sql.90%29.aspx?f=255&amp;MSPPError=-2147217396" target="_blank" rel="noopener"><em>Data Viewer</em></a> for the red path, if you want to debug the flow. You will be able to see URL, JSON and the error message for each record. You may want to copy-paste <em>ErrorMessage</em> to <em>Notepad </em>if you want it to be more readable:
<div class="wp-caption">

<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1494 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" alt="Use Data Viewer to view HTTP requests that failed to be fulfilled in Elasticsearch" width="752" height="280" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png 752w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-300x112.png 300w" sizes="(max-width: 752px) 100vw, 752px" /></a>
<p class="wp-caption-text">Use Data Viewer to view HTTP requests that failed to be fulfilled.</p>

</div></li>
</ol>
<div class="su-note" style="border-color: #e5dea5; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;">
<div class="su-note-inner su-clearfix" style="background-color: #fff7b7; border-color: #fffdf1; color: #333333; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;"><strong>NOTE</strong>: You can read more about redirecting rows in <a href="//zappysys.com/blog/ssis-error-handling-in-data-flow-redirect-bad-rows/" target="_blank" rel="noopener">SSIS Error Handling (Redirect bad rows)</a> article.</div>
</div>
<h3>Debugging HTTP requests</h3>
<p style="text-align: justify;">A common thing you have to do when working with HTTP requests is to debug those requests; e.g. to check what headers, body or URL was passed. <span id="Debug_Web_API_call_using_Fiddler"></span>To test how things look behind the scenes we strongly suggest to use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a> - a popular web debugging tool.</p>
<p style="text-align: justify;">Inside it, you can double-click the URL entry (Right side) to see Request and Response Panels. The top panel is Request (URL, Headers, Body) and Bottom Panel is Response. For https:// (secure URL) make sure you enable HTTPS option in Fiddler (Tools &gt; Options &gt; HTTPS &gt; Check Decrypt https request):</p>

<div id="attachment_2344" class="wp-caption alignnone">

<a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-2344 size-full" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png" alt="Debugging Web API call using Fiddler in SSIS" width="1287" height="564" data-attachment-id="2344" data-permalink="https://zappysys.com/blog/pass-authorization-header-redirected-location/ssis-rest-api-call-debug-via-fiddler/#main" data-orig-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=1287%2C564&amp;ssl=1" data-orig-size="1287,564" 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-rest-api-call-debug-via-fiddler" data-image-description="&lt;p&gt;Debugging Web API call using Fiddler in SSIS&lt;/p&gt; " data-medium-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=300%2C131&amp;ssl=1" data-large-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=720%2C316&amp;ssl=1" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png 1287w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-300x131.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-768x337.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-1024x449.png 1024w" sizes="(max-width: 1287px) 100vw, 1287px" /></a>
<p class="wp-caption-text">Debugging Web API call using Fiddler in SSIS</p>

</div></div>
<h2>Sample SSIS Package Download</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/SSIS-ZohoCRM-ReadWrite.zip">Click here to download sample package (SSIS 2012 or Higher).</a></p>
<h2>Conclusion</h2>
<p>Zoho CRM API provides great way to automate data read/write operations. However to call Zoho API  you have to use SDK / coding approach (e.g. C#, Java, Python, Ruby). Luckily ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> provides great way to integrate any Zoho API call via simple drag and drop approach without coding. Try  <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> for free and call virtually any REST API in few clicks.</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/read-write-zoho-crm-data-using-ssis-rest-api-call/">Read / Write Zoho CRM data using SSIS REST API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Read / Write Smartsheet data using SSIS REST API Call</title>
		<link>https://zappysys.com/blog/read-write-smartsheet-data-using-ssis-rest-api-call/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 07 Feb 2018 23:27:38 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[smartsheet]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2588</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to Read / write Smartsheet data using SSIS (Drag and drop approach without any coding).  We will use SSIS JSON/ REST API Source to extract data from Smartsheet API and use SSIS Web API Destination to write data to Smartsheet. This approach is similar to our previous [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-write-smartsheet-data-using-ssis-rest-api-call/">Read / Write Smartsheet data using SSIS REST API Call</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/2018/02/smartsheet-api-integration-logo.png"><img loading="lazy" decoding="async" class="wp-image-2606 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-api-integration-logo.png" alt="Smartsheet REST API Integration" width="126" height="126" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-api-integration-logo.png 280w, https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-api-integration-logo-150x150.png 150w" sizes="(max-width: 126px) 100vw, 126px" /></a>In this post you will learn how to Read / write Smartsheet data using SSIS (Drag and drop approach without any coding).  We will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON/ REST API Source</a> to extract data from Smartsheet API and use <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">SSIS Web API Destination</a> to write data to Smartsheet. This approach is similar to our previous blog where we described <a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/" target="_blank" rel="noopener">how to read and write Google sheet using SSIS</a></p>
<p>Now let&#8217;s look at step by step approach to call Smartsheet REST API.</p>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:</p>
<ol style="margin-left: 1.5em;">
<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven&#8217;t already).</li>
<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol>
</div>
<h2>Create Token to access Smartsheet REST API</h2>
<p>First step to access smartsheet API in SSIS is create API Token. We will use this API token later on to read data from Smartsheet Sheet.</p>
<ol>
<li>Login to your Smartsheet account</li>
<li>Click on Account &gt; Apps &amp; Integrations &gt; Click API Access &gt; Click Generate Token
<div id="attachment_2599" style="width: 315px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-create-api-access-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2599" class="size-full wp-image-2599" src="https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-create-api-access-token.png" alt="Create Smartsheet API Token for REST API Access" width="305" height="257" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-create-api-access-token.png 305w, https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-create-api-access-token-300x253.png 300w" sizes="(max-width: 305px) 100vw, 305px" /></a><p id="caption-attachment-2599" class="wp-caption-text">Create Smartsheet API Token for REST API Access (Step 1)</p></div>
<div id="attachment_2600" style="width: 604px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-rest-api-access-create-new-access-token-step-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2600" class="size-full wp-image-2600" src="https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-rest-api-access-create-new-access-token-step-2.png" alt="Generate new Smartsheet token (Step 2)" width="594" height="354" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-rest-api-access-create-new-access-token-step-2.png 594w, https://zappysys.com/blog/wp-content/uploads/2018/02/smartsheet-rest-api-access-create-new-access-token-step-2-300x179.png 300w" sizes="(max-width: 594px) 100vw, 594px" /></a><p id="caption-attachment-2600" class="wp-caption-text">Generate new Smartsheet token (Step 2)</p></div></li>
<li>Once Token is generated copy that for later use (Make sure you treat this token as password and do not share with unauthorized user.</li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2>Getting started with Smartsheet API</h2>
<p>In this article we will use few out of many API provided by Smartsheet. To get started with Smartsheet API concepts <a href="https://www.smartsheet.com/blog/api-getting-started" target="_blank" rel="noopener">click here</a>. To read full details about each Smartsheet API <a href="https://smartsheet-platform.github.io/api-docs/" target="_blank" rel="noopener">click here</a>.</p>
<h2>Step-By-Step &#8211; Import/Export Smartsheet data in SSIS</h2>
<p>Now lets see how to read and write smartsheet data using SSIS.</p>
<h3>Read data from Smartsheet using SSIS JSON / REST API Source (Load Smartsheet to SQL Server)</h3>
<p>To read data from smartsheet you need to perform following steps.</p>
<p><strong>Find Sheet ID for Smartsheet API access</strong></p>
<ol>
<li>First you need to know how to find Sheet ID. Perform below steps to find Sheet ID.</li>
<li>Goto your portal and open sheet you like to read. Right click on the Sheet Tab &gt; Click Properties and Copy Sheet ID
<div id="attachment_2601" style="width: 377px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-find-smartsheet-id-for-rest-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2601" class="size-full wp-image-2601" src="https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-find-smartsheet-id-for-rest-api-call.png" alt="Find Sheet ID for Smartsheet API call" width="367" height="127" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-find-smartsheet-id-for-rest-api-call.png 367w, https://zappysys.com/blog/wp-content/uploads/2018/02/how-to-find-smartsheet-id-for-rest-api-call-300x104.png 300w" sizes="(max-width: 367px) 100vw, 367px" /></a><p id="caption-attachment-2601" class="wp-caption-text">Find Sheet ID for Smartsheet API call</p></div></li>
</ol>
<p>Once you know Sheet ID. Now lets create SSIS package to extract data from Smartsheet and load into SQL Server.</p>
<ol>
<li>Create new SSIS Package or Open existing one.</li>
<li>From control flow SSIS toolbox drag Data Flow task</li>
<li>Double click Data flow</li>
<li>From SSIS Toolbox drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source (for REST API / File)</a></li>
<li>Double click JSON Source and configure following properties
<ol>
<li>Enter Shartsheet API Access URL as below (Change last part with your own sheet id)<br />
<pre class="crayon-plain-tag">https://api.smartsheet.com/2.0/sheets/YOUR-SHEET-ID-GOES-HERE</pre>
</li>
<li>Check use credentials and then create a new HTTP connection. Select Static Token / API Key and enter enter your token we got in previous section<br />
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2022/09/smartsheetconnection.png" /></li>
<li>Click on Select Filter and pick Rows node or just type below text in the Filter textbox<br />
<pre class="crayon-plain-tag">$.rows[*]</pre>
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2022/09/smartsheetconnection-1.png" /></li>
<li>Now goto 2D Array Transformation Tab and set following settings
<ol>
<li>Set Transformation Type to <strong>Complex 2-dimensional array</strong></li>
<li>Column Name Filter to <strong>$.columns[*].title</strong></li>
<li>Row Value Filter to <strong>$.cells[*].value<br />
</strong></p>
<div id="attachment_2605" style="width: 700px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-smartsheet-data-configure-array-transform-json-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2605" class="size-full wp-image-2605" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-smartsheet-data-configure-array-transform-json-source.png" alt="SSIS Smartsheet API Configuration - Complex Array transformation (Read nested array)" width="690" height="263" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-smartsheet-data-configure-array-transform-json-source.png 690w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-read-smartsheet-data-configure-array-transform-json-source-300x114.png 300w" sizes="(max-width: 690px) 100vw, 690px" /></a><p id="caption-attachment-2605" class="wp-caption-text">SSIS Smartsheet API Configuration &#8211; Complex Array transformation (Read nested array)</p></div></li>
</ol>
</li>
<li>Once everything is configured Click Preview. Click OK to save.</li>
<li>Drag OLEDB Destination from SSIS Toolbox.</li>
<li>Connect JSON SOurce to OLEDB Destination</li>
<li>Double click OLEDB Destination and configure connection (e.g. Select SQL Server connection) and select Target Table or click New to Create new Table based on Source columns.</li>
<li>Click on Mappings to map source columns to target</li>
<li>Click OK to save</li>
<li>Execute Package
<div id="attachment_2604" style="width: 880px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-smartsheet-to-sql-server-read-json-rest-api-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2604" class="size-full wp-image-2604" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-smartsheet-to-sql-server-read-json-rest-api-example.png" alt="SSIS Example : Loading Smartsheet data into SQL Server (REST API Call)" width="870" height="543" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-smartsheet-to-sql-server-read-json-rest-api-example.png 870w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-smartsheet-to-sql-server-read-json-rest-api-example-300x187.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-smartsheet-to-sql-server-read-json-rest-api-example-768x479.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-smartsheet-to-sql-server-read-json-rest-api-example-436x272.png 436w" sizes="(max-width: 870px) 100vw, 870px" /></a><p id="caption-attachment-2604" class="wp-caption-text">SSIS Example : Loading Smartsheet data into SQL Server (REST API Call)</p></div></li>
</ol>
</li>
</ol>
<p>&nbsp;</p>
<h3>Read Smartsheet data with Pagination option</h3>
<p>Smartsheet API support options to read large amount of data in small chunks by using <a href="https://smartsheet-platform.github.io/api-docs/#paging" target="_blank" rel="noopener">pagination options</a>. ZappySys offers <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">many ways to paginate</a> for various API.</p>
<h4>Disable Smartsheet Pagination</h4>
<p>Many API endpoints in Smartsheet by default send you paginated response. Pagination requires some extra configuration so try to disable it if possible by using <strong>includeAll=true</strong> option in your URL as below. If you cannot includeAll for some reason then perform steps listed in next section.</p><pre class="crayon-plain-tag">https://api.smartsheet.com/2.0/sheets?includeAll=true</pre><p>
<h4>Smartsheet Pagination in SSIS</h4>
<p>To paginate Smartsheet response in SSIS JSON Source perform the following steps. Below steps assume that you trying to get all sheets by calling <pre class="crayon-plain-tag">https://api.smartsheet.com/2.0/sheets</pre>  URL in JSON Source (Just like we explained in previous section). Before dataflow we have to add one step to enable pagination. Lets check.</p>
<ol>
<li>Go to Control Flow designer right click &gt; Select Variables</li>
<li>Create new <strong>string datatype</strong> variable called name it <strong>TotalPages</strong>. Set <strong>default value to 0</strong></li>
<li>Now drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS Toolbox</li>
<li>Enter Following URL (we don&#8217;t need many rows to so reduced default page size to just 10)<br />
<pre class="crayon-plain-tag">https://api.smartsheet.com/2.0/sheets?pageSize=10</pre>
</li>
<li>Now click on Raw Edit (Above Headers grid)</li>
<li>Enter following header (Replace Token with your own token we obtained in the previous section)<br />
<pre class="crayon-plain-tag">Authorization: Bearer YOUR-TOKEN-GOES-HERE</pre>
</li>
<li>Go to Response Settings Tab</li>
<li>Select Content Type Json and enter filter as <strong>$.totalPages</strong></li>
<li>Check Save response to Variable. Select Variable we created in Previous step (Only string datatype variables are visible)
<div id="attachment_2610" style="width: 932px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-save-rest-api-response-json-value-to-variable.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2610" class="size-full wp-image-2610" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-save-rest-api-response-json-value-to-variable.png" alt="Save Total Page Count to SSIS variable" width="922" height="293" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-save-rest-api-response-json-value-to-variable.png 922w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-save-rest-api-response-json-value-to-variable-300x95.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-save-rest-api-response-json-value-to-variable-768x244.png 768w" sizes="(max-width: 922px) 100vw, 922px" /></a><p id="caption-attachment-2610" class="wp-caption-text">Save Total Page Count to SSIS variable</p></div></li>
<li>Click Test Request/Response to confirm it works</li>
<li>Click OK to save</li>
<li>Now let&#8217;s use this variable to configure <strong>MaxPageNumber</strong> setting in JSON Source. Using following way you can make any Data flow component property dynamic.
<div id="attachment_2609" style="width: 1069px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-expression-on-data-flow-component.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2609" class="size-full wp-image-2609" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-expression-on-data-flow-component.png" alt="Define expression on SSIS Data flow Component Property (Dynamic Value)" width="1059" height="732" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-expression-on-data-flow-component.png 1059w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-expression-on-data-flow-component-300x207.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-expression-on-data-flow-component-768x531.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-expression-on-data-flow-component-1024x708.png 1024w" sizes="(max-width: 1059px) 100vw, 1059px" /></a><p id="caption-attachment-2609" class="wp-caption-text">Define expression on SSIS Data flow Component Property (Dynamic Value)</p></div></li>
<li>Now connect your REST API Task to Data flow</li>
<li>On the JSON Source go to Pagination Tab and enter following settings.
<div id="attachment_2611" style="width: 675px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-smartsheet-api-pagination-json-rest-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2611" class="size-full wp-image-2611" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-smartsheet-api-pagination-json-rest-source.png" alt="Smartsheet API Pagination settings - SSIS JSON / REST Source" width="665" height="275" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-smartsheet-api-pagination-json-rest-source.png 665w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-smartsheet-api-pagination-json-rest-source-300x124.png 300w" sizes="(max-width: 665px) 100vw, 665px" /></a><p id="caption-attachment-2611" class="wp-caption-text">Smartsheet API Pagination settings &#8211; SSIS JSON / REST Source</p></div></li>
<li>That&#8217;s it. Now if you run it you will see all records will be pulled.</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;">You can configure delay after each request [on Throttling Tab] if you want to slow down requests. This is usually helpful if you are getting too many API requests error at runtime.</div></div>
<h3>Write data to Smartsheet using SSIS Web API Destination (SQL Server to Smartsheet Import)</h3>
<p>Now lets see how to write some data to Smartsheet Sheet. We will read records from SQL Server and write to SmartSheet using ZS Web API Destination</p>
<p>For inserting multiple rows we can call <a href="https://smartsheet-platform.github.io/api-docs/#add-rows" target="_blank" rel="noopener">this Smartsheet API Endpoint</a></p>
<p>Basically High level steps are.</p>
<ol>
<li>Find out Smartsheet Column ID to use along with API call</li>
<li>Read Records from SQL Server using OLEDB Source</li>
<li>Construct desired JSON for Add New Row API Call</li>
<li>Send JSON to <a href="https://smartsheet-platform.github.io/api-docs/#add-rows" target="_blank" rel="noopener">Smartsheet Add Row API</a>  (Configure Bulk Options )</li>
</ol>
<h4>Find out Smartsheet Column ID</h4>
<p>Very first step you have to perform is get Column ID which correspond to certain title. You can use following URL endpoint to get list of all columns (Change your Sheet ID). Make sure you append <strong>includeAll=true</strong> else it may only fetch 100 columns. You can save Column result to some database table to File to copy ID. Preview Grid also allows to copy cell.</p><pre class="crayon-plain-tag">https://api.smartsheet.com/2.0/sheets/YOUR-SHEET-ID/columns?includeAll=true</pre><p>
<div id="attachment_2613" style="width: 770px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-get-smartsheet-column-id-api-call-json-rest-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2613" class="size-full wp-image-2613" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-get-smartsheet-column-id-api-call-json-rest-source.png" alt="Get Smartsheet Column ID using API call in SSIS JSON Source" width="760" height="734" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-get-smartsheet-column-id-api-call-json-rest-source.png 760w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-get-smartsheet-column-id-api-call-json-rest-source-300x290.png 300w" sizes="(max-width: 760px) 100vw, 760px" /></a><p id="caption-attachment-2613" class="wp-caption-text">Get Smartsheet Column ID using API call in SSIS JSON Source</p></div>
<h4>Configure SQL Server Source (OLEDB Source)</h4>
<p>Once you have column ID you can drag OLEDB Source from SSIS Toolbox and configure to read from SQL Server. Below is sample source query to extract data from SQL Server.</p><pre class="crayon-plain-tag">Select OrderID,CustomerID,EmployeeID,OrderDate from Orders</pre><p>
<h4>Configure SSIS Template Transform</h4>
<p>Once SQL Source is configure we are ready for next step. SSIS PowerPack v2.6.4 and later introduced new SSIS transform called <strong>Template Transform</strong>. This transform allows you to produce desired JSON /XML from single input record by using Column name as placeholder anywhere in your text. This is much simpler method than constructing JSON using JSON Generator Transform</p>
<p>Here is the sample JSON we want to produce to insert into Sheet which contains 4 columns OrderID, CustomerID, EmployeeID and OrderDate.</p><pre class="crayon-plain-tag">{
  "toTop": true,
  "cells": [
    {
      "columnId": 8146714579232644,
      "value": 10548
    },
    {
      "columnId": 828365184755588,
      "value": "TOMSP"
    },
    {
      "columnId": 5331964812126084,
      "value": 3
    },
    {
      "columnId": 3080164998440836,
      "value": "1997-05-26T00:00:00"
    }
  ]
}</pre><p>
&nbsp;</p>
<p>Now lets configure SSIS Template Transform to create desired JSON Request for API call.</p>
<ol>
<li>Drag ZS Template Transform from the SSIS toolbox</li>
<li>Connect OLEDB Source to ZS Template Transform</li>
<li>Double click Template Transform. Paste above sample request in the Template Text</li>
<li>Now highlight sample value you wish to replace from upstream by some input column.</li>
<li>Click on <strong>Insert Placeholders</strong> &gt; <strong>Columns</strong> &gt;  Your Column</li>
<li>Perform above steps for each value you wish to replace. You can also add <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm" target="_blank" rel="noopener">use placeholder functions</a> such as <strong>JSONENC</strong> after column name (useful if you expecting new line or special characters such as tab or double quotes in your input text ). Date formatting (e.g. <strong>yyyy-MM-dd </strong>) also allowed. See below example after placeholders added.<br />
<pre class="crayon-plain-tag">{
  "toTop": true,
  "cells": [
    {
      "columnId": 8146714579232644,
      "value": &lt;%OrderID%&gt;
    },
    {
      "columnId": 828365184755588,
      "value": "&lt;%CustomerID,JSONENC%&gt;"
    },
    {
      "columnId": 5331964812126084,
      "value": &lt;%EmployeeID%&gt;
    },
    {
      "columnId": 3080164998440836,
      "value": "&lt;%OrderDate,yyyy-MM-ddTHH:mm:ss%&gt;"
    }
  ]
}</pre>
</li>
<li>Here is final configuration of Template Transform
<div id="attachment_2614" style="width: 983px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2614" class="size-full wp-image-2614" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png" alt="Create JSON for API Request (POST) using SSIS Template Transform" width="973" height="611" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call.png 973w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call-300x188.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-template-transform-create-json-xml-for-api-call-768x482.png 768w" sizes="(max-width: 973px) 100vw, 973px" /></a><p id="caption-attachment-2614" class="wp-caption-text">Create JSON for API Request (POST) using SSIS Template Transform</p></div></li>
</ol>
<h4>Configure SSIS Web API Destination (POST New Rows to Smartsheet)</h4>
<p>Now lets configure last step. This will POST API request to insert multiple rows to Smartsheet. Previous template transform crafts request for one new row but later in this section we will enable Batch mode so we can JOIN multiple JSON and created Bulk requests in one go so we avoid many API call. Always use Bulk mode if API endpoint supports it.</p>
<ol>
<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> from SSIS Toolbox</li>
<li>Connect previous Template Transform to your Web API Destination.</li>
<li>Select new HTTP connection. When Prompted enter following URL on HTTP Connection UI (Replace your Sheet ID)<br />
<pre class="crayon-plain-tag">https://api.smartsheet.com/2.0/sheets/YOUR-SHEET-ID/rows</pre>
</li>
<li>In the input column for Body select <strong>TemplateOutput</strong></li>
<li>For Body you can enter Sample Body if you wish to Test at design time else leave it blank</li>
<li>Select Body Content Type as <strong>application/json</strong></li>
<li>In the Headers enter Authorization Header like we did in previous section (Read from Smartsheet)<br />
<pre class="crayon-plain-tag">Authorization: Bearer YOUR-TOKEN-GOES-HERE</pre>
<div id="attachment_2615" style="width: 823px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-web-api-destination-insert-multiple-rows-smartsheet-rest-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2615" class="size-full wp-image-2615" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-web-api-destination-insert-multiple-rows-smartsheet-rest-api-call.png" alt="Configure SSIS Web API Destination - Add / Insert Rows to Smartsheet (Bulk API call)" width="813" height="616" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-web-api-destination-insert-multiple-rows-smartsheet-rest-api-call.png 813w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-web-api-destination-insert-multiple-rows-smartsheet-rest-api-call-300x227.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-web-api-destination-insert-multiple-rows-smartsheet-rest-api-call-768x582.png 768w" sizes="(max-width: 813px) 100vw, 813px" /></a><p id="caption-attachment-2615" class="wp-caption-text">Configure SSIS Web API Destination &#8211; Add / Insert Rows to Smartsheet (Bulk API call)</p></div></li>
<li>Go to Batch Setting mode. Change following settings
<ol>
<li>Check on Enable submitting multiple records</li>
<li>For Body Header enter <strong>[</strong></li>
<li>For Body Footer enter  <strong>]</strong></li>
<li>For Body Row separator enter<strong> ,</strong> (i.e comma)</li>
<li>You can change Body Batch Size to desired value (100 is recommended)
<div id="attachment_2616" style="width: 919px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2616" class="size-full wp-image-2616" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination.png" alt="Configure SSIS Web API Destination for Bulk API call (Smartsheet REST API - Insert multiple rows)" width="909" height="445" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination.png 909w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination-300x147.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-call-smartsheet-rest-api-post-bulk-mode-web-api-destination-768x376.png 768w" sizes="(max-width: 909px) 100vw, 909px" /></a><p id="caption-attachment-2616" class="wp-caption-text">Configure SSIS Web API Destination for Bulk API call (Smartsheet REST API &#8211; Insert multiple rows)</p></div></li>
</ol>
</li>
<li>That&#8217;s it run your package to test the entire flow.
<div id="attachment_2617" style="width: 1058px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-sql-server-to-smartsheet-rest-api-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2617" class="size-full wp-image-2617" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-sql-server-to-smartsheet-rest-api-example.png" alt="Loading data from SQL Server to Smartsheet using SSIS (Web API POST Example - Bulk Mode)" width="1048" height="777" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-sql-server-to-smartsheet-rest-api-example.png 1048w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-sql-server-to-smartsheet-rest-api-example-300x222.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-sql-server-to-smartsheet-rest-api-example-768x569.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-loading-sql-server-to-smartsheet-rest-api-example-1024x759.png 1024w" sizes="(max-width: 1048px) 100vw, 1048px" /></a><p id="caption-attachment-2617" class="wp-caption-text">Loading data from SQL Server to Smartsheet using SSIS (Web API POST Example &#8211; Bulk Mode)</p></div></li>
</ol>
<p>&nbsp;</p>
<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 &#8220;<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>&#8220;.</p>
<h3>Authentication related error</h3>
<p>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.</p>
</div>
<div class="content_block" id="custom_post_widget-2021"><h2>Things have gone bad: Error handling &amp; debugging</h2>
<p style="text-align: justify;">Incidentally, bad things can happen<i>. </i>A remote server may go offline or your server may go out of memory. In any case, you may want to know when that happens and take actions accordingly. For that purpose, you have to redirect bad rows to some other destination. For this example, we will take and use <em>Web API Destination</em>, but basically, you can use any SSIS component:</p>
<h3>Handling errors</h3>
<ol style="margin-left: 0;">
<li>Add a <em>Derived Column</em> above <em>Web API Destination</em> with expression <strong>&#8220;(DT_WSTR,4000)ZS_JSON_OUT&#8221;</strong> and name it <strong>&#8220;JsonAsString&#8221;</strong>. This will let you see what JSON you are actually passing.</li>
<li>Then add a database or file destination or use another <em>Trash Destination</em> for debugging purposes and redirect the bad rows (<span style="color: #d66565;">red arrow</span>) from <em><em>Web API Destination </em></em>into it<em><em>. </em></em>Don&#8217;t forget to set <span class="lang:default decode:true crayon-inline">Redirect row</span> option for both, <em>Error</em> and <em>Truncation</em> columns:<em><em><br />
</em></em></p>
<div class="wp-caption">
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1487 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" alt="Redirect bad rows from &lt;em&gt;Web API Destination&lt;/em&gt; to &lt;em&gt;Trash Destination&lt;/em&gt; when load from SQL Server to Elasticsearch is failing. Add derived column JsonAsString to be able to read JSON you are using." width="739" height="267" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png 739w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows-300x108.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></a></p>
<p class="wp-caption-text">Redirected failed requests from <em>Web API Destination</em> to a desired destination when loading from SQL Server to REST API Service is failing. Derived Column <em>JsonAsString</em> added to be able to read JSON which was passed to Elasticsearch</p>
</div>
</li>
<li>Finally, add a <a href="https://technet.microsoft.com/en-us/library/ms140318%28v=sql.90%29.aspx?f=255&amp;MSPPError=-2147217396" target="_blank" rel="noopener"><em>Data Viewer</em></a> for the red path, if you want to debug the flow. You will be able to see URL, JSON and the error message for each record. You may want to copy-paste <em>ErrorMessage</em> to <em>Notepad </em>if you want it to be more readable:
<div class="wp-caption">
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1494 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" alt="Use Data Viewer to view HTTP requests that failed to be fulfilled in Elasticsearch" width="752" height="280" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png 752w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-300x112.png 300w" sizes="(max-width: 752px) 100vw, 752px" /></a></p>
<p class="wp-caption-text">Use Data Viewer to view HTTP requests that failed to be fulfilled.</p>
</div>
</li>
</ol>
<div class="su-note" style="border-color: #e5dea5; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;">
<div class="su-note-inner su-clearfix" style="background-color: #fff7b7; border-color: #fffdf1; color: #333333; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;"><strong>NOTE</strong>: You can read more about redirecting rows in <a href="//zappysys.com/blog/ssis-error-handling-in-data-flow-redirect-bad-rows/" target="_blank" rel="noopener">SSIS Error Handling (Redirect bad rows)</a> article.</div>
</div>
<h3>Debugging HTTP requests</h3>
<p style="text-align: justify;">A common thing you have to do when working with HTTP requests is to debug those requests; e.g. to check what headers, body or URL was passed. <span id="Debug_Web_API_call_using_Fiddler"></span>To test how things look behind the scenes we strongly suggest to use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a> &#8211; a popular web debugging tool.</p>
<p style="text-align: justify;">Inside it, you can double-click the URL entry (Right side) to see Request and Response Panels. The top panel is Request (URL, Headers, Body) and Bottom Panel is Response. For https:// (secure URL) make sure you enable HTTPS option in Fiddler (Tools &gt; Options &gt; HTTPS &gt; Check Decrypt https request):</p>
<div id="attachment_2344" class="wp-caption alignnone">
<p><a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-2344 size-full" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png" alt="Debugging Web API call using Fiddler in SSIS" width="1287" height="564" data-attachment-id="2344" data-permalink="https://zappysys.com/blog/pass-authorization-header-redirected-location/ssis-rest-api-call-debug-via-fiddler/#main" data-orig-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=1287%2C564&amp;ssl=1" data-orig-size="1287,564" 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-rest-api-call-debug-via-fiddler" data-image-description="&lt;p&gt;Debugging Web API call using Fiddler in SSIS&lt;/p&gt; " data-medium-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=300%2C131&amp;ssl=1" data-large-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=720%2C316&amp;ssl=1" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png 1287w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-300x131.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-768x337.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-1024x449.png 1024w" sizes="(max-width: 1287px) 100vw, 1287px" /></a></p>
<p class="wp-caption-text">Debugging Web API call using Fiddler in SSIS</p>
</div>
</div>
<h2>Conclusion</h2>
<p>Smartsheet API provides great way to automate data read/write. However to call Smartsheet API  you have to use SDK / coding approach (e.g. C#, Java, Python, Ruby). Luckily ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> provides great way to integrate any Smartsheet API call via simple drag and drop approach without coding. Try  <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> for free and call virtually any REST API in few clicks.</p>
<p><strong>Keywords:</strong> Import smartsheet into sql server | export smartsheet to sql server | ssis smartsheet read | ssis smartsheet write | reading smartsheet data using API call | write to smartsheet</p>
<p>The post <a href="https://zappysys.com/blog/read-write-smartsheet-data-using-ssis-rest-api-call/">Read / Write Smartsheet data using SSIS REST API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Load SQL Server data to Workday using SSIS / SOAP API</title>
		<link>https://zappysys.com/blog/load-sql-server-data-workday-using-ssis-soap-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 29 Jan 2018 23:47:59 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[SSIS XML Generator Transform]]></category>
		<category><![CDATA[SSIS XML Parser Transform]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[SoapUI]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[workday]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2549</guid>

					<description><![CDATA[<p>Introduction In our previous article, we saw step-by-step approach to read data from workday using SSIS. In this article, we will focus on how to load SQL Server data to Workday (e.g. POST, Create, Update). We will use SSIS Web API Destination and the combination of other Transforms such as SSIS Template Transform and SSIS XML Generator [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/load-sql-server-data-workday-using-ssis-soap-api/">Load SQL Server data to Workday using SSIS / SOAP API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction">Introduction</span></h2>
<p><a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/workday-api-integration.png?ssl=1"><img loading="lazy" decoding="async" class="alignleft wp-image-1665" src="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/workday-api-integration.png?resize=125%2C125&amp;ssl=1" sizes="(max-width: 125px) 100vw, 125px" srcset="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/workday-api-integration.png?w=195&amp;ssl=1 195w, https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/workday-api-integration.png?resize=150%2C150&amp;ssl=1 150w" alt="" width="125" height="125" data-attachment-id="1665" data-permalink="https://zappysys.com/blog/get-data-from-workday-in-ssis-using-soap-or-rest-api/workday-api-integration/#main" data-orig-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/workday-api-integration.png?fit=195%2C195&amp;ssl=1" data-orig-size="195,195" 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="workday-api-integration" data-image-description="" data-medium-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/workday-api-integration.png?fit=195%2C195&amp;ssl=1" data-large-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/workday-api-integration.png?fit=195%2C195&amp;ssl=1" /></a>In our previous article, we saw step-by-step approach to <a href="https://zappysys.com/blog/get-data-from-workday-in-ssis-using-soap-or-rest-api/" target="_blank" rel="noopener">read data from workday using SSIS</a>. In this article, we will focus on how to load SQL Server data to Workday (e.g. POST, Create, Update). We will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">SSIS Web API Destination</a> and the combination of other Transforms such as SSIS Template Transform and <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-generator-transform/" target="_blank" rel="noopener">SSIS XML Generator Transform</a> .</p>
<p>The main thing in this article how to create SOAP Request correctly inside your request. This article explains how to use Free tools like <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">SoapUI to create Workday Request</a>. Once you do that you can call virtually any Workday API using the same technique. If you need more help contact our <a href="https://zappysys.com/support/" target="_blank" rel="noopener">Support</a> and we will be happy to help you step by step.</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;"><b>Note:</b> Template Transform mentioned in this article is only available in <strong>v2.6.4 or Higher</strong></div></div>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Step-By-Step : Import SQL Server data to Workday using SSIS</h2>
<p>Lets build our SSIS Package to load data from SQL Server or any Source (e.g. Oracle, DB2) to Workday using SOAP API calls. Using below approach you can Create new records or Update existing records in Workday. You can also delete records with same concept.</p>
<p>Basic steps outlined below.</p>
<ol>
<li>Fetch records from SQL Source and build XML Request for each Row (e.g. Create Account)</li>
<li>Build XML Request (SOAP Body) using Template Transform or  <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-generator-transform/" target="_blank" rel="noopener">SSIS XML Generator Transform</a>. If you have Array nodes (e.g. One to Many) then you have to use <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-generator-transform/" target="_blank" rel="noopener">SSIS XML Generator Transform</a> else use Template Transform for ease of use.</li>
<li>Pass input record (e.g. SOAP Body) to Web API destination to call Workday API call (CREATE, UPDATE, DELETE requests)</li>
<li>Parse XML Response (i.e. output) using <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-parser-transform/" target="_blank" rel="noopener">SSIS XML Parser Transform</a> or save raw XML to SQL Server database.</li>
<li>Redirect Bad rows or failed requests to log file for review</li>
</ol>
<p>Now let&#8217;s look at each step in detail</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> If you are trying to get data from Workday <em><span style="text-decoration: underline;">report</span> </em>instead (your Workday admin created a report and gave you a link) then skip Soap UI part, use the URL with GET method and <em>Basic authentication</em> instead of SOAP WSS.</div></div>
<h3><span id="Obtain_Workday_API_URL">Obtain Workday API URL</span></h3>
<p>Once you have WSDL file, next step is craft correct URL for API service you like to call. The service name can be obtained from <a href="https://community.workday.com/sites/default/files/file-hosting/productionapi/index.html" target="_blank" rel="noopener">here</a> (Check service column)</p>
<p><strong>Syntax:</strong> <span id="crayon-5a6f9fdb25466286543213" class="crayon-syntax crayon-syntax-inline crayon-theme-vs2012 crayon-theme-vs2012-inline crayon-font-courier-new"><span class="crayon-pre crayon-code">https://&lt;workday host name&gt;.workday.com/ccx/service/&lt;tenant name&gt;/&lt;service-name&gt;</span></span><strong><br />
Example:</strong> <span id="crayon-5a6f9fdb25476699875511" class="crayon-syntax crayon-syntax-inline crayon-theme-vs2012 crayon-theme-vs2012-inline crayon-font-courier-new"><span class="crayon-pre crayon-code">https://MY-INSTANCE.workday.com/ccx/service/MY-TenantID/Human_Resources</span></span></p>
<h3><span id="Craft_SOAP_Body_XML_API_Request_using_SoapUI">Craft SOAP Body (XML API Request) using SoapUI</span></h3>
<p>Now its time to craft some SOAP Request. Check steps <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/">outlined here (Use SoapUI tool)</a> . Once you have Request Body XML you can change parameters as per your need.</p>
<p>Here is sample  SOAP XML Body for Get Employee call from Human_Resopurces service.</p>
<div id="crayon-5a6f9fdb2547e729542745" class="crayon-syntax crayon-theme-vs2012 crayon-font-courier-new crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover">
<div class="crayon-plain-wrap"><a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/create-workday-soap-request-using-soapui-api-xml-body.png?ssl=1"><img loading="lazy" decoding="async" class="size-full wp-image-2543" 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/2016/01/create-workday-soap-request-using-soapui-api-xml-body.png?resize=720%2C442&amp;ssl=1" sizes="(max-width: 720px) 100vw, 720px" srcset="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/create-workday-soap-request-using-soapui-api-xml-body.png?w=735&amp;ssl=1 735w, https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/create-workday-soap-request-using-soapui-api-xml-body.png?resize=300%2C184&amp;ssl=1 300w" alt="Create SOAP Request Body from WSDL (Using SoapUI tool)" width="702" height="431" data-attachment-id="2543" data-permalink="https://zappysys.com/blog/get-data-from-workday-in-ssis-using-soap-or-rest-api/create-workday-soap-request-using-soapui-api-xml-body/#main" data-orig-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/create-workday-soap-request-using-soapui-api-xml-body.png?fit=735%2C451&amp;ssl=1" data-orig-size="735,451" 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="create-workday-soap-request-using-soapui-api-xml-body" data-image-description="&lt;p&gt;Create SOAP Request Body from WSDL (Using SoapUI tool)&lt;/p&gt; " data-medium-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/create-workday-soap-request-using-soapui-api-xml-body.png?fit=300%2C184&amp;ssl=1" data-large-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/01/create-workday-soap-request-using-soapui-api-xml-body.png?fit=720%2C442&amp;ssl=1" /></a></div>
</div>
<div id="attachment_2543" class="wp-caption alignnone">
<p class="wp-caption-text">Create SOAP Request Body from WSDL (Using SoapUI tool)</p>
</div>
<h3><span id="Creating_SSIS_Connection_for_Workday_SOAP_API_call_using_WSS_Security">Creating SSIS Connection for Workday SOAP API call using WSS Security</span></h3>
<div id="custom_post_widget-2536" class="content_block">
<p>To create a new connection for workday perform the following steps.</p>
<ol>
<li>Two ways you can create HTTP connection for the workday service<br />
<strong>First approach:</strong> Right click in the connection managers panel and click “New Connection…” and Select <strong>ZS-HTTP</strong>connection from the connection type list and click OK.<br />
<strong>— OR —</strong><br />
<strong>Second approach:</strong> If you are already on <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">SSIS REST API TASK</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">SSIS Web API Destination</a> UI then click [New] next to the Connection Dropdown.</li>
<li>Once HTTP Connection UI is visible configure following way.
<ol>
<li>Enter API URL for Workday (Make sure you don’t enter WSDL URL <a href="https://community.workday.com/sites/default/files/file-hosting/productionapi/index.html" target="_blank" rel="noopener">found here</a> ). Your API URL will be something like below.<br />
<strong>Syntax:</strong> <pre class="crayon-plain-tag">https://&lt;workday host name&gt;.workday.com/ccx/service/&lt;tenant name&gt;/&lt;service-name&gt;</pre><strong><br />
Example:</strong> <pre class="crayon-plain-tag">https://wd1-impl-services1.workday.com/ccx/service/MyTenantID/Human_Resources</pre></li>
<li>Select credential type as SOAP WSS (This setting is only found in <strong>v2.6.4</strong> or Higher)</li>
<li>Enter your workday userid and password</li>
<li>For WSS password type setting you leave it default (Not set) or change to PasswordHash for more secure communication.</li>
<li>Click OK to save.</li>
</ol>
</li>
</ol>
<div id="attachment_2537" class="wp-caption alignnone">
<p><a href="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2018/01/ssis-soap-webservice-connection-workday-api-wss-security.png?ssl=1"><img loading="lazy" decoding="async" class="size-full wp-image-2537" 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/2018/01/ssis-soap-webservice-connection-workday-api-wss-security.png?resize=720%2C584&amp;ssl=1" sizes="(max-width: 720px) 100vw, 720px" srcset="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2018/01/ssis-soap-webservice-connection-workday-api-wss-security.png?w=783&amp;ssl=1 783w, https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2018/01/ssis-soap-webservice-connection-workday-api-wss-security.png?resize=300%2C243&amp;ssl=1 300w, https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2018/01/ssis-soap-webservice-connection-workday-api-wss-security.png?resize=768%2C623&amp;ssl=1 768w" alt="SSIS Workday Integration - Create New SAOP Service Connection for Workday API Service (SOAP WSS)" width="702" height="569" data-attachment-id="2537" data-permalink="https://zappysys.com/blog/content_block/workday-ssis-connection-setup/ssis-soap-webservice-connection-workday-api-wss-security/#main" data-orig-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2018/01/ssis-soap-webservice-connection-workday-api-wss-security.png?fit=783%2C635&amp;ssl=1" data-orig-size="783,635" 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-soap-webservice-connection-workday-api-wss-security" data-image-description="&lt;p&gt;SSIS Workday Integration – Create New SAOP Service Connection for Workday API Service (SOAP WSS)&lt;/p&gt; " data-medium-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2018/01/ssis-soap-webservice-connection-workday-api-wss-security.png?fit=300%2C243&amp;ssl=1" data-large-file="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2018/01/ssis-soap-webservice-connection-workday-api-wss-security.png?fit=720%2C584&amp;ssl=1" /></a></p>
<p class="wp-caption-text">SSIS Workday Integration – Create New SAOP Service Connection for Workday API Service (SOAP WSS)</p>
</div>
<p>&nbsp;</p>
</div>
<h3><span id="Creating_SSIS_Connection_for_Workday_SOAP_API_call_using_WSS_Security">Loading SQL Server data to Workday using SSIS</span></h3>
<p>Let&#8217;s look at the real-world scenario. You have Accounts table stored in SQL Server and you like to create same accounts in Workday by calling appropriate API calls.</p>
<ol>
<li>Drag Data flow task from SSIS Toolbox. Double click to edit.</li>
<li>Drag OLEDB Source configure to read SQL Table (e.g. Accounts)</li>
<li>Drag ZS Template Transform from the toolbox. Connect OLEDB Source to Template Transform. If you need flexible XML Generation then use <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-generator-transform/" target="_blank" rel="noopener">XML Generator Transform</a> but it may require some learning curve so for simplicity we are skipping that from this article.</li>
<li>Enter your SOAP request in the template text (like below) you like to call (This is obtained from the previous section &#8211; using <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/">tool like SoapUI</a>)<br />
<strong>For Example:</strong> To create a new account you can use enter like below. Replace xxxxxxxxxx with Columns placeholder.<br />
To insert Column name as Placeholder click &lt;&lt;Insert Placeholder&gt;&gt; and then Select [Columns] node. Template Transform outputs column name <strong>TemplateOutput</strong>. You can use this as Body to feed next step (i.e. Call Workday API using Web API Destination )When you insert placeholder to make sure you use XML Encoded Columns if you expecting a Long text or special characters part of your data.<br />
Syntax for encoded value is   <pre class="crayon-plain-tag">&lt;%CustomerName,FUN_XMLENC%&gt;</pre>  . You don&#8217;t need <strong>FUN_XMLENC</strong> for numeric fields. For normal placeholder without encoding use just name with column placeholder indicators e.g.  <pre class="crayon-plain-tag">&lt;%Amount%&gt;</pre>
<pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bsvc="urn:com.workday/bsvc"&gt;
   &lt;soapenv:Header/&gt;
   &lt;soapenv:Body&gt;
      &lt;bsvc:Workday_Account_for_Worker_Add&gt;
         &lt;bsvc:Worker_Reference&gt;
            &lt;!--You have a CHOICE of the next 2 items at this level--&gt;
            &lt;bsvc:Employee_Reference&gt;
               &lt;bsvc:Integration_ID_Reference&gt;
                  &lt;bsvc:ID&gt;xxxxxxxxxx&lt;/bsvc:ID&gt;
               &lt;/bsvc:Integration_ID_Reference&gt;
            &lt;/bsvc:Employee_Reference&gt;
            &lt;bsvc:Contingent_Worker_Reference&gt;
               &lt;bsvc:Integration_ID_Reference&gt;
                  &lt;bsvc:ID&gt;xxxxxxxxxxxx&lt;/bsvc:ID&gt;
               &lt;/bsvc:Integration_ID_Reference&gt;
            &lt;/bsvc:Contingent_Worker_Reference&gt;
         &lt;/bsvc:Worker_Reference&gt;
         &lt;bsvc:Workday_Account_for_Worker_Data&gt;
            &lt;!--type: string--&gt;
            &lt;bsvc:User_Name&gt;xxxxxxxxxxxxxx&lt;/bsvc:User_Name&gt;
         &lt;/bsvc:Workday_Account_for_Worker_Data&gt;
      &lt;/bsvc:Workday_Account_for_Worker_Add&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre>
<div id="attachment_2550" style="width: 1170px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-create-soap-request-xml-template.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2550" class="size-full wp-image-2550" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-create-soap-request-xml-template.png" alt="Template Transform - Create Workday SOAP Request - Create new records using SSIS" width="1160" height="630" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-create-soap-request-xml-template.png 1160w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-create-soap-request-xml-template-300x163.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-create-soap-request-xml-template-768x417.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-create-soap-request-xml-template-1024x556.png 1024w" sizes="(max-width: 1160px) 100vw, 1160px" /></a><p id="caption-attachment-2550" class="wp-caption-text">Template Transform &#8211;<br />Create Workday SOAP Request &#8211; Create new records using SSIS</p></div></li>
<li>Drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">ZS Web API Destination</a> from SSIS Toolbox. Connect Template Transform to Web API Destination.</li>
<li>Configure Web API Destination as below (See we used same HTTP connection created in the previous section)</li>
<li>Select HTTP Connection</li>
<li>Select Input Column for Body (select <strong>TemplateOutput</strong>)</li>
<li>Select Body Content Type as <strong>XML (text/xml;charset=UTF-8)</strong></li>
<li>Click Raw Edit above Headers grid. Enter following text (We just need one header)<br />
<pre class="crayon-plain-tag">SOAPAction: ""</pre>
<div id="attachment_2551" style="width: 1116px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-loading-sql-server-data-using-xml-soap-request.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2551" class="size-full wp-image-2551" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-loading-sql-server-data-using-xml-soap-request.png" alt="SSIS Web API Destination - Loading SQL Server data to Workday (SOAP Call - Create, Insert, Update, Delete Records)" width="1106" height="693" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-loading-sql-server-data-using-xml-soap-request.png 1106w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-loading-sql-server-data-using-xml-soap-request-300x188.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-loading-sql-server-data-using-xml-soap-request-768x481.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-loading-sql-server-data-using-xml-soap-request-1024x642.png 1024w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-workday-write-data-loading-sql-server-data-using-xml-soap-request-436x272.png 436w" sizes="(max-width: 1106px) 100vw, 1106px" /></a><p id="caption-attachment-2551" class="wp-caption-text">SSIS Web API Destination &#8211;<br />Loading SQL Server data to Workday (SOAP Call &#8211; Create, Insert, Update, Delete Records)</p></div></li>
<li>Now you can connect Web API Destination Output (Blue Arrow to Either XML Parser or some other Destination). Web API destination gives you a response in Raw XML Format. This article explains <a href="https://zappysys.com/blog/load-data-from-sql-server-to-elasticsearch-using-ssis/#What_if_I_want_more_After_upserting_data_useWeb_API_Destinationfurther" target="_blank" rel="noopener">how to use JSON or XML Parser to parse API response</a> coming from Web API destination.</li>
</ol>
<h2>Video Tutorial (See Part#4) &#8211; Create XML and POST data to SOAP Web Service or REST API</h2>
<p>Now lets look at examples of creating XML from multiple data sources and POST XML request to SOAP Web Service URL or any other XML Based REST API URL. This video has 5 parts to cover full length tutorial but if you want to fast forward to see XML Generator Transform and Web API Destination then see part#4.<br />
<a href="https://zappysys.com/blog/load-sql-server-data-workday-using-ssis-soap-api/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FTjTexGzBF5g%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<h2>Sending complex SOAP Request (Nested Parent-Child Array)</h2>
<p>If you have to call more complex SOAP request which requires Parent-child structure (Nested Array) then you cant use Template Transform. In that case, check <a href="https://zappysys.zendesk.com/hc/en-us/articles/360002575234-How-to-generate-Workday-SOAP-Request-XML-in-SSIS" target="_blank" rel="noopener">this article</a> for real-world example.</p>
<div id="attachment_3167" style="width: 674px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-create-soap-request-nested-xml-multiple-inputs-post-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3167" class="size-full wp-image-3167" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-create-soap-request-nested-xml-multiple-inputs-post-data.png" alt="Create nested XML for SOAP Request - Multiple inputs (POST data to API using SSIS Web API Destination)" width="664" height="520" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-create-soap-request-nested-xml-multiple-inputs-post-data.png 664w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-create-soap-request-nested-xml-multiple-inputs-post-data-300x235.png 300w" sizes="(max-width: 664px) 100vw, 664px" /></a><p id="caption-attachment-3167" class="wp-caption-text">Create nested XML for SOAP Request &#8211; Multiple inputs (POST data to API using SSIS Web API Destination)</p></div>
<h2>Extract single XML node from SOAP Response</h2>
<p>There will be a time when you need to extract just one value out of your response and save into SSIS variable / use it later on. If that&#8217;s the case then <a href="https://zappysys.com/blog/ssis-extract-single-xml-node-using-xpath-soap-response/" target="_blank" rel="noopener">refer to this article</a>.</p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>In this article we have learned how to load data from SQL Server to Workday using SSIS ( drag and drop approach without coding). Combination of few ZappySys Components (e.g. Web API Destination, XML Generator ) makes it super simple to call any Web API to load data from one system to API endpoint. <a href="https://zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try many other automation scenarios not discussed in this article.</p>
<p>The post <a href="https://zappysys.com/blog/load-sql-server-data-workday-using-ssis-soap-api/">Load SQL Server data to Workday using SSIS / SOAP API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Update MongoDB Array Items using SSIS</title>
		<link>https://zappysys.com/blog/update-mongodb-array-items-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 21 Jan 2017 23:00:55 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB Destination]]></category>
		<category><![CDATA[SSIS MongoDB ExecuteSQL]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[upsert]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=952</guid>

					<description><![CDATA[<p>Introduction In our previous blog post we saw how to perform Read and Write operations in MongoDB using SSIS (i.e. Bulk Update, Delete, Upsert, Insert). In this post we specifically focus on how to update MongoDB Array items / elements using SSIS. To make things simple to follow we have used JSON Source to produce [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/update-mongodb-array-items-using-ssis/">Update MongoDB Array Items 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="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png"><img loading="lazy" decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" /></a>In <a href="https://zappysys.com/blog/ssis-loading-data-into-mongodb-upsert-update-delete-insert/" target="_blank" rel="noopener">our previous blog post</a> we saw how to perform Read and Write operations in MongoDB using SSIS (i.e. Bulk Update, Delete, Upsert, Insert). In this post we specifically focus on <em>how to update MongoDB Array items / elements using SSIS</em>.</p>
<p>To make things simple to follow we have used <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source</a> to produce sample JSON documents for MongoDB update (NOTE: Output as Document option is checked for JSON Source). However in real world you may have to use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">SSIS JSON Generator Transform</a> to produce input documents for MongoDB. To learn more about generating JSON documents for MongoDB Load process <a href="//zappysys.com/blog/create-mongodb-documents-ssis-json-bson-load-update-insert-upsert-collection/" target="_blank" rel="noopener">check this blog post</a> or watch video found <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">on this page</a>.</p>
<h2>Video Tutorial &#8211; Example of insert/update documents inside MongoDB Array (Use $set, $push operator)</h2>
<a href="https://zappysys.com/blog/update-mongodb-array-items-using-ssis/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FcaiLHfF-pzg%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<h2>Basic Concepts: Performing MongoDB CRUD operations using SSIS</h2>
<p>If you never heard term called CRUD stands for Create, Read, Update, Delete. These are the most common operations you have to do with any data source. <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> comes with many MongoDB Components to help you with CRUD operations. You can use one or more following components to achieve drag and drop MongoDB CRUD operations in SSIS. When you use SSIS PowerPack for MongoDB all operations will be Bulk Operations by default which means it will provide very high throughput.</p>
<ul>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-source/" target="_blank" rel="noopener">SSIS MongoDB Source</a></li>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/" target="_blank" rel="noopener">SSIS MongoDB Destination</a></li>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">SSIS MongoDB ExecuteSQL Task</a></li>
</ul>
<h2>Download Example SSIS Package</h2>
<p>Here is the link to <a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-sample-package.zip">download Sample SSIS Package</a></p>
<div id="attachment_958" style="width: 711px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-update-mongodb-array-items-delete-insert-set-push-pull.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-958" class="size-full wp-image-958" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-update-mongodb-array-items-delete-insert-set-push-pull.png" alt="SSIS Example : Update MongoDB Array Items / Elements (Update, Delete, Insert - Using $set, $pull, $push)" width="701" height="487" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-update-mongodb-array-items-delete-insert-set-push-pull.png 701w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-update-mongodb-array-items-delete-insert-set-push-pull-300x208.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-958" class="wp-caption-text">SSIS Example : Update MongoDB Array Items / Elements (Update, Delete, Insert &#8211; Using $set, $pull, $push)</p></div>
<p>&nbsp;</p>
<h2>Update MongoDB Array Items ($set operator)</h2>
<p>In next couple of sections we will see how to perform Update, Insert and Delete operations with MongoDB Array Items using various <a href="https://docs.mongodb.com/manual/reference/operator/update/" target="_blank" rel="noopener">update operators</a> and <a href="https://docs.mongodb.com/manual/reference/operator/update-array/" target="_blank" rel="noopener">array operators</a>. Consider the following Sample JSON documents for MongoDB. First we will see how to use MongoDB Shell commands to perform CRUD operations on MongoDB Array items.</p><pre class="crayon-plain-tag">{
    "_id" : ObjectId("5883ebe669e0f22ba890b49b"),
    "CustomerID" : "BOLID",
    "Name" : "Some name",
    "Orders" : [ 
        {
            "OrderID" : 200,
            "ShipCountry" : "USA",
            "City" : "Atlanta"
        }, 
        {
            "OrderID" : 201,
            "ShipCountry" : "USA",
            "City" : "New York"
        }
    ]
}</pre><p>
<h3>Update Array element using Shell command</h3>
<p>Assume you want to update ShipCountry attribute of one of the Orders (OrderID=200) and for CustomerID=&#8221;BOLID&#8221; in above sample document.</p>
<h4>Shell Command for Update Array Item</h4>
<p>Use below shell command in your favorite MongoDB Client Tool (e.g. RoboMongo). Notice two things in below command because we will apply same concepts when we take this approach to SSIS. In below command Actual JSON document is wrapped inside. This is MongoDB Update operator. <a href="https://docs.mongodb.com/manual/reference/operator/update/set/" target="_blank" rel="noopener">Click here to learn more about $set</a>. Also notice that rather than nested Array syntax we used Orders.$.ShipCountry to update ShipCountry which is part of Array element. MongoDB provides special way to navigate array elements using   <a href="https://docs.mongodb.com/manual/reference/operator/update/positional/" target="_blank" rel="noopener">$ Operator (MongoDB Positional Update) </a></p><pre class="crayon-plain-tag">db.MyCollection.update(
	{ "CustomerID" : "BOLID", "Orders.OrderID" : 200 }, 
	{ $set : { "Orders.$.ShipCountry" : "Test1"} } , 
	{ upsert: false, multi: false}
)</pre><p>
<h4>After Update (MongoDB Document)</h4>
<p>After you run above shell command notice all other attributes remain there in Array document and only ShipCountry is changed. This is because we used <a href="https://docs.mongodb.com/manual/reference/operator/update/positional/" target="_blank" rel="noopener">$ Operator (MongoDB Positional Update) </a>rather than supplying Raw JSON for Array document (i.e. Orders : [ { &#8230; } ] ).</p><pre class="crayon-plain-tag">{
    "_id" : ObjectId("5883ebe669e0f22ba890b49b"),
    "CustomerID" : "BOLID",
    "Name" : "Some name",
    "Orders" : [ 
        {
            "OrderID" : 200,
            "ShipCountry" : "Test1",
            "City" : "Atlanta"
        }, 
        {
            "OrderID" : 201,
            "ShipCountry" : "USA",
            "City" : "New York"
        }
    ]
}</pre><p>
The issue with this approach its not Bulk operation. Assume that you have 100,000 records to update in various documents and its nested array items then row by row operation is not effective. To solve this issue we will use SSIS MongoDB Destination which performs Bulk operations (e.g. Bulk Update, Delete, Insert and Upsert).</p>
<h3>Update MongoDB Array Items using SSIS</h3>
<p>Now lets implement above scenario using SSIS. Assume that you have sample MongoDB document (as per above example &#8211; Before Update). We want to update ShipCountry for OrderID=200 for Customer BOLID. To do that perform following steps in SSIS. If you are updating Second level array (i.e. Root &gt;&gt; Orders &gt;&gt; OrderItems)  then you have follow slight different process. Check next section in this article about updating second level array (Insert items)</p>
<ol>
<li>Download and <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Install SSIS PowerPack</a></li>
<li>Create new SSIS Project with one data flow task
<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>Drag ZS JSON Source and check Output as Document option (as below sceenshot). You can use JSON Source is your JSON is stored inside file or Variable or coming from Some API call which eventually go into MongoDB. You can also use JSON Source for quick testing where you Hardcode JSON to feed to MongoDB.</li>
<li>Enter the following JSON in the text area. Click OK to save.<br />
<pre class="crayon-plain-tag">{"CustomerID":"BOLID", "Orders.$.OrderID":201, "Orders.$.ShipCountry": "Test1"}
{"CustomerID":"BOLID", "Orders.$.OrderID":202, "Orders.$.ShipCountry": "Test2"}
/**Below is extra record not found in destination - will be ignored in Update**/
{"CustomerID":"BOLID", "Orders.$.OrderID":203, "Orders.$.ShipCountry": "Test3"}</pre>
</li>
<li>Right click in Connections area and Create new ZS-MONGODB connection. Specify credentials and click Test before you hit OK to save.</li>
<li>Now drag ZS MongoDB Destination from SSIS Toolbox.</li>
<li>Select Runtime connection.</li>
<li>On the properties tab edit following properties
<ol>
<li>Set ColumnsForLookup property as below (Notice how we use 2 columns for JOIN. Also used AS keywords for 2nd Column so we have <em>&lt;column-from-input-doc&gt; AS &lt;column-for-server-side-find&gt;</em><br />
<strong><em>CustomerID,Orders.$.OrderID AS Orders.OrderID</em></strong></li>
<li>Set LoadOptions as below (Op is <a href="https://docs.mongodb.com/manual/reference/operator/update" target="_blank" rel="noopener">Update Operator</a> you like to use. In our case its <a href="https://docs.mongodb.com/manual/reference/operator/update/set/" target="_blank" rel="noopener">$set</a>, Multi=True means if multiple match found then all matching documents will be updated). If you want to use multiple update operators then you have to supply that from Input document and use <strong>op=none</strong> option rather <strong>op=$set</strong>.<br />
<strong><em>op=$set;multi=true</em></strong></li>
<li>Set Operation property to Update</li>
</ol>
</li>
<li>On the Mappings tab Map __DOCUMENT__ from upstream (In our case you will see same name column from JSON Source if you checked Output as Document option)</li>
<li>Click OK to save MongoDB Destination UI</li>
<li>Run package. You will notice after execution two orders of CustomerID=BOLID will be updated.</li>
</ol>
<div id="attachment_961" style="width: 853px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-read-raw-json-documents.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-961" class="size-full wp-image-961" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-read-raw-json-documents.png" alt="SSIS JSON Source - Read JSON (Raw Documents)" width="843" height="507" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-read-raw-json-documents.png 843w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-read-raw-json-documents-300x180.png 300w" sizes="(max-width: 843px) 100vw, 843px" /></a><p id="caption-attachment-961" class="wp-caption-text">SSIS JSON Source &#8211; Read JSON (Raw Documents)</p></div>
<h2></h2>
<div id="attachment_962" style="width: 749px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-update-mongodb-item-set-operator.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-962" class="size-full wp-image-962" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-update-mongodb-item-set-operator.png" alt="SSIS MongoDB Destination - Update MongoDB Array Item using $set update operator" width="739" height="469" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-update-mongodb-item-set-operator.png 739w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-update-mongodb-item-set-operator-300x190.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></a><p id="caption-attachment-962" class="wp-caption-text">SSIS MongoDB Destination &#8211; Update MongoDB Array Item using $set update operator</p></div>
<h2>Insert MongoDB Array Item ($push / $addToSet Operator)</h2>
<p>Now lets look at how to insert new item into existing Array. Lets say we already have two orders for a customer and now we want to add new order. For this you can either use  <a href="https://docs.mongodb.com/manual/reference/operator/update/push/" target="_blank" rel="noopener">$push operator</a> or <a href="https://docs.mongodb.com/manual/reference/operator/update/addToSet/" target="_blank" rel="noopener">$addToSet operator</a>. $push operator doesn&#8217;t check for duplicate item so its little faster. If you wish to skip append if item already exists (by matching all attributes) then use $addToSet operator.</p>
<h3>Using Shell Command : Insert MongoDB Array Item (Append to array)</h3>
<p>Here is the shell command which will push new item to the array</p><pre class="crayon-plain-tag">db.MyCollection.update(
	{CustomerID:"BOLID"},
	{$push:{Orders: {"OrderID":202,"ShipCountry":"USA","ShipCity":"Atlanta" } }},
	{upsert: false,multi: false}
)</pre><p>
&nbsp;</p>
<h3>Using Shell Command : Insert MongoDB Array Item at second level</h3>
<p>Here is the shell command which will push new item to the array which is stored at second level e.g. { Orders :  [ { Items : [ insert-here ] } ] }</p><pre class="crayon-plain-tag">db.MyCollection.update(
	{CustomerID:"BOLID", "Orders.OrderID" : 202 },
	{$push:{ "Orders.$.Items" : {"ProductID":1001,"Quantity":3} } },
	{upsert: false,multi: false}
)</pre><p>
<h3>Using SSIS : Insert MongoDB Array Item at Second Level</h3>
<p>Now lets look at some example how to Insert Items inside Orders array. Since it requires two JOIN columns to perform second level array insert you may need to add metadata for join.</p>
<p>First step is create documents for update. There are atleast 4 ways you can create input documents for MongoDB Destination.</p>
<ol>
<li>You can use <a href="//zappysys.com/blog/create-mongodb-documents-ssis-json-bson-load-update-insert-upsert-collection/" target="_blank" rel="noopener">JSON generator Transform to create documents for load process</a></li>
<li>You can use <a href="//zappysys.com/blog/export-json-from-sql-server-using-ssis/" target="_blank" rel="noopener">Export JSON Task to generate input documents</a> file and then use JSON Source to Read Documents (Check Output as Document option on JSON Source to read as RAW JSON)</li>
<li>You can use JSON Source to feed direct JSON (This approach is demonstrated in the below example sceenshot)</li>
<li>You can also use SQL query to output JSON Strings along with columns used for JOIN condition<br />
<pre class="crayon-plain-tag">select CustomerID, OrderID as 'Orders.$.OrderID', DOC = '{Orders.$.Items : {ItemID: 1, Qty: 5} }'</pre>
</li>
</ol>
<p>To make it simple lets use #3 approach from above list. We will create few documents and insert New orders Items</p>
<h4>Sample Document for MongoDB Collection</h4>
<p>For testing purpose you can create MongoDB collection called test with following one document. As you see Items array is empty for both orders but once you run sample each will have 2 items.</p><pre class="crayon-plain-tag">{
    "_id" : ObjectId("58c01bee0610fea8ddda04b9"),
    "CustomerID" : "ALFKI",
    "Orders" : [ 
        {
            "OrderID" : 100,
            "Items" : [ ]
        }, 
        {
            "OrderID" : 101,
            "Items" : [ ]
        }
    ]
}</pre><p>
Now lets look at how to configure SSIS package</p>
<p>&nbsp;</p>
<h4>Step-1 : Create JSON Documents for Array Insert</h4>
<p>Lets use JSON Source like below. Use following Sample JSON</p><pre class="crayon-plain-tag">/*Insert new items into order#100*/
{CustomerID:"ALFKI","Orders.$.OrderID" : 100, Doc: "{ \"Orders.$.Items\" : {ItemID: 1, Qty: 10} }" }
{CustomerID:"ALFKI","Orders.$.OrderID" : 100, Doc: "{ \"Orders.$.Items\" : {ItemID: 2, Qty: 11} }" }

/*Insert new items into order#101*/
{CustomerID:"ALFKI","Orders.$.OrderID" : 101, Doc: "{ \"Orders.$.Items\" : {ItemID: 1, Qty: 20} }" }
{CustomerID:"ALFKI","Orders.$.OrderID" : 101, Doc: "{ \"Orders.$.Items\" : {ItemID: 2, Qty: 21} }" }</pre><p>
&nbsp;</p>
<p>&nbsp;</p>
<div id="attachment_1064" style="width: 990px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-second-level-array-update-push-insert-items-2nd.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1064" class="size-full wp-image-1064" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-second-level-array-update-push-insert-items-2nd.png" alt="Create Sample JSON Documents for MongoDB Array Update (2nd level array)" width="980" height="744" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-second-level-array-update-push-insert-items-2nd.png 980w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-second-level-array-update-push-insert-items-2nd-300x228.png 300w" sizes="(max-width: 980px) 100vw, 980px" /></a><p id="caption-attachment-1064" class="wp-caption-text">Create Sample JSON Documents for MongoDB Array Update (2nd level array)</p></div>
<h4>Step-2 : Configure MongoDB Destination for $push operation on Second level Array</h4>
<p>Now lets connect source to Destination and configure MongoDB Destination. Select connection on first tab. Then On second tab change properties like below.</p>
<p>&nbsp;</p>
<div id="attachment_1065" style="width: 620px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push-.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1065" class="size-full wp-image-1065" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push-.png" alt="Configure MongoDB Destination for second level array update (Insert item using $push update operator)" width="610" height="608" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push-.png 610w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push--150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push--300x300.png 300w" sizes="(max-width: 610px) 100vw, 610px" /></a><p id="caption-attachment-1065" class="wp-caption-text">Configure MongoDB Destination for second level array update (Insert item using $push update operator)</p></div>
<h4>Step-3 : Add missing JOIN column for Mapping</h4>
<p>When you click on Mappings tab you will notice only root level columns are listed there for mapping but if you are JOINing based on Nested column found inside array then you have to add missing mapping column by hand like below screenshot.  In our case we Join by CustomerID and OrderID where OrderID is found in Orders array which is missing on mappings tab. So lets add it. Just make sure name new column using $ positional operator&#8230; e.g. Orders.$.OrderID  this will tell MongoDB that our OrderID column must be lookup under Array called Orders: [  ]
<div id="attachment_1066" style="width: 696px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-add-missing-columns-metadata-edit.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1066" class="size-full wp-image-1066" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-add-missing-columns-metadata-edit.png" alt="MongoDB Destination - Add missing metadata column for JOIN " width="686" height="694" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-add-missing-columns-metadata-edit.png 686w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-add-missing-columns-metadata-edit-297x300.png 297w" sizes="(max-width: 686px) 100vw, 686px" /></a><p id="caption-attachment-1066" class="wp-caption-text">MongoDB Destination &#8211; Add missing metadata column for JOIN</p></div>
<h4>Step-4 : Map JOIN columns and Input DOCUMENT</h4>
<p>Now finally map all columns</p>
<div id="attachment_1067" style="width: 641px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-mappings-second-level-array-update-push.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1067" class="size-full wp-image-1067" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-mappings-second-level-array-update-push.png" alt="SSIS MongoDB Destination - Column Mappings" width="631" height="742" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-mappings-second-level-array-update-push.png 631w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-mappings-second-level-array-update-push-255x300.png 255w" sizes="(max-width: 631px) 100vw, 631px" /></a><p id="caption-attachment-1067" class="wp-caption-text">SSIS MongoDB Destination &#8211; Column Mappings</p></div>
<h3>Using SSIS : Insert MongoDB Array Item (Append to array)</h3>
<p>Now lets look at how to perform same operation to insert array item in SSIS using $push operator. In this case we will do little different than Update Item example ($set operator). First we have not included CustomerID as part of Input columns and we mapped it on Mapping Screen rather than supplying columns names in ColumnsForLookup property (On Component Properties Tab of Destination UI). If you are using JSON Generator Transform to generate your JSON then you have option to Hide/Include certain columns part of your flow. Check Include column to downstream option if you want to use for JOIN column.</p>
<p>Set following settings</p>
<ul>
<li>Set LoadOptions as below<br />
<strong>op=$push;multi=true</strong></li>
<li>Set Operation=Update</li>
<li>Leave ColumnsForLookup as empty</li>
<li>On the mappings tab map __DOCUMENT__ and CustomerID in the Target. If you don&#8217;t see CustomerID column in the mapping create atleast one sample doc in MongoDB Collection so metadata is detected.</li>
</ul>
<p>Download Sample for more detail.</p>
<div id="attachment_966" style="width: 958px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-generate-json-for-mongodb-array-item-insert.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-966" class="size-full wp-image-966" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-generate-json-for-mongodb-array-item-insert.png" alt="SSIS JSON Source - generate JSON for MongoDB Array Insert" width="948" height="516" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-generate-json-for-mongodb-array-item-insert.png 948w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-generate-json-for-mongodb-array-item-insert-300x163.png 300w" sizes="(max-width: 948px) 100vw, 948px" /></a><p id="caption-attachment-966" class="wp-caption-text">SSIS JSON Source &#8211; generate JSON for MongoDB Array Insert</p></div>
<div id="attachment_968" style="width: 684px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-insert-array-item-push-addtoset-operator.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-968" class="size-full wp-image-968" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-insert-array-item-push-addtoset-operator.png" alt="SSIS MongoDB Destination - Insert MongoDB Array Item (Use $push, or $addToSet operator)" width="674" height="436" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-insert-array-item-push-addtoset-operator.png 674w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-insert-array-item-push-addtoset-operator-300x194.png 300w" sizes="(max-width: 674px) 100vw, 674px" /></a><p id="caption-attachment-968" class="wp-caption-text">SSIS MongoDB Destination &#8211; Insert MongoDB Array Item (Use $push, or $addToSet operator)</p></div>
<h2>Delete MongoDB Array Item ($pull operator)</h2>
<p>If you wish to remove array item then you can use <a href="https://docs.mongodb.com/manual/reference/operator/update/pull/" target="_blank" rel="noopener">$pull operator</a>. Only difference is rather than specifying two conditions in first argument&#8230; you just specify JOIN columns without array column (i.e. OrderID). To specify Array item condition you have to set inside $pull : { &#8230; }</p>
<h3>Using Shell Command for MongoDB Delete Array Item (Remove by condition)</h3>
<p>Below example shows how to remove OrderID=201 from Orders array for CustomerID=BOLID.</p><pre class="crayon-plain-tag">db.MyCollection.update(
	{CustomerID:"BOLID"},
	{$pull:{Orders: {"OrderID":201} }},
	{upsert: false,multi: false}
)</pre><p>
&nbsp;</p>
<h3>Using SSIS for MongoDB Delete Array Item</h3>
<p>Now lets look at how to implement Delete logic for MongoDB Array Item in SSIS. As you see in below screenshots You have to modify following things</p>
<ul>
<li>Set ColumnsForLookup property to CustomerID (no need to add OrderID here because its part of input document)</li>
<li>Set LoadOptions property to op=none;multi=false. op=none means we are supplying Update operator part of input document.</li>
</ul>
<p>Assume you have doc like below in MongoDB  and you like to remove Order#101 from array</p><pre class="crayon-plain-tag">{
    "_id" : ObjectId("58c01bee0610fea8ddda04b9"),
    "ParentID" : 1,
    "Orders" : [ 
        100, 
        101, 
        102
    ]
}</pre><p>
For this supply 2 columns from upstream<br />
col1  = ParentID<br />
col2  = DOCUMENT</p>
<p>Document column should look like below<br />
{Orders: 101}</p>
<ol>
<li>On MongoDB destination change LoadOptions property to  op=$pull;multi=true</li>
<li>Change Operation to Update</li>
<li>Map ParentID and DOCUMENT columns on Mapping screen</li>
<li>Run the package &#8230; It will remove Order# 101 from array</li>
</ol>
<h2>Array Upsert &#8211; Update / Insert using Custom JOIN condition (such as $ne )</h2>
<p>If you like to perform Upsert Operation on MongoDB Array Items then refer to below blog post.</p>
<blockquote class="wp-embedded-content" data-secret="kVibThe8Ux"><p><a href="https://zappysys.com/blog/update-insert-upsert-mongodb-array-items-ssis/">Update or Insert &#8211; Upsert MongoDB Array Items using SSIS</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" src="https://zappysys.com/blog/update-insert-upsert-mongodb-array-items-ssis/embed/#?secret=kVibThe8Ux" data-secret="kVibThe8Ux" width="600" height="338" title="&#8220;Update or Insert &#8211; Upsert MongoDB Array Items using SSIS&#8221; &#8212; ZappySys Blog" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>MongoDB integration can be challenging if you are new to NoSQL world. If you are using SSIS as your primary ETL tool then not to worry because <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> can give super power needed to complete your project on time with drag and drop high performance connectors.</p>
<p>Keywords: mongodb update array item | mongodb update array elements | mongodb update array documents | MongoDB $ operator | MongoDB update sub document items | MongoDB CRUD operations | MongoDB Bulk Updates | MongoDB bulk updates to array items</p>
<p>The post <a href="https://zappysys.com/blog/update-mongodb-array-items-using-ssis/">Update MongoDB Array Items using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
