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

<channel>
	<title>SSIS JSON Parser Transform Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/ssis/components/ssis-json-parser-transform/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/ssis/components/ssis-json-parser-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 JSON Parser Transform Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/ssis/components/ssis-json-parser-transform/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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 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 fetchpriority="high" 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>How to Pivot CSV Data in SSIS</title>
		<link>https://zappysys.com/blog/pivot-csv-data-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 19 Oct 2019 08:22:53 +0000</pubDate>
				<category><![CDATA[SSIS CSV Source]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS JSON Parser Transform]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=8207</guid>

					<description><![CDATA[<p>Introduction In our previous blog we saw How to write data into CSV file in SSIS (GZip / Split). Now in this blog, we will see How to Pivot CSV Data in SSIS using CSV Source. It also supports Pivot mode so you can convert single CSV string value into Rows. In this article we [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/pivot-csv-data-ssis/">How to Pivot CSV Data in 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/2018/02/ssis-csv-file-source.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="wp-image-3102 size-full alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-csv-file-source.png" alt="" width="100" height="100" /></a>In our previous blog we saw <a href="https://zappysys.com/blog/write-data-csv-file-ssis-gzip-split/" target="_blank" rel="noopener">How to write data into CSV file in SSIS (GZip / Split)</a>. Now in this blog, we will see <strong>How to Pivot CSV Data in SSIS using <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">CSV Source</a></strong>. It also supports Pivot mode so you can convert single CSV string value into Rows. In this article we also see how make some CSV columns as parent and not consider it in pivot and load it as it is using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a> Pivot Option.</p>
<p>In nutshell, this post will focus on how to Pivot CSV Data into multiple columns and rows.</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>How to Pivot CSV Data in SSIS using CSV File Source</h2>
<p>Let´s start with an example. In this SSIS CSV Parser Transform example, we will Parse database column string into multiple columns and rows.</p>
<ol>
<li>First of All, Drag and drop Data Flow Task from SSIS Toolbox and double click it to edit.
<div id="attachment_7934" style="width: 470px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7934" class="wp-image-7934 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png" alt="Drag and Drop SSIS Data Flow Task from SSIS Toolbox" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a><p id="caption-attachment-7934" class="wp-caption-text">Drag and Drop : SSIS Data Flow Task from SSIS Toolbox</p></div></li>
<li>Furthermore, drag and drop the CSV Source and Double click on it to configure it.
<div id="attachment_8212" style="width: 701px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8212" class="wp-image-8212 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png" alt="Drag and Drop : CSV Source from SSIS Toolbox" width="691" height="357" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png 691w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source-300x155.png 300w" sizes="(max-width: 691px) 100vw, 691px" /></a><p id="caption-attachment-8212" class="wp-caption-text">Drag and Drop : CSV Source from SSIS Toolbox</p></div></li>
<li>Enter the CSV file path and select desire column delimiter most common in CSV is comma and check the First Row as headers and click on preview.
<div id="attachment_8213" style="width: 683px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8213" class="wp-image-8213 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png" alt="CSV Source Preview" width="673" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png 673w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview-275x300.png 275w" sizes="(max-width: 673px) 100vw, 673px" /></a><p id="caption-attachment-8213" class="wp-caption-text">CSV Source Preview</p></div></li>
<li>Now, go to Pivot Columns to Rows Tab and checked Enable Pivoting and click on Preview Data to view the data.
<div id="attachment_8214" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8214" class="wp-image-8214 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview-768x643.png" alt="CSV Source Pivoted Data Preview" width="720" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview-768x643.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview-300x251.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-pivot-preview.png 874w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-8214" class="wp-caption-text">CSV Source Pivoted Data Preview</p></div></li>
<li>That&#8217;s it we see how to read data from CSV File and also Pivot the CSV Data using CSV Source.</li>
<li>Now In the next section we will see how to how make some CSV columns as parent and not consider it in pivot and load it as it is.</li>
</ol>
<h2>How make some CSV columns as parent.</h2>
<p>Sometimes you just need to make child columns in to rows and want to leave parent level columns as it is.</p>
<ol>
<li>First of All, Drag and drop Data Flow Task from SSIS Toolbox and double click it to edit.
<div id="attachment_7934" style="width: 470px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7934" class="wp-image-7934 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png" alt="Drag and Drop SSIS Data Flow Task from SSIS Toolbox" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/09/ssis-drag-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a><p id="caption-attachment-7934" class="wp-caption-text">Drag and Drop : SSIS Data Flow Task from SSIS Toolbox</p></div></li>
<li>Secondly, drag and drop the CSV Source and Double click on it to configure it.
<div id="attachment_8212" style="width: 701px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8212" class="wp-image-8212 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png" alt="Drag and Drop : CSV Source from SSIS Toolbox" width="691" height="357" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source.png 691w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-drag-drop-csv-source-300x155.png 300w" sizes="(max-width: 691px) 100vw, 691px" /></a><p id="caption-attachment-8212" class="wp-caption-text">Drag and Drop : CSV Source from SSIS Toolbox</p></div></li>
<li>Furthermore, enter the file path and click on preview.
<div id="attachment_8213" style="width: 683px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8213" class="wp-image-8213 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png" alt="CSV Source Preview" width="673" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview.png 673w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-source-preview-275x300.png 275w" sizes="(max-width: 673px) 100vw, 673px" /></a><p id="caption-attachment-8213" class="wp-caption-text">CSV Source Preview</p></div></li>
<li>For example if we want to pivot Email and Phone only in pivoting and wants to exclude parent level columns FirstName and LastName as it is.</li>
<li>For that drag and drop JSON Generator Transform and Select Output Mode as <strong>Output One JSON Per Parent Input Row</strong>  and Add Unbound Nested Element and named it as <strong>Persons and click on OK</strong>.
<div id="attachment_8277" style="width: 638px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8277" class="wp-image-8277 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element.png" alt="JSON Generator Add Unbound Nested Element" width="628" height="624" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element.png 628w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-300x298.png 300w" sizes="(max-width: 628px) 100vw, 628px" /></a><p id="caption-attachment-8277" class="wp-caption-text">JSON Generator Add Unbound Nested Element</p></div></li>
<li>Now add that two parent level fields FirstName and LastName in the Persons.
<div id="attachment_8278" style="width: 746px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8278" class="wp-image-8278 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple.png" alt="JSON Generator Add Multiple Elements" width="736" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple.png 736w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-300x254.png 300w" sizes="(max-width: 736px) 100vw, 736px" /></a><p id="caption-attachment-8278" class="wp-caption-text">JSON Generator Add Multiple Elements</p></div></li>
<li>Now select Person Element and right click and Add Unbound Nested Element and <strong>named it as Contacts and click on OK</strong>.
<div id="attachment_8279" style="width: 746px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-in-attribute.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8279" class="wp-image-8279 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-in-attribute.png" alt="JSON Generator Add Unbound Nested Element" width="736" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-in-attribute.png 736w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-unbound-nested-element-in-attribute-300x254.png 300w" sizes="(max-width: 736px) 100vw, 736px" /></a><p id="caption-attachment-8279" class="wp-caption-text">JSON Generator Add Unbound Nested Element</p></div></li>
<li>Now add that two child level fields Email and Phone in the Contacts.
<div id="attachment_8280" style="width: 746px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-attributes-2.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8280" class="wp-image-8280 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-attributes-2.png" alt="JSON Generator Add Multiple Elements" width="736" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-attributes-2.png 736w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-add-multiple-attributes-2-300x254.png 300w" sizes="(max-width: 736px) 100vw, 736px" /></a><p id="caption-attachment-8280" class="wp-caption-text">JSON Generator Add Multiple Elements</p></div></li>
<li>Therefore JSON Generator Transform looks like below screen. Now Copy that Sample Preview JSON String to use it in the JSON Parser Transom as sample string.
<div id="attachment_8276" style="width: 743px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-sample-data.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8276" class="wp-image-8276 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-sample-data.png" alt="JSON Generator Transform - Sample Data" width="733" height="833" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-sample-data.png 733w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-generator-sample-data-264x300.png 264w" sizes="(max-width: 733px) 100vw, 733px" /></a><p id="caption-attachment-8276" class="wp-caption-text">JSON Generator Transform &#8211; Sample Data</p></div></li>
<li>Similarly, drag and drop JSON Parser Transform and select the Input JSON Column and Paste that copied Sample JSON String and select the Contacts filter to read the Child data and click on Include Parent.
<div id="attachment_8281" style="width: 853px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8281" class="wp-image-8281 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter.png" alt="JSON Parser Transform - Select Filter " width="843" height="650" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter.png 843w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter-300x231.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-select-filter-768x592.png 768w" sizes="(max-width: 843px) 100vw, 843px" /></a><p id="caption-attachment-8281" class="wp-caption-text">JSON Parser Transform &#8211; Select Filter</p></div></li>
<li>Now go to Pivot Columns to Rows Tab and checked the Enable Pivoting and click on the Preview.
<div id="attachment_8282" style="width: 608px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-enable-pivoting.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8282" class="wp-image-8282 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-enable-pivoting.png" alt="JSON Parser Transform - Enable Pivoting" width="598" height="656" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-enable-pivoting.png 598w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-json-parser-enable-pivoting-273x300.png 273w" sizes="(max-width: 598px) 100vw, 598px" /></a><p id="caption-attachment-8282" class="wp-caption-text">JSON Parser Transform &#8211; Enable Pivoting</p></div></li>
<li>Finally, we are ready to load this data.
<div id="attachment_8283" style="width: 887px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8283" class="wp-image-8283 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer.png" alt="CSV Pivoted Data" width="877" height="388" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer.png 877w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer-300x133.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/10/ssis-csv-pivot-data-viewer-768x340.png 768w" sizes="(max-width: 877px) 100vw, 877px" /></a><p id="caption-attachment-8283" class="wp-caption-text">CSV Pivoted Data</p></div></li>
<li>Let&#8217;s load this data in the SQL Server.</li>
</ol>
<h2><span id="Load_Walmart_API_data_into_SQL_Server">Load Pivoted CSV File data into SQL Server</span></h2>
<div class="content_block" id="custom_post_widget-5617"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination</strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.</p>
<h3>Step 1: Add Upsert Destination to Data Flow</h3>
<ol>
<li>Drag and drop the <strong>Upsert Destination</strong> component from the SSIS Toolbox.</li>
<li>Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png" /></a>
<p class="wp-caption-text">SSIS - Data Flow - Drang and Drop Upsert Destination Component</p>
</div>
<h3>Step 2: Configure Target Connection</h3>
<ol>
<li>Double-click the <strong>Upsert Destination</strong> component to open the configuration window.</li>
<li>Under <strong>Connection</strong>, select an existing target connection or click <strong>NEW</strong> to create a new connection.
<ul>
<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.</li>
</ul>
</li>
</ol>
<h3>Step 3: Select or Create Target Table</h3>
<ol>
<li>In the <strong>Target Table</strong> dropdown, select the table where you want to load data.</li>
<li>Optionally, click <strong>NEW</strong> to create a new table based on the source columns.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png" /></a>
<p class="wp-caption-text">Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS</p>
</div>
<h3>Step 4: Map Columns</h3>
<ol>
<li>Go to the <strong>Mappings</strong> tab.</li>
<li>Click <strong>Auto Map</strong> to map source columns to target columns by name.</li>
<li>Ensure you <strong>check the Primary key column(s)</strong> that will determine whether a record is inserted or updated.</li>
<li>You can manually adjust the mappings if necessary.</li>
</ol>
 <div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination - Columns Mappings</p>
</div>
<h3>Step 5: Save Settings</h3>
<ul>
<li>Click <strong>OK</strong> to save the Upsert Destination configuration.</li>
</ul>
<h3>Step 6: Optional: Add Logging or Analysis</h3>
<ul>
<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.</li>
</ul>
<h3>Step 7: Execute the Package</h3>
<ul>
<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.</li>
</ul>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination Execution</p>
</div></div>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>After all, we saw you how to read CSV file data, pivot the data and Similarly, using SSIS JSON Generator and Parser Transform Pivot the CSV Data excluding some columns from pivoting.  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 URL for more information.</p>
<ul>
<li>Help File: <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=ssis-csv-source.htm" target="_blank" rel="noopener">CSV Source</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/pivot-csv-data-ssis/">How to Pivot CSV Data in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read YouTube API data in SSIS (Videos, Channels, Playlists)</title>
		<link>https://zappysys.com/blog/read-youtube-api-data-ssis-videos-channels-playlists/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 06 May 2019 18:06:07 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS CSV Generator Transform]]></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 REST API Task]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[youtube]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6894</guid>

					<description><![CDATA[<p>Introduction In last few articles we saw how to read data from various Google Services. In this article we will see how to read YouTube API data in SSIS. This blog mainly focus on SSIS approach but steps mentioned to call Google APIs can be useful for any developer regardless which programming language or toolset [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-youtube-api-data-ssis-videos-channels-playlists/">How to read YouTube API data in SSIS (Videos, Channels, Playlists)</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/youtube-connector/">API Connector for YouTube</a> which makes it much simpler to <strong>Read/Write YouTube 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/2019/05/youtube-logo.png"><img loading="lazy" decoding="async" class=" wp-image-6904 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo.png" alt="" width="100" height="100" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo.png 400w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo-300x300.png 300w" sizes="(max-width: 100px) 100vw, 100px" /></a>In last <a href="https://zappysys.com/blog/category/google-api/">few articles</a> we saw how to read data from various Google Services. In this article we will see how to read YouTube API data in SSIS. This blog mainly focus on SSIS approach but steps mentioned to call Google APIs can be useful for any developer regardless which programming language or toolset you use.</p>
<p>&nbsp;</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>Connect to YouTube API in SSIS (OAuth Connection)</h2>
<p>Very first step to call any Google API is to create an API project for Google Service and then enable APIs you like to call in Console. In our case we need to enable YouTube API.</p>
<p><a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Check this article</a> to learn how to create API Project and obtain Client ID and Client Secret to connect to YouTube API. For ease of use use Default Application provided by ZappySys but we still recommend using your own Custom Application  on OAuth Connection.</p>
<p>Before we try our first YouTube API example, we recommend you to get familiar with <a href="https://developers.google.com/youtube/v3/docs/" target="_blank" rel="noopener">YouTube API here</a>. Once you done with above steps you can perform the following steps to call YouTube API in SSIS.</p>
<ol>
<li>Open existing SSIS Project or Create new One in Visual Studio (i.e. SSDT)</li>
<li>Create a new SSIS Package. Right click in the Connection Manager Panel and click <strong>&#8220;New Connection&#8230;&#8221;</strong>.<br />
<img decoding="async" class="figureimage" title="SSIS Create New Connection" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/ssis-new-connection.png" alt="SSIS Create New Connection" /></li>
<li>When Dialog box opens select <strong>ZS-OAUTH</strong> connection type.
<div id="attachment_4724" style="width: 681px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4724" class="size-full wp-image-4724" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png" alt="SSIS Connection Maangers List: Select O-AUTH Connection Manager" width="671" height="549" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png 671w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager-300x245.png 300w" sizes="(max-width: 671px) 100vw, 671px" /></a><p id="caption-attachment-4724" class="wp-caption-text">SSIS Connection Managers List: Select O-AUTH Connection Manager</p></div></li>
<li>Once OAuth UI opens, Configure Google connection like below.
<ol>
<li>Select Service Type as <strong>Google</strong></li>
<li>You can select Default App for ease of use or Select Custom Application (Enter Client Id and Secret Obtained using <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">these steps</a> )</li>
<li>In the Scope Enter below &#8211; One scope per line for calling correct YouTube API. Refer to <a href="https://developers.google.com/youtube/v3/docs/" target="_blank" rel="noopener">YouTube API documentation</a> incase you need extra permissions. For read only operation we just need below scopes. Last scope is only needed if you need to use <a href="https://developers.google.com/youtube/analytics/reference/reports/query" target="_blank" rel="noopener">YouTube Analytics Reports</a><br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/yt-analytics.readonly</pre>
</li>
</ol>
</li>
<li>Click Generate Token to obtain Refresh Token (You may see Login Prompt, and then Grant Permission Confirmation Screen)
<div id="attachment_6855" style="width: 930px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6855" class="size-full wp-image-6855" src="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png" alt="Connect to Google API using OAuth 2.0 (Youtube API Example)" width="920" height="1032" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png 920w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-267x300.png 267w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-768x861.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-913x1024.png 913w" sizes="(max-width: 920px) 100vw, 920px" /></a><p id="caption-attachment-6855" class="wp-caption-text">Connect to Google API using OAuth 2.0 (YouTube API Example)</p></div></li>
<li>Click OK to save UI.</li>
</ol>
<h2>Call YouTube REST API Example</h2>
<p>Now lets look at how to call YouTube API <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> this task is more suitable to call GET, POST, DELETE, PUT requests without parsing data in Rows and Columns. If you need to parse data and load into Database table then see next section (Use JSON Source)</p>
<ol>
<li>From SSIS Toolbox look for items starting with “ZS”. Drag and Drop <b>[ZS Rest API Task]</b> to Designer Surface.<br />
<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Double click it to configure like below.
<ol>
<li>Select URL From Connection option</li>
<li>Select OAuth connection created in previous section.</li>
<li>Enter URL like below (For example <a href="https://developers.google.com/youtube/v3/docs/playlists/list" target="_blank" rel="noopener">get all playlists</a>). Replace xxxxxxxxxxx with your own channel ID (Its usually found in URL when you visit Youtube Channel Homepage)<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/playlists?part=snippet,id&amp;channelId=xxxxxxxxxxxxx</pre>
</li>
<li>Click Test Request Button</li>
</ol>
</li>
<li>Here is how it looks like
<div id="attachment_6896" style="width: 854px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6896" class="size-full wp-image-6896" src="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url.png" alt="Call Youtube API in SSIS Example (Dynamic URL)" width="844" height="640" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url.png 844w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url-300x227.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url-768x582.png 768w" sizes="(max-width: 844px) 100vw, 844px" /></a><p id="caption-attachment-6896" class="wp-caption-text">Call Youtube API in SSIS Example (Dynamic URL)</p></div></li>
</ol>
<p>That&#8217;s it we have successfully configured Connection for YouTube API in SSIS. In the next section we will see how to use this connection and read various data from YouTube API.</p>
<h2>Read YouTube Playlists in SSIS</h2>
<p>Once we done creating OAuth Connection Manager we can move forward to read YouTube data inside Data Flow.</p>
<p>Configure SSIS JSON / REST API Source</p>
<ol>
<li>Now, Drag and Drop SSIS <b>Data Flow Task</b> from SSIS Toolbox.<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Double click on the Data Flow task to see Data Flow designer surface.</li>
<li>From the SSIS toolbox drag and drop JSON Source on the dataflow designer surface.<br />
<img decoding="async" class="figureimage" title="SSIS JSON Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="SSIS JSON Source - Drag and Drop" /></li>
<li>Double click JSON Source and enter URL as below (Use variable or Hardcode Channel Id). maxResults controls how many rows you want to get in each response. Rep<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/playlists?part=snippet,id&amp;maxResults=50&amp;channelId={{User::varChannelId}}
--OR-- 
https://www.googleapis.com/youtube/v3/playlists?part=snippet,id&amp;maxResults=50&amp;channelId=xxxxxxxxxxxxxxxxxxxxxx</pre>
</li>
<li>Check Use Credentials and select existing OAuth connection or Create New one</li>
<li>Select Array Filter (Items node) or type <pre class="crayon-plain-tag">$.items[*]</pre>  as below.
<div id="attachment_6900" style="width: 857px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6900" class="size-full wp-image-6900" src="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists.png" alt="Get Playlists for YouTube Channel" width="847" height="738" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists.png 847w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists-768x669.png 768w" sizes="(max-width: 847px) 100vw, 847px" /></a><p id="caption-attachment-6900" class="wp-caption-text">Get Playlists for YouTube Channel</p></div></li>
<li>That&#8217;s it you can now Click <strong>Preview</strong> to see sample data. In the next section we will configure Pagination to read all records if you have more than 100 rows.</li>
</ol>
<h3>Configure YouTube REST API Pagination</h3>
<p>Most REST APIs dont return data in one big response. So you have to make sure you implement looping / pagination to read more records. Luckily ZappySys supports <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/">many different Pagination Settings</a>. Here is how to configure YouTube REST API Pagination.</p>
<ol>
<li>Go to Pagination Tab found on JSON Source and select following 3 settings</li>
<li>Select Pagination Mode as <pre class="crayon-plain-tag">Response Attribute Mode</pre></li>
<li>Enter Next Link as <pre class="crayon-plain-tag">$.nextPageToken</pre></li>
<li>Enter Suffix for Next URL as <pre class="crayon-plain-tag">&amp;pageToken=&lt;%nextlink%&gt;</pre></li>
</ol>
<div id="attachment_6899" style="width: 555px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-rest-api-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6899" class="size-full wp-image-6899" src="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-rest-api-pagination.png" alt="YouTube REST API Pagination Settings" width="545" height="246" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-rest-api-pagination.png 545w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-rest-api-pagination-300x135.png 300w" sizes="(max-width: 545px) 100vw, 545px" /></a><p id="caption-attachment-6899" class="wp-caption-text">YouTube REST API Pagination Settings</p></div>
<h2>Read YouTube Playlist Videos in SSIS</h2>
<p>So in previous section we saw simple API call to read all playlists from YouTube. Now lets see how to get information about <a href="https://developers.google.com/youtube/v3/docs/playlistItems/list" target="_blank" rel="noopener">Playlist Videos</a>.</p>
<p>For that everything should remain same as previous section except change URL as below. Where xxxxxxxxxxxxxxxxxxxxx is your Playlist ID obtained from Previous Call.</p><pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,id&amp;maxResults=50&amp;playlistId=xxxxxxxxxxxxxxxxxxxxx</pre><p>
<h2>Get all Videos for YouTube Channel</h2>
<p>If you want to get all video name and ID for specific channel then use below URL. Click here to <a href="https://developers.google.com/youtube/v3/docs/search/list" target="_blank" rel="noopener">read more</a>. Replace xxxxxxxxxxxxxxxxxxx with your Channel ID.</p><pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/search?channelId=xxxxxxxxxxxxxxxxxxx&amp;part=snippet,id&amp;order=date&amp;maxResults=50</pre><p>
&nbsp;</p>
<h2>Read YouTube Video Views, Likes, Dislikes (Extended Videos)</h2>
<p>Another common request from YouTube API is get Video Information such as Views, Likes, Dislikes, Comment Count etc. For that you can <a href="https://developers.google.com/youtube/v3/docs/videos/list" target="_blank" rel="noopener">use this api</a> . However the issue is this endpoint requires you to pass Comma separated Ids of Video. You can only pass 25 Ids in one requests so if you have 200 videos for which you need to get information then you have to make 8 requests (25 Ids in each Request). In below screenshot you can see we used <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler to debug web requests</a>.</p>
<p>So here is how high level process to fetch extended information for all Videos in your channel. Full <a href="https://zappysys.com/blog/wp-content/uploads/2019/05/Google_Youtube_API_Demo.zip">SSIS Package is attached here (SSIS 2012 Format)</a>.</p>
<ol>
<li>Get all videos for your channel by calling (Assuming you will paginate in below request.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/search?channelId=xxxxxxxxxxxxxxxxxxx&amp;part=snippet,id&amp;order=date&amp;maxResults=50</pre>
</li>
<li>Build Video Id groups for 25 Ids from above result and submit requests. For example if above request returns 200 Videos then your request to fetch extended information may look like below.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&amp;id=ID1,ID2,ID3........ID25
https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&amp;id=ID26,ID27,ID28........ID50
........
........
https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&amp;id=ID176,ID177,ID178........ID200</pre>
</li>
<li>Parse response coming from each Request Above&#8230;. Each Response will give you details about 25 videos you requesting.</li>
</ol>
<p>Here is the flow of our complete data flow to read extended information for all videos. You can read extended information one by one too but it wont be good idea if you have many videos.</p>
<p>We have used Following Components to achieve Bulk Mode</p>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source (REST API Source)</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-parser-transform/" target="_blank" rel="noopener">CSV Parser Transform</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></li>
</ul>
<div id="attachment_6901" style="width: 1306px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6901" class="size-full wp-image-6901" src="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes.png" alt="Get YouTube Video View Clicks, Likes, Dislikes (Bulk Mode for all videos)" width="1296" height="823" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes.png 1296w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes-300x191.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes-768x488.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes-1024x650.png 1024w" sizes="(max-width: 1296px) 100vw, 1296px" /></a><p id="caption-attachment-6901" class="wp-caption-text">Get YouTube Video View Clicks, Likes, Dislikes (Bulk Mode for all videos)</p></div>
<h2>Read data from YouTube Analytics / Reporting API (Metrics, Dimensions Report)</h2>
<p>So far we have seen basic YouTube APIs to extract your Channel information. However there is another very powerful API endpoint to query custom reports from YouTube. Check <a href="https://developers.google.com/youtube/analytics/reference/reports/query" target="_blank" rel="noopener">this YouTube Analytics API endpoint</a>. In this section we will learn how to extract useful information from YouTube using Analytics API.</p>
<h3>Step-By-Step</h3>
<p>Let&#8217;s look at an example to read total views, estimated watch time, average view duration and some other metrics by date for channel you have access.</p>
<ol>
<li>Go to Data Flow, Drag ZS JSON Source from SSIS Toolbox</li>
<li>Double click to configure.</li>
<li>Check Use Credentials. Select OAuth connection we created in previous section.</li>
<li>In the URL field, Enter Below Sample URL. Change Parameters as per your need or leave it default.<br />
For example:<br />
<strong>ids=channel==MINE</strong>   (where MINE can be replaced by other channel id or keep it as MINE to get data for your own channel)<br />
<strong>metrics</strong> (can be changed from any <a href="https://developers.google.com/youtube/analytics/metrics" target="_blank" rel="noopener">valid list here</a>)<br />
<strong>dimensions</strong> (can be changed to any valid <a href="https://developers.google.com/youtube/analytics/dimensions" target="_blank" rel="noopener">list from here</a>)<br />
<strong>startDate</strong> (Must be YYYY-MM-DD format)<br />
<strong>endDate</strong> (Must be YYYY-MM-DD format)<br />
<pre class="crayon-plain-tag">https://youtubeanalytics.googleapis.com/v2/reports?ids=channel==MINE&amp;metrics=views,estimatedMinutesWatched,averageViewDuration,averageViewPercentage,subscribersGained&amp;dimensions=day&amp;startDate=2019-03-01&amp;endDate=2019-04-01</pre>
</li>
<li>Change Filter to <pre class="crayon-plain-tag">$.rows[*]</pre></li>
<li>Go to <strong>2D Array Transform</strong> tab.<br />
Select Method as <pre class="crayon-plain-tag">Simple 2-dimensional array</pre>
EnterColumn Filter as  <pre class="crayon-plain-tag">$.columnHeaders[*].name</pre>
<div id="attachment_6909" style="width: 906px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6909" class="size-full wp-image-6909" src="https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api.png" alt="YouTube Analytics API Advanced Transformation" width="896" height="270" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api.png 896w, https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api-300x90.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api-768x231.png 768w" sizes="(max-width: 896px) 100vw, 896px" /></a><p id="caption-attachment-6909" class="wp-caption-text">YouTube Analytics API Advanced Transformation</p></div></li>
<li>That&#8217;s it now Preview your data. See below over all steps.
<div id="attachment_6910" style="width: 978px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6910" class="size-full wp-image-6910" src="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics.png" alt="Read data from YouTube Analytics API (Custom Reports using Dimensions, Metrics Query)" width="968" height="741" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics.png 968w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics-300x230.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics-768x588.png 768w" sizes="(max-width: 968px) 100vw, 968px" /></a><p id="caption-attachment-6910" class="wp-caption-text">Read data from YouTube Analytics API (Custom Reports using Dimensions, Metrics Query)</p></div></li>
</ol>
<h3>Build YouTube Analytics / Reporting API Query (API Playground)</h3>
<p>With Analytics API You can extract many interesting data. You can use Test Tool found <a href="https://developers.google.com/youtube/analytics/reference/reports/query" target="_blank" rel="noopener">on this page to build</a> some interesting queries. Scroll to <strong>Common Use Cases</strong> section on that link. On the right side you can select Credentials Type as OAuth and click Execute.</p>
<p><a href="https://developers.google.com/youtube/analytics/reference/reports/query" target="_blank" rel="noopener">https://developers.google.com/youtube/analytics/reference/reports/query</a></p>
<div id="attachment_6911" style="width: 944px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6911" class="size-full wp-image-6911" src="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder.jpg" alt="YouTube Analytics / Reporting API Explorer (Testing API Calls)" width="934" height="688" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder.jpg 934w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder-300x221.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder-768x566.jpg 768w" sizes="(max-width: 934px) 100vw, 934px" /></a><p id="caption-attachment-6911" class="wp-caption-text">YouTube Analytics / Reporting API Explorer (Testing API Calls)</p></div>
<h2>Loading YouTube API Data into SQL Server</h2>
<div class="content_block" id="custom_post_widget-5617"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination</strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.</p>
<h3>Step 1: Add Upsert Destination to Data Flow</h3>
<ol>
<li>Drag and drop the <strong>Upsert Destination</strong> component from the SSIS Toolbox.</li>
<li>Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png" /></a>
<p class="wp-caption-text">SSIS - Data Flow - Drang and Drop Upsert Destination Component</p>
</div>
<h3>Step 2: Configure Target Connection</h3>
<ol>
<li>Double-click the <strong>Upsert Destination</strong> component to open the configuration window.</li>
<li>Under <strong>Connection</strong>, select an existing target connection or click <strong>NEW</strong> to create a new connection.
<ul>
<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.</li>
</ul>
</li>
</ol>
<h3>Step 3: Select or Create Target Table</h3>
<ol>
<li>In the <strong>Target Table</strong> dropdown, select the table where you want to load data.</li>
<li>Optionally, click <strong>NEW</strong> to create a new table based on the source columns.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png" /></a>
<p class="wp-caption-text">Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS</p>
</div>
<h3>Step 4: Map Columns</h3>
<ol>
<li>Go to the <strong>Mappings</strong> tab.</li>
<li>Click <strong>Auto Map</strong> to map source columns to target columns by name.</li>
<li>Ensure you <strong>check the Primary key column(s)</strong> that will determine whether a record is inserted or updated.</li>
<li>You can manually adjust the mappings if necessary.</li>
</ol>
 <div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination - Columns Mappings</p>
</div>
<h3>Step 5: Save Settings</h3>
<ul>
<li>Click <strong>OK</strong> to save the Upsert Destination configuration.</li>
</ul>
<h3>Step 6: Optional: Add Logging or Analysis</h3>
<ul>
<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.</li>
</ul>
<h3>Step 7: Execute the Package</h3>
<ul>
<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.</li>
</ul>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination Execution</p>
</div></div>
<h2>Download Sample SSIS Package</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/Google_Youtube_API_Demo.zip">SSIS Package is attached here (SSIS 2012 Format)</a>.</p>
<h2>Conclusion</h2>
<p>In this article we saw how to extract information from REST API such as YouTube REST API using OAuth 2.0. We also learned techniques like Pagination, JSON Parsing, Request Batching using multiple components to achieve full scale API integration. 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>
<p>The post <a href="https://zappysys.com/blog/read-youtube-api-data-ssis-videos-channels-playlists/">How to read YouTube API data in SSIS (Videos, Channels, Playlists)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS Geocoding with Google Maps API</title>
		<link>https://zappysys.com/blog/ssis-geocoding-with-google-maps-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 14 Sep 2018 14:02:23 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS JSON Parser Transform]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[geocoding]]></category>
		<category><![CDATA[geocoding api]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google maps api]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[reverse geocoding]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=4821</guid>

					<description><![CDATA[<p>Introduction In this tutorial, we will cover the topics of how to perform geocoding on the addresses and reverse geocoding on the location coordinates using SSIS and Google Maps API. So what is geocoding, exactly? Geocoding is the process of translating an address (e.g. a street address) or a place to coordinates on the Earth&#8217;s surface. Simply [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-geocoding-with-google-maps-api/">SSIS Geocoding with Google Maps API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><img loading="lazy" decoding="async" class="wp-image-4852 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/09/icons8-google-maps-180-e1537353957364.png" alt="" width="100" height="100" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/icons8-google-maps-180-e1537353957364.png 155w, https://zappysys.com/blog/wp-content/uploads/2018/09/icons8-google-maps-180-e1537353957364-150x150.png 150w" sizes="(max-width: 100px) 100vw, 100px" /></p>
<p style="text-align: justify;">In this tutorial, we will cover the topics of how to perform <em>geocoding</em> on the addresses and <em>reverse geocoding</em> on the location coordinates using SSIS and <a href="https://developers.google.com/maps/documentation/" rel="noopener">Google Maps API</a>. So what is <em>geocoding,</em> exactly? <em>Geocoding</em> is the process of translating an address (e.g. a street address) or a place to coordinates on the Earth&#8217;s surface. Simply put, <em>geocoding</em> takes a description of a location and gives back latitude and longitude values as a result. For example, <pre class="crayon-plain-tag">1600 Amphitheatre Parkway, Mountain View, CA 94043, USA</pre>  gets translated to <pre class="crayon-plain-tag">(37.4224764, -122.0842499)</pre>. <em>Reverse geocoding</em>, on the other hand, is the exact opposite process. In it, latitude and longitude values pair gets translated into a human-readable form. To take the same example above,  <pre class="crayon-plain-tag">(37.4224764, -122.0842499)</pre> would translate back to <pre class="crayon-plain-tag">1600 Amphitheatre Parkway, Mountain View, CA 94043, USA</pre>. So, if you need to perform any of the lookups, you can use <a href="https://developers.google.com/maps/documentation/geocoding/start" rel="noopener">Google Maps Geocoding API</a>. Actually, Google Maps Geocoding API offers a bit more <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– you can use it for <em>address validation</em>, <em>cleansing</em>, and <em>formatting</em>.</span></span></span></span></p>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> If it happens that you need to use other geocoding provider and perform the lookups in SSIS, you may still benefit from this article (the examples of usage of Google Maps Geocoding API can be replaced by another provider). </div></div>
<p style="text-align: justify;">To accomplish our goal we will use an add-on for SSIS <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– <a href="https://zappysys.com/products/ssis-powerpack/" rel="noopener">ZappySys SSIS PowerPack</a></span></span></span></span><span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">.</span></span></span></span> It contains many additional SSIS Tasks and Data Flow Components that lets you accomplish what you cannot do with standard SSIS connectors. We will use these <a href="https://zappysys.com/products/ssis-powerpack/" rel="noopener">ZappySys SSIS PowerPack</a> connectors:</p>
<div class="content_block" id="custom_post_widget-5067"><div style="display: table-row; background: #f7f7f7;">
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc;"><img loading="lazy" decoding="async" style="vertical-align: middle; width: 50px; height: 50px; max-width: 50px;" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination.png" alt="Web API Destination" width="50" height="50" /></div>
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc; border-left: none; width: 100%;"><a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></div>
</div></div>
<div class="content_block" id="custom_post_widget-5078"><div style="display: table-row; background: #f7f7f7;">
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc;"><img loading="lazy" decoding="async" style="vertical-align: middle; width: 50px; height: 50px; max-width: 50px;" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-parser-transform/ssis-json-parser-transform.png" alt="JSON Parser Transform" width="50" height="50" /></div>
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc; border-left: none; width: 100%;"><a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></div>
</div></div>
<p>Let&#8217;s start!</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><span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS">Step-by-Step <span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– </span></span></span></span>SSIS Geocoding with Google Maps API</h2>
<p style="text-align: justify;">Before we start, let&#8217;s consider the use-case for our tutorial. Suppose, you have a CRM system filled with user-entered addresses of your leads. Since they are user-entered, it means that they can be incomplete, malformed, or just plain rubbish. Also, you have a marketing campaign and you want to send letters with offers to your leads so that they become your clients. Before sending them any letters, you have to make sure the addresses are valid and well-formed. You are also interested in the geographical location of your leads that you could do some business intelligence analysis on the coordinates of your leads and maybe future clientele. Here is where Geocoding API kicks in.</p>
<p style="text-align: justify;">Thus in this example, we will take various street addresses <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– sometimes invalid, </span></span></span></span>incomplete or unformatted <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– and submit them to Google Geocoding API for processing. </span></span></span></span><span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">As a result, we will get nicely formatted, cleansed, full addresses and their coordinates. We will take a look on how to determine if lookup worked successfully and to what extent you should trust Geocoding API&#8217;s response. Finally, we will save retrieved addresses and their individual components (e.g. street number, street name, city, country, etc.) to a SQL Server database table.</span></span></span></span></p>
<div class="content_block" id="custom_post_widget-5017"><h3>Create a Google project</h3>
First, to use a Google API, you need to have a Google project. Create one, if you don't have any or want to use a new project:
<ol>
 	<li>Go to <a href="https://console.cloud.google.com/home/dashboard" target="_blank" rel="noopener">Google Console</a> and click on the projects list:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4923" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list.png" alt="" width="603" height="243" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list.png 603w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list-300x121.png 300w" sizes="(max-width: 603px) 100vw, 603px" /></li>
 	<li>Once a window opens, click "New Project":
<img loading="lazy" decoding="async" class="alignnone wp-image-4924 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-create-new-project-1-e1538487942630.png" alt="" width="731" height="258" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-create-new-project-1-e1538487942630.png 731w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-create-new-project-1-e1538487942630-300x106.png 300w" sizes="(max-width: 731px) 100vw, 731px" /></li>
 	<li>Give a name for the project and click "Create":
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4925" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-give-name-for-project.png" alt="" width="603" height="379" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-give-name-for-project.png 603w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-give-name-for-project-300x189.png 300w" sizes="(max-width: 603px) 100vw, 603px" /></li>
 	<li>Wait a couple of minutes for the project to create.</li>
 	<li>Again, click on the projects drop-down list:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4926" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list-1.png" alt="" width="603" height="243" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list-1.png 603w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list-1-300x121.png 300w" sizes="(max-width: 603px) 100vw, 603px" /></li>
 	<li>Finally, select the project you've just created:
<img loading="lazy" decoding="async" class="alignnone wp-image-4927 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-the-project-e1538487850139.png" alt="" width="721" height="355" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-the-project-e1538487850139.png 721w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-the-project-e1538487850139-300x148.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-the-project-e1538487850139-720x355.png 720w" sizes="(max-width: 721px) 100vw, 721px" /></li>
</ol></div>
<div class="content_block" id="custom_post_widget-5025"><h3>Enable billing for the project</h3>
Not all Google APIs are free. So you'll have to add billing for the project you have just created:
<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>: As of September 21, 2018, Google offers 300 USD credit for free (but you will still need to create a billing account).</div>
</div>
<ol>
 	<li>Visit <a href="https://console.cloud.google.com/project/_/billing/enable?redirect=https://developers.google.com/maps/documentation/geocoding/usage-and-billing?dialogOnLoad%3Dbilling-enabled" target="_blank" rel="noopener">Billing on Google Console</a> page.</li>
 	<li>Once it's opened, select the project:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4928" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-project-list.png" alt="" width="641" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-project-list.png 641w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-project-list-300x180.png 300w" sizes="(max-width: 641px) 100vw, 641px" /></li>
 	<li>Once a list of projects appears, select the one you created.</li>
 	<li>Then you will be prompted to create a billing account. Proceed to create one:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4929" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-create-account.png" alt="" width="514" height="202" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-create-account.png 514w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-create-account-300x118.png 300w" sizes="(max-width: 514px) 100vw, 514px" /></li>
</ol></div>
<div class="content_block" id="custom_post_widget-5031"><h3>Enable Google API for your project</h3>
To use any Google API you must enable it for your project:
<ol>
 	<li>Visit <a href="https://console.cloud.google.com/apis" target="_blank" rel="noopener">Google APIs Dashboard</a> page.</li>
 	<li>Make sure your project is selected and then click "Enable APIs and services":
<img loading="lazy" decoding="async" class="alignnone wp-image-4931 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-enable-api-for-the-project-e1538488797230.png" alt="" width="718" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-enable-api-for-the-project-e1538488797230.png 718w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-enable-api-for-the-project-e1538488797230-300x114.png 300w" sizes="(max-width: 718px) 100vw, 718px" /></li>
 	<li>Then in the box which appears, search for API you are interested in, e.g. "geocoding":
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4934" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-search-for-api-1.png" alt="" width="645" height="303" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-search-for-api-1.png 645w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-search-for-api-1-300x141.png 300w" sizes="(max-width: 645px) 100vw, 645px" /></li>
 	<li>Finally, click on the Google API (e.g. "Geocoding API") tile:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4935" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-geocoding-api.png" alt="" width="654" height="405" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-geocoding-api.png 654w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-geocoding-api-300x186.png 300w" sizes="(max-width: 654px) 100vw, 654px" /></li>
 	<li>Finally finally, enable Google API:
<img loading="lazy" decoding="async" class="alignnone wp-image-4936 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-enable-geocoding-api-e1537539131256.png" alt="" width="647" height="343" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-enable-geocoding-api-e1537539131256.png 647w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-enable-geocoding-api-e1537539131256-300x159.png 300w" sizes="(max-width: 647px) 100vw, 647px" /></li>
</ol></div>
<div class="content_block" id="custom_post_widget-5035"><h3>Create Geocoding API Key</h3>
Once you have Google API enabled, you are ready to create a Google API Key, which you will use in all HTTP requests:
<ol>
 	<li>Go to <a href="https://console.cloud.google.com/apis/dashboard" target="_blank" rel="noopener">Google APIs Dashboard</a>.</li>
 	<li>Make sure you have your project selected, then select "Credentials" menu item and create a new API Key:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4937" src="https://zappysys.com/blog/wp-content/uploads/2018/09/sssi-google-api-how-to-create-api-key.png" alt="" width="695" height="434" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/sssi-google-api-how-to-create-api-key.png 695w, https://zappysys.com/blog/wp-content/uploads/2018/09/sssi-google-api-how-to-create-api-key-300x187.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/sssi-google-api-how-to-create-api-key-436x272.png 436w" sizes="(max-width: 695px) 100vw, 695px" /></li>
 	<li>Copy the newly created API Key to a safe place; we will use it later.</li>
</ol></div>
<h3>Load addresses from a SQL Server database table</h3>
<p>We prepared the Google Geocoding API part, now we are ready to get to the place where the rubber meets the road <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– </span></span></span></span>we will create an SSIS package and load addresses from a database table:</p>
<ol>
<li>Create a new SSIS package.</li>
<li>Drag and drop <strong>Data Flow</strong> from SSIS Toolbox onto the Control Flow.
<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 and drop <strong>OLE DB Source</strong> onto the Data Flow.</li>
<li>Configure <strong>OLE DB Source</strong> to retrieve addresses from your table. We will use a table from Microsoft&#8217;s Northwind&#8217;s modified database &#8220;Marketing&#8221; (<a href="https://zappysys.com/blog/wp-content/uploads/2018/09/Marketing-database-script.zip">download it</a>):</li>
</ol>
<div id="attachment_4949" style="width: 718px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4949" class="wp-image-4949 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642.png" alt="Loading user-entered addresses to be looked up in Google Geocoding API using SSIS." width="708" height="704" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642.png 708w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642-300x298.png 300w" sizes="(max-width: 708px) 100vw, 708px" /></a><p id="caption-attachment-4949" class="wp-caption-text">Loading user-entered addresses to be looked up in Google Geocoding API using SSIS.</p></div>
<h3>Construct lookup URL</h3>
<ol>
<li>Drag and drop <strong>Derived Column</strong> component onto the Data Flow.</li>
<li>Add a new column and construct Geocoding lookup URL in this format (just like it says in <a href="https://developers.google.com/maps/documentation/geocoding/start" rel="noopener">Geocoding API documentation</a>):</li>
</ol>
<pre class="crayon-plain-tag">https://maps.googleapis.com/maps/api/geocode/json?address=ADDRESS_TO_LOOKUP&amp;key=YOUR_API_KEY</pre>
<div id="attachment_4959" style="width: 729px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-construct-url-e1538140223385.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4959" class="wp-image-4959 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-construct-url-e1538140223385.png" alt="Adding Google Geocoding API lookup URL as Derived Column to be used for geocoding in SSIS." width="719" height="510" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-construct-url-e1538140223385.png 719w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-construct-url-e1538140223385-300x213.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></a><p id="caption-attachment-4959" class="wp-caption-text">Adding Google Geocoding API lookup URL as Derived Column to be used for geocoding in SSIS.</p></div>
<h3>Configure the Geocoding API request</h3>
<ol>
<li>Drag and drop <strong>Web API Destination</strong> onto the Data Flow and connect it with Derived Column. We will use Web API Destination to make HTTP requests to Geocoding API.</li>
<li>Then double-click on Web API Destination and create a new HTTP connection:
<div id="attachment_4962" style="width: 796px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4962" class="wp-image-4962 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection.png" alt="Setting up HTTP Connection Manager for Web API Destination to make HTTP requests to Google Geocoding API using SSIS." width="786" height="478" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection.png 786w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection-300x182.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection-768x467.png 768w" sizes="(max-width: 786px) 100vw, 786px" /></a><p id="caption-attachment-4962" class="wp-caption-text">Setting up HTTP Connection Manager for Web API Destination to make HTTP requests to Google Geocoding API using SSIS.</p></div></li>
<li>Finally, configure <em>Input Column for URL</em>, <em>HTTP Request Method</em> and input into URL field a sample lookup URL:<br />
<pre class="crayon-plain-tag">https://maps.googleapis.com/maps/api/geocode/json?address=One Microsoft Way Redmond 98052-6399 USA&amp;key=YOUR_API_KEY</pre>
<div id="attachment_4963" style="width: 711px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-web-api-destination.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4963" class="wp-image-4963 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-web-api-destination.png" alt="Configuring Web API Destination to make geocoding lookups in Google Geocoding API using SSIS." width="701" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-web-api-destination.png 701w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-web-api-destination-300x267.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-4963" class="wp-caption-text">Configuring Web API Destination to make geocoding lookups in Google Geocoding API using SSIS.</p></div>
<p>Once you are done, click <strong>Test Request/Response</strong> button. This will actually make a geocoding lookup for Microsoft headquarters:</li>
<li>In the <em>Response (Raw)</em> tab you see the actual response from Geocoding API. Within it –  cleansed, formatted and full Microsoft headquarters address together with geographical coordinates (even we looked it up using just the part of it). Now copy-paste the response body somewhere, so that we can use it in the next step while parsing:
<div id="attachment_4964" style="width: 693px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-sample-response.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4964" class="wp-image-4964 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-sample-response.png" alt="Checking Google Geocoding API HTTP response in Web API Destination using SSIS." width="683" height="642" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-sample-response.png 683w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-sample-response-300x282.png 300w" sizes="(max-width: 683px) 100vw, 683px" /></a><p id="caption-attachment-4964" class="wp-caption-text">Checking Google Geocoding API HTTP response in Web API Destination using SSIS.</p></div></li>
</ol>
<div class="su-note"  style="border-color:#e5da9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff4b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> When Google Geocoding API retrieves only a partial result, it adds a new property in JSON named <em>partial_match</em>, as described in <a href="https://developers.google.com/maps/documentation/geocoding/intro#Results" rel="noopener">Geocoding API documentation</a>. This node is not present in the above sample response. </div></div>
<h3>Parsing Geocoding API JSON response into columns</h3>
<ol>
<li>Drag and drop <strong>JSON Parser Transform</strong> onto the Data Flow and connect it to Web API Destination.</li>
<li>Then open it and configure <em>Input JSON Column</em>.</li>
<li>After that, set the <em>Filter</em> to <strong>$.results[*]</strong>.</li>
<li>Continue by setting <em>Sample JSON strin</em>g to the one you saved in the previous step. Actually, before doing that let&#8217;s modify it and add <strong>partial_match</strong> node next to <strong>place_id</strong> so that <em>exact</em> and <em>partial</em> matches could be told apart (otherwise this property won&#8217;t be parsed):<br />
<pre class="crayon-plain-tag">{
    "results": [{
        "address_components": [{
            "long_name": "One",
            "short_name": "One",
            "types": ["street_number"]
        }, {
            "long_name": "Microsoft Way",
            "short_name": "Microsoft Way",
            "types": ["route"]
        }, {
            "long_name": "Overlake",
            "short_name": "Overlake",
            "types": ["neighborhood", "political"]
        }, {
            "long_name": "Redmond",
            "short_name": "Redmond",
            "types": ["locality", "political"]
        }, {
            "long_name": "King County",
            "short_name": "King County",
            "types": ["administrative_area_level_2", "political"]
        }, {
            "long_name": "Washington",
            "short_name": "WA",
            "types": ["administrative_area_level_1", "political"]
        }, {
            "long_name": "United States",
            "short_name": "US",
            "types": ["country", "political"]
        }, {
            "long_name": "98052",
            "short_name": "98052",
            "types": ["postal_code"]
        }],
        "formatted_address": "One Microsoft Way, Redmond, WA 98052, USA",
        "geometry": {
            "location": {
                "lat": 47.6423318,
                "lng": -122.1369302
            },
            "location_type": "ROOFTOP",
            "viewport": {
                "northeast": {
                    "lat": 47.6436807802915,
                    "lng": -122.1355812197085
                },
                "southwest": {
                    "lat": 47.6409828197085,
                    "lng": -122.1382791802915
                }
            }
        },
        "partial_match": false,
        "place_id": "ChIJGxUEuHFtkFQRnokD7mkppQE",
        "plus_code": {
            "compound_code": "JVR7+W6 Redmond, Washington, United States",
            "global_code": "84VVJVR7+W6"
        },
        "types": ["establishment", "point_of_interest"]
    }],
    "status": "OK"
}</pre>
<div id="attachment_4967" style="width: 729px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-json-parser-transform-1.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4967" class="wp-image-4967 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-json-parser-transform-1.png" alt="Configuring JSON Parser Transform to parse looked up addresses in Google Geocoding API HTTP JSON response using SSIS." width="719" height="584" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-json-parser-transform-1.png 719w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-json-parser-transform-1-300x244.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></a><p id="caption-attachment-4967" class="wp-caption-text">Configuring JSON Parser Transform to parse looked up addresses in Google Geocoding API HTTP JSON response using SSIS.</p></div></li>
<li>To proceed and parse <em>individual address components</em> from JSON response (e.g. number, street, city, country, etc.), you will need to specify columns for each address component manually, just like portrayed in <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/#Pattern_5_8211_Multiple_Columns_with_Expressions_Google_Geocoding_API_Usecase" rel="noopener">Parse multi-dimensional JSON array in SSIS or Drivers</a> article. Just open <em>2D Array Transform</em> tab and select <strong>Multiple columns using expressions</strong> as <em>Transform Type</em> and configure them:
<div id="attachment_4970" style="width: 716px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-columns-json-parser-transform-1.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4970" class="wp-image-4970 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-columns-json-parser-transform-1.png" alt="Configuring JSON Parser Transform to parse individual address components from Google Geocoding API HTTP JSON response using SSIS." width="706" height="739" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-columns-json-parser-transform-1.png 706w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-columns-json-parser-transform-1-287x300.png 287w" sizes="(max-width: 706px) 100vw, 706px" /></a><p id="caption-attachment-4970" class="wp-caption-text">Configuring JSON Parser Transform to parse individual address components from Google Geocoding API HTTP JSON response using SSIS.</p></div>
<p>We specify these columns in our example:</p><pre class="crayon-plain-tag">Number = $.address_components[?(@.types[0]=='street_number')].long_name
Street = $.address_components[?(@.types[0]=='route')].long_name
City = $.address_components[?(@.types[0]=='locality')].long_name
State = $.address_components[?(@.types[0]=='administrative_area_level_1')].long_name
Country = $.address_components[?(@.types[0]=='country')].long_name
PostalCode = $.address_components[?(@.types[0]=='postal_code')].long_name</pre><p>
</li>
<li>Finally, be sure to set <strong>Include all upstream columns to downstream</strong> (quite important), so that CustomerID is passed downstream and which we can save into a destination table. Later it can be a useful column to join the source table and the destination table on. In that way, you will be able to map user-entered addresses with looked up, fully formatted addresses (won&#8217;t be demonstrated in this tutorial).</li>
</ol>
<h3>Save geocoding results into a SQL Server database table</h3>
<ol>
<li>We are now ready to add <strong>OLE DB Destination</strong>, execute the package, make the lookups, and save the results into the database:
<div id="attachment_4971" style="width: 828px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4971" class="wp-image-4971 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533.png" alt="Creating a database table for the Google Geocoding API looked up addresses in SSIS." width="818" height="727" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533.png 818w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533-300x267.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533-768x683.png 768w" sizes="(max-width: 818px) 100vw, 818px" /></a><p id="caption-attachment-4971" class="wp-caption-text">Creating a database table for the Google Geocoding API looked up addresses in SSIS.</p></div></li>
<li>Execute the package!
<div id="attachment_4972" style="width: 705px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-lookup-results.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4972" class="wp-image-4972 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-lookup-results.png" alt="SSIS geocoding package execution and its results." width="695" height="471" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-lookup-results.png 695w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-lookup-results-300x203.png 300w" sizes="(max-width: 695px) 100vw, 695px" /></a><p id="caption-attachment-4972" class="wp-caption-text">SSIS geocoding package execution and its results.</p></div></li>
</ol>
<h3>The results of SSIS geocoding</h3>
<div id="attachment_4985" style="width: 614px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4985" class="wp-image-4985 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis.png" alt="Viewing the results of SSIS geocoding in SQL Server destination table." width="604" height="209" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis.png 604w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis-300x104.png 300w" sizes="(max-width: 604px) 100vw, 604px" /></a><p id="caption-attachment-4985" class="wp-caption-text">Viewing the results of SSIS geocoding in SQL Server destination table.</p></div>
<p style="text-align: justify;">Once you query the table of looked up results, you will notice several things:</p>
<ol style="text-align: justify;">
<li>Perhaps there are more rows in the results table than in the source table</li>
<li><em>partial_match</em> column is either <strong>1</strong> or <strong>NULL</strong></li>
<li><em>geometry.location_type </em>column has several values, e.g. <strong>ROOFTOP</strong>, <strong>RANGE_INTERPOLATED</strong>, <strong>APPROXIMATE</strong>, etc.</li>
</ol>
<p style="text-align: justify;">So to what extent should you trust the results? The answer is to take a look at <a href="https://developers.google.com/maps/documentation/geocoding/intro#Results" rel="noopener">the documentation</a> and see what these values mean.</p>
<p style="text-align: justify;">Basically, when <em>partial_match</em> is equal to <strong>1</strong>, according to Google:</p>
<ul style="text-align: justify;">
<li>Partial matches most often occur for street addresses that do not exist within the locality you pass in the request.</li>
<li>Partial matches may also be returned when a request matches two or more locations in the same locality. For example, &#8220;21 Henr St, Bristol, UK&#8221; will return a partial match for both Henry Street and Henrietta Street. Note that if a request includes a misspelled address component, the geocoding service may suggest an alternative address. Suggestions triggered in this way will also be marked as a partial match.</li>
</ul>
<p style="text-align: justify;">While <em>geometry.location_type</em> column tells how accurate the lookup was. Again, according to Google:</p>
<ul style="text-align: justify;">
<li><strong>&#8220;ROOFTOP&#8221;</strong> indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision.</li>
<li><strong>&#8220;RANGE_INTERPOLATED&#8221;</strong> indicates that the returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address.</li>
<li><strong>&#8220;GEOMETRIC_CENTER&#8221;</strong> indicates that the returned result is the geometric center of a result such as a polyline (for example, a street) or polygon (region).</li>
<li><strong>&#8220;APPROXIMATE&#8221;</strong> indicates that the returned result is approximate.</li>
</ul>
<p style="text-align: justify;">Simply put, <strong>&#8220;ROOFTOP&#8221;</strong> is the most accurate lookup, while <strong>&#8220;APPROXIMATE&#8221;</strong> is the least accurate.</p>
<p style="text-align: justify;">Another valuable piece of information is how many individual address components are filled. The more <strong>NULLs</strong> are there, the less accurate is the address. So if you have <strong>NULL</strong> in the <em>Number</em> column and in the <em>Street</em> column, most likely this is not a very accurate lookup:</p>
<div id="attachment_4987" style="width: 675px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis2.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4987" class="wp-image-4987 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis2.png" alt="Individual address components of looked up addresses in Google Geocoding API using SSIS." width="665" height="210" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis2.png 665w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis2-300x95.png 300w" sizes="(max-width: 665px) 100vw, 665px" /></a><p id="caption-attachment-4987" class="wp-caption-text">Individual address components of looked up addresses in Google Geocoding API using SSIS.</p></div>
<p style="text-align: justify;">Concluding, in the figure above, you can see how user-entered address can be <em>validated</em>, <em>cleansed</em> and <em>formatted</em>.</p>
<h2>SSIS reverse geocoding with Google Maps API</h2>
<p>The concepts presented above about &#8220;forward&#8221; geocoding will help you to make reverse geocoding requests too. The only difference is the request URL:</p><pre class="crayon-plain-tag">https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&amp;key=YOUR_API_KEY</pre><p>
For reference and help visit official <a href="https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding" rel="noopener">Google Geocoding API documentation</a>.</p>
<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>Common errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2><span id="Deployment_to_Production">Parameterization and d</span><span id="Deployment_to_Production">eployment to production </span></h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2>Download a sample package</h2>
<p style="text-align: justify;">Be sure to download a <a href="https://zappysys.com/blog/wp-content/uploads/2018/09/SSIS-Geocoding-using-Google-Maps-API.zip">sample SQL Server 2012 SSIS package</a>, in case you want to try it right away (you can upgrade it to a higher version). If you want to use the database that was used in this tutorial, don&#8217;t forget to create the <a href="https://zappysys.com/blog/wp-content/uploads/2018/09/Marketing-database-script.zip">Marketing database from the script</a> (a modified Microsoft&#8217;s Northwind database).</p>
<h2>Conclusion</h2>
<p style="text-align: justify;">In this tutorial, we step-by-step covered how to make geocoding lookups using Geocoding API, part of Google Maps API. We learned how to <em>cleanse</em>, <em>validate</em> and <em>format</em> address just by submitting it to Geocoding API and parsing the results. We moved forward and looked at how to interpret the results and what geocoding results to trust. Then we touched the point that the same process could be applied to <a href="https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding" rel="noopener"><em>reverse geocoding</em></a>. Concluding, we took a look at how to handle common errors and how to parameterize an SSIS package and deploy it to production.</p>
<p>The post <a href="https://zappysys.com/blog/ssis-geocoding-with-google-maps-api/">SSIS Geocoding with Google Maps API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to call Elasticsearch API using SSIS</title>
		<link>https://zappysys.com/blog/call-elasticsearch-api-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 17 Jan 2017 00:22:47 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Parser Transform]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[elasticsearch]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=943</guid>

					<description><![CDATA[<p>Introduction Elasticsearch is a powerful engine that allows you to store, aggregate and, most importantly, search data in a very analytical way. In this tutorial, you will learn how to bulk load data from SQL Server to Elasticsearch with SSIS (part of SQL Server) and ZappySys PowerPack. The scope of this article will be to show how to import [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/call-elasticsearch-api-using-ssis/">How to call Elasticsearch API using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/elasticsearch-connector/">API Connector for ElasticSearch</a> which makes it much simpler to <strong>Read/Write ElasticSearch 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>
<img loading="lazy" decoding="async" class="alignleft wp-image-1406 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/elasticsearch-logo-180x180.png" alt="" width="180" height="180" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/elasticsearch-logo-180x180.png 180w, https://zappysys.com/blog/wp-content/uploads/2017/06/elasticsearch-logo-180x180-150x150.png 150w" sizes="(max-width: 180px) 100vw, 180px" /><a href="https://www.elastic.co/" target="_blank" rel="noopener">Elasticsearch</a> is a powerful engine that allows you to store, aggregate and, most importantly, search data in a very analytical way. In this tutorial, you will learn how to bulk load data from <em>SQL Server to Elasticsearch </em>with <a href="https://docs.microsoft.com/en-us/sql/integration-services/sql-server-integration-services" target="_blank" rel="noopener"><acronym title="SQL Server Integration Services">SSIS</acronym></a> (part of SQL Server) and <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys PowerPack</a>.</p>
<p>The scope of this article will be to show how to import records from SQL Server into Elasticsearch index as JSON documents using <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html" target="_blank" rel="noopener">Elasticsearch Bulk API</a>. In a nutshell, we will retrieve IDs and names of the products from a SQL table, transform each row into a JSON and lastly, index each JSON in Elasticsearch under record&#8217;s corresponding ID. This tutorial is going to be your stepping stone to use any Elasticsearch API as a destination.</p>
<p>We will be using these SSIS components of PowerPack to make things work:</p>
<div class="su-table su-table-alternate">
<table width="276">
<tbody>
<tr style="line-height: 0px">
<td width="50px"><a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1382" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-json-generator-transform.png" alt="" width="50" height="50" /></a></td>
<td style="vertical-align: middle"><a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a></td>
</tr>
<tr style="line-height: 0px">
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1383" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-web-api-destination.png" alt="" width="50" height="50" /></a></td>
<td style="vertical-align: middle"><a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></td>
</tr>
</tbody>
</table>
</div>
<p>Let&#8217;s begin?</p>
<h2>Prerequisites</h2>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li><em>Northwind</em> database deployed on your machine (we will use it to load data from; <a href="//zappysys.com/blog/wp-content/uploads/2017/06/Northwind.zip" target="_blank" rel="noopener">download it</a>).</li>
<li><a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html" target="_blank" rel="noopener"><i>Elasticsearch </i>instance up and running</a>.</li>
<li><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>ZappySys SSIS PowerPack</em> installed</a>.</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;"><strong>NOTE:</strong> If your ElasticSearch instance is hosted as <a href="https://aws.amazon.com/elasticsearch-service/" target="_blank" rel="noopener">AWS Managed ElasticSearch Instance</a> then select  <pre class="crayon-plain-tag">&lt;New ZS-OAUTH Connection&gt;</pre>. rather than ZS-HTTP (Explained later in this article). When OAuth UI launches select AWS v4 Provider. For more information on <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/" target="_blank" rel="noopener">calling REST API on AWS check this article</a>. </div></div>
<h2>Step-by-Step – Bulk loading data from SQL Server to Elasticsearch with SSIS</h2>
<h3>Load data from SQL Server database first</h3>
<p>In this section you will perform several basic steps to start the package: load data from SQL Server and prepare it for further steps.</p>
<ol>
<li>Create a new SSIS package and drag a <em>Data Flow Task</em> into the <em>Control Flow</em> from the SSIS Toolbox.
<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>Open <em>Data Flow Task</em> and then add <em>OLE DB Source.</em></li>
<li>Configure OLE DB Source to take data from <em>Products </em>table<em>, Northwind</em> database.</li>
<li>Choose <em>ProductID</em> and <em>ProductName</em> as columns you will use.</li>
</ol>
<div id="attachment_2394" style="width: 251px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-control-flow-3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2394" class="wp-image-2394 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-control-flow-3.png" alt="Load data to Elasticsearch using SSIS and ZappySys Web API Destination component." width="241" height="306" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-control-flow-3.png 241w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-control-flow-3-236x300.png 236w" sizes="(max-width: 241px) 100vw, 241px" /></a><p id="caption-attachment-2394" class="wp-caption-text">Load data to Elasticsearch using SSIS and ZappySys Web API Destination component.</p></div>
<h3>Transform data into JSON documents</h3>
<p>To add data into Elasticsearch firstly we need to prepare it with <em>JSON Generator Transform. </em>It will help us convert table rows into JSON documents.</p>
<h4>JSON String to Create Index data for the Bulk API call</h4>
<ol>
<li>Close the window and then drag <em>Derived Column </em>component from the SSIS Toolbox.</li>
<li>Add two new columns and name them <pre class="crayon-plain-tag">RowHeader</pre> and <pre class="crayon-plain-tag">RowFooter</pre>:
<div id="attachment_2406" style="width: 691px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2406" class="wp-image-2406 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png" alt="Derived Column configuration to add prefix and header and footer to a JSON" width="681" height="443" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png 681w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2-300x195.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a><p id="caption-attachment-2406" class="wp-caption-text">Derived Column configuration to add prefix and header and footer to a JSON</p></div>
<p>In the <em>Expression</em> column give them values:</p>
<ul>
<li><strong>RowHeader</strong>:<br />
<pre class="crayon-plain-tag">"{ \"index\": { \"_index\": \"shop\", \"_type\": \"products\", \"_id\" : \"" + (DT_WSTR,100)ProductID + "\" } }\n"</pre>
</li>
<li><strong>RowFooter</strong>:  <pre class="crayon-plain-tag">"\n"</pre></li>
</ul>
</li>
<li>Now drag <em>JSON Generator Transform</em> from the SSIS Toolbox and open it.</li>
<li>Right mouse click on item <em>Mappings </em>and select <pre class="crayon-plain-tag">Add Element(s) (Below this node)</pre>:
<div id="attachment_1415" style="width: 330px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1415" class="wp-image-1415 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping.png" alt="Convert SQL table rows into JSON using JSON Generator Transform" width="320" height="116" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping.png 320w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-300x109.png 300w" sizes="(max-width: 320px) 100vw, 320px" /></a><p id="caption-attachment-1415" class="wp-caption-text">Convert SQL table rows into JSON using <em>JSON Generator Transform</em></p></div></li>
<li>Once a dialog appears, select <pre class="crayon-plain-tag">ProductName</pre> as <em>Source Column</em> and <pre class="crayon-plain-tag">name</pre> as <em>Output Alias:<br />
</em></p>
<div id="attachment_1526" style="width: 386px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-3.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1526" class="size-full wp-image-1526" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-3.jpg" alt="Map table column to JSON property using JSON Generator Transform" width="376" height="438" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-3.jpg 376w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-json-generator-transform-add-mapping-3-258x300.jpg 258w" sizes="(max-width: 376px) 100vw, 376px" /></a><p id="caption-attachment-1526" class="wp-caption-text">Map table column to JSON property using <em>JSON Generator Transform</em></p></div></li>
<li>You should get a similar view:
<div id="attachment_2396" style="width: 728px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2396" class="wp-image-2396 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-2.png" alt="JSON Generator Transform configuration to create JSON from a SQL table" width="718" height="320" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-2.png 718w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-2-300x134.png 300w" sizes="(max-width: 718px) 100vw, 718px" /></a><p id="caption-attachment-2396" class="wp-caption-text"><em>JSON Generator Transform</em> configuration to create JSON from a SQL table</p></div></li>
<li>Then go to <em>Header / Footer</em> tab and:
<ul>
<li>Select <pre class="crayon-plain-tag">Direct String</pre> option.</li>
<li>Input <pre class="crayon-plain-tag">&lt;%RowHeader%&gt;</pre> in <em>Header String</em> option.</li>
<li>Input <pre class="crayon-plain-tag">&lt;%RowFooter%&gt;</pre> in <em>Footer String</em> option.</li>
</ul>
<div id="attachment_2403" style="width: 728px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-3-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2403" class="wp-image-2403 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-3-1-e1513951668585.png" alt="JSON Generator Transform configuration to convert rows into JSON suitable for Elasticsearch Bulk operation" width="718" height="400" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-3-1-e1513951668585.png 718w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-convert-rows-into-json-using-json-generator-transform-3-1-e1513951668585-300x167.png 300w" sizes="(max-width: 718px) 100vw, 718px" /></a><p id="caption-attachment-2403" class="wp-caption-text"><em>JSON Generator Transform</em> configuration to convert rows into JSON suitable for Elasticsearch Bulk operation</p></div></li>
<li>Close the window.</li>
</ol>
<h4>JSON String to Update Index data for the Bulk API call</h4>
<p>From the above section &#8220;<strong>JSON String to Create Index data for the Bulk API call&#8221; </strong>follows all the steps From <strong>Step-1 to Step-8.</strong></p>
<p>Just for (2nd step) <strong>Step-2</strong> use below expression for  <pre class="crayon-plain-tag">RowHeader</pre> and <pre class="crayon-plain-tag">RowFooter</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png"><img loading="lazy" decoding="async" class="wp-image-2406 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png" alt="Derived Column configuration to add prefix and header and footer to a JSON" width="681" height="443" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png 681w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2-300x195.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a></p>
<p>Derived Column configuration to add prefix and header and footer to a JSONIn the <em>Expression</em> column give them values:</p>
<ul>
<li><strong>RowHeader</strong>:<br />
<pre class="crayon-plain-tag">"{ \"update\": { \"_index\": \"shop\", \"_id\" : \"" + (DT_WSTR,100)ProductID + "\" } }\n{ \"doc\" : "</pre>
</li>
<li><strong>RowFooter</strong>:  <pre class="crayon-plain-tag">"}\n"</pre></li>
</ul>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: To learn how to make more complicated transforms visit these links:</p>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/</a> (check the video)</li>
<li><a href="https://zappysys.com/blog/tag/ssis-json-generator-transform/" target="_blank" rel="noopener">https://zappysys.com/blog/tag/ssis-json-generator-transform/</a></li>
</ul>
</div></div>
<h4>JSON String to Delete Index data for the Bulk API call</h4>
<p>From the above section &#8220;<strong>JSON String to Create Index data for the Bulk API call&#8221; </strong>follows steps <strong>Step-1 and Step-2.</strong></p>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: No need to use JSON Generator Transform (From Step-3).</div></div>
<p>Just for (2nd step) <strong>Step-2</strong> use below expression for  <pre class="crayon-plain-tag">RowHeader</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png"><img loading="lazy" decoding="async" class="wp-image-2406 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png" alt="Derived Column configuration to add prefix and header and footer to a JSON" width="681" height="443" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2.png 681w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-derived-columns-2-300x195.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a></p>
<p>Derived Column configuration to add prefix and header and footer to a JSON</p>
<p>In the <em>Expression</em> column give them values:</p>
<ul>
<li><strong>RowHeader</strong>:<br />
<pre class="crayon-plain-tag">"{ \"delete\": { \"_index\": \"shop\", \"_id\" : \"" + (DT_WSTR,100)ProductID + "\" } }\n"</pre>
</li>
</ul>
<h3>Finally, Elasticsearch &amp; SQL Server integration</h3>
<ol>
<li>Now drag <em>Web API Destination</em> SSIS component into the Data Flow and open it for editing.</li>
<li>In <em>Select Connection</em> section press <pre class="crayon-plain-tag">&lt;New ZS-HTTP Connection&gt;</pre>.</li>
<li>Once <em>HTTP Connection Manager</em> window opens configure connection to your Elasticsearch instance:
<ul>
<li>Set <em>Web Url</em>, which points to your Elasticsearch instance.</li>
<li>Set <em>Credentials Type</em> to <pre class="crayon-plain-tag">Basic - UserID/Password</pre> (or other appropriate authentication method).</li>
<li>Finally, set <em>User Name</em> and <em>Password:<br />
</em></p>
<div id="attachment_1419" style="width: 330px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-configure-http-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1419" class="wp-image-1419 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-configure-http-connection.png" alt="Configure SSIS HTTP Connection to connect to Elasticsearch" width="320" height="207" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-configure-http-connection.png 320w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-post-data-to-elasticsearch-configure-http-connection-300x194.png 300w" sizes="(max-width: 320px) 100vw, 320px" /></a><p id="caption-attachment-1419" class="wp-caption-text">Configure SSIS <em>HTTP Connection</em> to connect to Elasticsearch</p></div></li>
</ul>
</li>
<li>Close configuration window. Now it&#8217;s time to configure <em>Web API Destination</em>.</li>
<li>All that is separating you from getting those rows into Elasticsearch:
<ul>
<li>Setting <em>Input Column</em> <em>for Body</em> to <pre class="crayon-plain-tag">ZS_JSON_OUT</pre> for <strong>Create and Update</strong> Index Data and for <strong>Delete</strong> Index Data <em>Input Column for Body</em> to <pre class="crayon-plain-tag">RowHeader [Derived Column]</pre>.</li>
<li>Setting <em>URL</em> to <pre class="crayon-plain-tag">http://localhost:9200/_bulk</pre>.</li>
<li>Setting <em>HTTP Request</em> Method to <pre class="crayon-plain-tag">POST</pre>.</li>
<li>Setting <em>Body content type</em> Method to <pre class="crayon-plain-tag">JSON(application/json)</pre></li>
</ul>
</li>
</ol>
<div id="attachment_10042" style="width: 733px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/01/web-destination-elastic-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10042" class="size-full wp-image-10042" src="https://zappysys.com/blog/wp-content/uploads/2017/01/web-destination-elastic-1.png" alt="" width="723" height="775" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/web-destination-elastic-1.png 723w, https://zappysys.com/blog/wp-content/uploads/2017/01/web-destination-elastic-1-280x300.png 280w" sizes="(max-width: 723px) 100vw, 723px" /></a><p id="caption-attachment-10042" class="wp-caption-text">Index SQL Server Database data in Elasticsearch using SSIS component Web API Destination</p></div>
<ol>
<li>Then open <em>Batch Settings (For Body)</em> tab:
<ul>
<li>Enable batch submission.</li>
<li>Set <em>Body Batch Size, </em>e.g. 1000<em>. </em>Make sure this number is even, otherwise you may get into problems (Elasticsearch Bulk request has special JSON request body format, as you perhaps noticed).</li>
</ul>
<div id="attachment_2415" style="width: 711px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2415" class="wp-image-2415 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-3.png" alt="Web API Destination batch settings configuration" width="701" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-3.png 701w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-post-data-to-elasticsearch-web-api-destination-3-300x267.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-2415" class="wp-caption-text"><em>Web API Destination</em> batch settings configuration</p></div></li>
<li>Close the window and run the package! You should see green lights, telling you everything is OK:
<div id="attachment_2398" style="width: 302px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-load-success-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2398" class="wp-image-2398 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-load-success-2.png" alt="Successful data load from SQL Server to Elasticsearch" width="292" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-load-success-2.png 292w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-load-success-2-224x300.png 224w" sizes="(max-width: 292px) 100vw, 292px" /></a><p id="caption-attachment-2398" class="wp-caption-text">Successful data load from SQL Server to Elasticsearch</p></div></li>
<li>We can also query Elasticsearch by using one of its <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html" target="_blank" rel="noopener">Search APIs</a> &#8211; <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-uri-request.html" target="_blank" rel="noopener">URI Search</a> to see if we successfully indexed data:
<div id="attachment_1470" style="width: 363px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-load-results.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1470" class="wp-image-1470" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-load-results.png" alt="SQL Server data index in Elasticsearch" width="353" height="450" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-load-results.png 429w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-load-results-235x300.png 235w" sizes="(max-width: 353px) 100vw, 353px" /></a><p id="caption-attachment-1470" class="wp-caption-text">SQL Server data index in Elasticsearch</p></div></li>
<li>Rows number match in SSIS and in search results, thus everything is good. You are done.</li>
</ol>
<h3>What if I want more? After upserting data use <em>Web API Destination</em> further</h3>
<p>Let&#8217;s say you have a requirement to do something with rows that were freshly indexed in Elasticsearch. Then you will need somehow to distinguish between created and updated records in Elasticsearch. And that won&#8217;t be difficult because <em>Web API Destination</em> acts not only as <span style="text-decoration: underline;">Destination</span> but as <span style="text-decoration: underline;">Transformation</span> as well. So one thing you have to do is connect <em><a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></em> downstream to <em>Web API Destination</em>. It will parse Elasticsearch HTTP JSON response – which is returned by <em>Web API Destination –</em> into columns, which you can later easily redirect using <em>Conditional Split:</em></p>
<ol>
<li>Add <em>JSON Parser Transform</em> and connect it to <em>Web API Destination</em>:
<div id="attachment_1476" style="width: 415px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1476" class="size-full wp-image-1476" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-http-response-parsing.png" alt="Add JSON Parser Transform to get Elasticsearch HTTP JSON response when integrating SQL Server &amp; Elasticsearch" width="405" height="394" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-http-response-parsing.png 405w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-http-response-parsing-300x292.png 300w" sizes="(max-width: 405px) 100vw, 405px" /><p id="caption-attachment-1476" class="wp-caption-text">Use <em>JSON Parser Transform</em> to get Elasticsearch HTTP JSON response when integrating SQL Server &amp; Elasticsearch</p></div></li>
<li>Make sure you have selected <pre class="crayon-plain-tag">ResponseText</pre> as <em>Select Input JSON Column.</em></li>
<li>Then go to <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html" target="_blank" rel="noopener">Bulk API</a> and copy/paste &#8220;the result of this bulk operation&#8221; JSON response:
<div id="attachment_2399" style="width: 714px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2399" class="wp-image-2399 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png" alt="Using JSON Parser Transform to parse JSON response from REST HTTP request" width="704" height="622" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration.png 704w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-json-parser-transform-configuration-300x265.png 300w" sizes="(max-width: 704px) 100vw, 704px" /></a><p id="caption-attachment-2399" class="wp-caption-text">Using <em>JSON Parser Transform</em> to parse JSON response from REST HTTP request</p></div></li>
<li>Set <pre class="crayon-plain-tag">$.items[*]</pre> as the filter.</li>
<li><strong>Optional step</strong>. You won&#8217;t find a response sample for every Elasticsearch API call. In that case, you may want to use <a href="http://www.getpostman.com" target="_blank" rel="noopener">Postman</a> to make an HTTP request to Elasticsearch and get a sample response:
<div id="attachment_1513" style="width: 589px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-using-postman-to-troubleshoot.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1513" class="wp-image-1513 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-using-postman-to-troubleshoot.png" alt="Use Postman to make a request to Elasticsearch and get a sample response to be used in JSON Parser Transform" width="579" height="587" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-using-postman-to-troubleshoot.png 579w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-using-postman-to-troubleshoot-296x300.png 296w" sizes="(max-width: 579px) 100vw, 579px" /></a><p id="caption-attachment-1513" class="wp-caption-text">Use <em>Postman</em> to make a request to Elasticsearch and get a sample response to be used in <em>JSON Parser Transform</em></p></div>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: Don&#8217;t forget to set the username and password in <em>Authorization</em> section!</div></div></li>
<li>Then use a <em>Conditional Split </em>and <a href="//zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=trash-destination.htm" target="_blank" rel="noopener">Trash Destination</a> to redirect the rows:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2410" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split.png" alt="" width="893" height="394" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split.png 893w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split-300x132.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-sql-server-to-elasticsearch-conditional-split-768x339.png 768w" sizes="(max-width: 893px) 100vw, 893px" /></a><br />
Input these clauses:</p>
<ul>
<li><strong>Inserted</strong>:<br />
<pre class="crayon-plain-tag">REPLACENULL([index.result],"") == "created" || REPLACENULL([create.result],"") == "created"</pre>
</li>
<li><strong>Updated</strong>:<br />
<pre class="crayon-plain-tag">REPLACENULL([index.result],"") == "updated" || REPLACENULL([create.result],"") == "updated"</pre>
</li>
</ul>
</li>
<li>As a result, new index records will be redirected to one destination, while updated records &#8211; to the other:<br />
<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-integration-results.png"><img loading="lazy" decoding="async" width="423" height="388" class="wp-image-1478 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-integration-results.png" alt="&quot;Result" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-integration-results.png 423w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-integration-results-300x275.png 300w" sizes="(max-width: 423px) 100vw, 423px" /></a></li>
</ol>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: <em>Trash Destination</em> is a handy component of <em>ZappySys PowerPack</em> which can be used as dummy destination when we don&#8217;t care about the destination (and we don&#8217;t care in this tutorial) 🙂</div></div>
<p>Overall you can use <em>Web API Destination</em> HTTP JSON response for other useful things as well, e.g. determine on how many <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/_basic_concepts.html#getting-started-shards-and-replicas" target="_blank" rel="noopener">replica shards</a> record was indexed. JSON response will depend on which Elasticsearch API and which method you use.</p>
<h3>Delete Index by making an API call.</h3>
<p>If you want to delete the index by making <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html" target="_blank" rel="noopener">Delete API</a> call you can. Let&#8217;s make that call using the Rest API Task. Configure it like below screen and click on the Test Request button.</p>
<div id="attachment_8605" style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8605" class="wp-image-8605 size-medium_large" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method-768x523.png" alt="Rest API Delete Method" width="720" height="490" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method-768x523.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method-300x204.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-rest-api-task-delete-method.png 901w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-8605" class="wp-caption-text">Rest API Delete Method</p></div>
<h3>Things gone bad: Error handling &amp; debugging</h3>
<p>Incidentally, you may incorrectly construct JSON for <em>Web API Destination</em> body<i>. </i>Elasticsearch nodes may go offline or 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 failed requests from <em>Web API Destination</em> to some other destination:</p>
<ol>
<li>Add a <em>Derived Column</em> above <em>Web API Destination</em> with expression <pre class="crayon-plain-tag">(DT_WSTR,4000)ZS_JSON_OUT</pre> and name it <pre class="crayon-plain-tag">JsonAsString</pre>. This will let you see what JSON you are actually passing.</li>
<li>Then add 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>Web API Destination </em>into it<em>. </em>Don&#8217;t forget to set <pre class="crayon-plain-tag">Redirect row</pre> option for both, <em>Error</em> and <em>Truncation</em> columns:<em><br />
</em><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png"><img loading="lazy" decoding="async" width="739" height="267" class="wp-image-1487 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" alt="&quot;Redirect" 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></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 id="attachment_1494" style="width: 762px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1494" class="wp-image-1494 size-full" src="//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 id="caption-attachment-1494" class="wp-caption-text">Use<em> Data Viewer</em> to view HTTP requests that failed to be fulfilled in Elasticsearch</p></div></li>
</ol>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: 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>
<h2>Call ElasticSearch API hosted on AWS</h2>
<p>If your ElasticSearch instance is hosted as <a href="https://aws.amazon.com/elasticsearch-service/" target="_blank" rel="noopener">AWS Managed ElasticSearch Instance</a> then select  <pre class="crayon-plain-tag">&lt;New ZS-OAUTH Connection&gt;</pre>. rather than ZS-HTTP (Explained later in this article). When OAuth UI launches select AWS v4 Provider. For more information on <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/" target="_blank" rel="noopener">calling REST API on AWS check this article</a>.</p>
<div id="attachment_2258" style="width: 720px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-oauth-connection-amazon-aws-api-provider-use-signature-v4.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2258" class="size-full wp-image-2258" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-oauth-connection-amazon-aws-api-provider-use-signature-v4.png" alt="Configure SSIS OAuth Connection - Use Amazon AWS API Provider, Enter Access Key, Secret Key" width="710" height="535" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-oauth-connection-amazon-aws-api-provider-use-signature-v4.png 710w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-oauth-connection-amazon-aws-api-provider-use-signature-v4-300x226.png 300w" sizes="(max-width: 710px) 100vw, 710px" /></a><p id="caption-attachment-2258" class="wp-caption-text">Configure SSIS OAuth Connection &#8211; Use Amazon AWS API Provider, Enter Access Key, Secret Key</p></div>
<p>&nbsp;</p>
<div id="attachment_6277" style="width: 836px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6277" class="size-full wp-image-6277" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png" alt="Call AWS Hosted ElasticSearch REST API in SSIS (V4 Request Signing)" width="826" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png 826w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4-300x265.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4-768x679.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-6277" class="wp-caption-text">Call AWS Hosted ElasticSearch REST API in SSIS (V4 Request Signing)</p></div>
<h2>Common Errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2>Download a sample package</h2>
<p>Be sure to download a <a href="https://zappysys.com/blog/wp-content/uploads/2017/06/Bulk-load-data-from-SQL-Server-to-Elasticsearch-using-SSIS.zip">sample SQL Server 2008 SSIS package</a>, in case you want to try it right away (you can upgrade it to a higher version).<br />
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE</strong>: Once you open the package, you won’t be able to run it immediately, but don’t panic. Just configure OLE DB Source to point to your Northwind database and set URLs to point to your Elasticsearch instance.</div></div>
<h2>Conclusion. What&#8217;s next?</h2>
<p>In this article we have learned how to bulk load data from SQL Server and upsert it in Elasticsearch index. We used <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a> to help us convert database table rows into JSON documents. In addition, <a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> was very helpful in automatically creating and making HTTP requests to Elasticsearch instance and indexing our data as a result. This tutorial was quite simple and straightforward, yet it is a good starter to use other Elasticsearch APIs and their features. From now on <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" target="_blank" rel="noopener">Elasticsearch reference</a> is your best friend in learning what APIs exist, what are their methods and how HTTP requests should look like.</p>
<p><strong>Keywords</strong></p>
<p>How to import data from SQL Server to Elasticsearch | How to load data into Elasticsearch | Using Elasticsearch to index SQL Server | Elasticsearch and SQL Server integration | How to use Elasticsearch together with SQL Server | Upsert SQL Server data into Elasticsearch</p>
<p>The post <a href="https://zappysys.com/blog/call-elasticsearch-api-using-ssis/">How to call Elasticsearch API using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
