<?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>OAuth Connection Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/oauth-connection/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/oauth-connection/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 24 Sep 2025 05:21:34 +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>OAuth Connection Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/oauth-connection/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to authenticate to an API with OAuth 2.0 using SSIS / ODBC</title>
		<link>https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 13 Jun 2017 14:34:23 +0000</pubDate>
				<category><![CDATA[REST API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Connection Manager]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[authorization]]></category>
		<category><![CDATA[hubspot]]></category>
		<category><![CDATA[hubspot rest api]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[OAuth 2.0]]></category>
		<category><![CDATA[OAuth Connection]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[RESTful API]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1327</guid>

					<description><![CDATA[<p>Introduction In the world of REST APIs you have to know how to authenticate, before using any API method. In this article we will cover a topic how to authenticate to an API with OAuth 2.0 technology using SSIS or ODBC Drivers. We are going to use OAuth Connection Manager SSIS component to achieve that, which is a [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/">How to authenticate to an API with OAuth 2.0 using SSIS / ODBC</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction">Introduction</span></h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/09/api-180x180.png"><img decoding="async" class="alignleft wp-image-1854" src="//zappysys.com/blog/wp-content/uploads/2017/09/api-180x180.png" alt="" width="100" height="100" srcset="https://zappysys.com/blog/wp-content/uploads/2017/09/api-180x180.png 180w, https://zappysys.com/blog/wp-content/uploads/2017/09/api-180x180-150x150.png 150w" sizes="(max-width: 100px) 100vw, 100px" /></a>In the world of REST APIs you have to know how to authenticate, before using any API method. In this article we will cover a topic how to authenticate to an API with <a href="https://oauth.net/2" target="_blank" rel="noopener">OAuth 2.0</a> technology using SSIS or ODBC Drivers. We are going to use <em>OAuth Connection Manager </em>SSIS component to achieve that, which is a part of <a href="//zappysys.com/products/ssis-powerpack/">ZappySys SSIS PowerPack</a>. Concepts listed in this articles also applicable for <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ODBC PowerPack</a> product. If you like to access API data in BI Tools (e.g. Power BI, Excel, MS Access) or SQL Server directly then use ODBC PowerPack</p>
<p>&nbsp;</p>
<div id="custom_post_widget-2523" class="content_block">
<h2><span id="Prerequisites"><span id="Prerequisites">Prerequisites</span></span></h2>
<p>Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:</p>
<ol style="margin-left: 1.5em;">
<li><b>For SSIS:</b> <abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven&#8217;t already).</li>
<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
<li><b>For ODBC:</b>Download and Install <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> (This includes XML / JSON / REST API and few other drivers for SQL Server and ODBC connectivity in tools like Excel, Power BI, SSRS)</li>
</ol>
</div>
<h2>Concepts about OAuth 2.0</h2>
<p>In this post we will not cover in depth about OAuth 2.0 protocol. If you want to learn how OAuth 2.0 Protocol works then <a href="https://aaronparecki.com/oauth-2-simplified/" target="_blank" rel="noopener">check article like this</a> (or few more you can search). Don&#8217;t get overwhelmed by details 🙂 because you don&#8217;t have to worry when you use <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">SSIS OAuth Connection Manager</a>. Most of complexity of OAuth Protocol such as Token Extract, Token Renew is taken care by connection manager behind the scene for you.</p>
<p>Important things you will have to do to <b>Call API in SSIS using OAuth</b> are listed below.</p>
<ol>
<li>Register OAuth App to obtain ClientID / Client Secret</li>
<li>Confirm OAuth 2.0 Grant Type (By <strong>default</strong> it will be <strong>Authorization Code Grant</strong> (i.e. 3-legged grant &#8211; Which shows Login Page when you click Generate Token Button). If you see mention about Grant Type=<strong>Client Credentials</strong> or <strong>Password</strong> Grant on your API help file then on you must configure SSIS OAuth Connection Manager with <strong>OAuth Version=2.0</strong> and Change <strong>OAuth Grant Type</strong> drop down on the UI to correct setting. Refresh Token is only supported in <strong>Authorization Code Grant</strong>.</li>
<li>Obtain necessary Token URL (i.e. Token endpoint(s) &#8211; Usually documented in your API helpfile. Example : https://somesite/oauth/token )</li>
<li><strong>Optional</strong> &#8211; Identify Scopes (i.e. Permission you want to grant to the token. Many times its not needed)</li>
<li><strong>Optional</strong> &#8211; Identify redirect URL (Usually entered on App registration Page.. Same URL must be entered on the SSIS OAuth Connection Manager &gt; Advanced Tab)</li>
</ol>
<h2></h2>
<h2>Video Tutorial</h2>
<a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FNFjPWxOUWzM%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<p>&nbsp;</p>
<h2>Grant Types in OAuth 2.0</h2>
<p>There are multiple Grant Types in OAuth. API may enforce one or other based on Security Level they want to enforce. You can look at your API documentation to find out which Grant Type they are using. In above example of Hubspot API we used Authorization Code Grant (Its Default grant type in SSIS OAuth Connection Manager)</p>
<h3>Authorization Code Grant Type</h3>
<p>This is most common grant type for any popular API you may access (e.g. <a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/" target="_blank" rel="noopener">Google API</a>, <a href="https://zappysys.com/blog/get-data-from-facebook-in-ssis-using-rest-api/">Facebook</a>, <a href="https://zappysys.com/blog/how-to-import-linkedin-data-in-powerbi/">LinkedIn</a> ). In this grant type it requires 3-legged authorization for first time before you can obtain Access / Refresh Token.  Basically you will see Login Prompt for first time which you have to Accept before you can get token(s). After that you may not have to Log in again if you are using ZappySys SSIS OAuth Connection manager. Refreshing Token is automatica after first login call.</p>
<h3>Client Credentials Grant Type</h3>
<p>ZappySys offers various data integration components, including REST API Task, JSON Source, XML Source, and CSV Source, which allow you to connect to external APIs and retrieve data. For secure API authentication, you can create an OAuth connection using the Client Credentials Grant Type. <a href="https://zappysys.zendesk.com/hc/en-us/articles/360008704413" target="_blank" rel="noopener">Check this article to learn more</a> about this option.</p>
<p><b>What is Client Credentials Grant Type?</b><br />
The Client Credentials Grant Type is used by applications to access an API without user involvement. It is commonly used for machine-to-machine authentication, where the application itself authenticates with the API using a Client ID and Client Secret.</p>
<p><b>Steps to Create an OAuth2 Client Credentials Grant Type Connection<b></b></b></p>
<div class="d-editor-preview">
<ol>
<li>Using ZappySys <b>SSIS PowerPack</b> or <b>ODBC PowerPack</b>
<ul>
<li>Using ZappySys SSIS PowerPack
<ul>
<li>Launch <strong>Visual Studio</strong> and Open existing SSIS Project or Create new SSIS Project to use <strong>ZappySys SSIS PowerPack</strong> in your environment.</li>
<li>Choose either:
<ul>
<li>SSIS <a title="REST API Web Service Task" href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">REST API Task</a> or <a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/">Web API Destination</a> (for direct operations)</li>
<li>SSIS <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source</a>, <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML Source</a>, or <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/">CSV Source</a> (for data extraction)</li>
</ul>
</li>
</ul>
</li>
<li>Using ZappySys ODBC PowerPack
<ul>
<li>Launch <strong>ZappySys Data Gateway</strong> or <strong>ODBC DSN (64/32 bit)</strong> in your environment.</li>
<li>Choose either:
<ul>
<li>ODBC <a href="https://zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/">JSON Driver</a>, <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/">XML Driver</a>, or <a href="https://zappysys.com/products/odbc-powerpack/odbc-csv-rest-api-driver/">CSV Driver</a> (for data extraction)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Create a New OAuth Connection
<ul>
<li>Go to the <strong>Connection Manager</strong>.</li>
<li>Select <strong>Add New Connection</strong> ➝ Choose <strong>OAuth Connection</strong>.</li>
<li>Select <strong>Custom</strong> OAuth Provider.</li>
<li>Select <strong>OAuth2 version</strong>.</li>
<li>Select <strong>Client Credentials Grant Type</strong>.</li>
</ul>
</li>
<li>Configure OAuth Settings. Enter the following details:
<ul>
<li><strong>Token Endpoint URL:</strong> The API endpoint to obtain the access token (e.g., <code>https://api.example.com/oauth/token</code>)</li>
<li><strong>Client ID:</strong> Your app’s Client ID</li>
<li><strong>Client Secret:</strong> Your app’s Client Secret</li>
<li><strong>Scope:</strong> (Optional) Specify any required permissions or scopes</li>
<li><strong>Content-Type:</strong> <code>application/x-www-form-urlencoded</code> (Default common for token requests)</li>
</ul>
</li>
<li>Test the Connection
<ul>
<li>Click <strong>Test Connection</strong> to ensure that ZappySys can retrieve the token successfully.</li>
</ul>
</li>
<li>Use the OAuth Connection in API Calls. Once the OAuth connection is established:
<ul>
<li>In SSIS use it in <strong>REST API Task</strong>, <strong>JSON Source</strong>, <strong>XML Source</strong>, <strong>CSV Source</strong>, or <strong>Web API Destination</strong>.</li>
<li>In ODBC use it in <strong>JSON Driver</strong>, <strong>XML Driver</strong>, or <strong>CSV Driver</strong>.</li>
<li>The OAuth token will automatically be included in the <strong>Authorization header</strong> when making API requests.</li>
</ul>
</li>
</ol>
</div>
<div style="width: 828px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-1-e1743083581693.png" alt="Calling API in SSIS using OAuth 2.0 - Client Credentials Grant Type" width="818" height="788" /><p class="wp-caption-text">Calling API in SSIS using OAuth 2.0 &#8211; Client Credentials Grant Type</p></div>
<h3>Password Grant Type</h3>
<p>The Password Grant Type is an OAuth 2.0 flow used to exchange a user’s username and password directly for an access token. Depending on the API requirements, you may also need to provide a Client ID, Client Secret, and Scope. This flow is typically used in trusted applications or internal systems where collecting credentials directly is considered safe.</p>
<p><b>Steps to Create an OAuth2 Password Grant Type Connection<b></b></b></p>
<div class="d-editor-preview">
<ol>
<li>Using ZappySys <b>SSIS PowerPack</b> or <b>ODBC PowerPack</b>
<ul>
<li>Using ZappySys SSIS PowerPack
<ul>
<li>Launch <strong>Visual Studio</strong> and Open existing SSIS Project or Create new SSIS Project to use <strong>ZappySys SSIS PowerPack</strong> in your environment.</li>
<li>Choose either:
<ul>
<li>SSIS <a title="REST API Web Service Task" href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">REST API Task</a> or <a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/">Web API Destination</a> (for direct operations)</li>
<li>SSIS <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source</a>, <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML Source</a>, or <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/">CSV Source</a> (for data extraction)</li>
</ul>
</li>
</ul>
</li>
<li>Using ZappySys ODBC PowerPack
<ul>
<li>Launch <strong>ZappySys Data Gateway</strong> or <strong>ODBC DSN (64/32 bit)</strong> in your environment.</li>
<li>Choose either:
<ul>
<li>ODBC <a href="https://zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/">JSON Driver</a>, <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/">XML Driver</a>, or <a href="https://zappysys.com/products/odbc-powerpack/odbc-csv-rest-api-driver/">CSV Driver</a> (for data extraction)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Create a New OAuth Connection
<ul>
<li>Go to the <strong>Connection Manager</strong>.</li>
<li>Select <strong>Add New Connection</strong> ➝ Choose <strong>OAuth Connection</strong>.</li>
<li>Select <strong>Custom</strong> OAuth Provider.</li>
<li>Select <strong>OAuth2 version</strong>.</li>
<li>Select <strong>Password Grant Type</strong>.</li>
</ul>
</li>
<li>Configure OAuth Settings. Enter the following details:
<ul>
<li><strong>Token Endpoint URL:</strong> The API endpoint to obtain the access token (e.g., <code>https://api.example.com/oauth/token</code>)</li>
<li><strong>Client ID:</strong> Your app’s Client ID</li>
<li><strong>Client Secret:</strong> Your app’s Client Secret</li>
<li><strong>User Name:</strong> Your app’s User Name</li>
<li><strong>Password:</strong> Your app’s Password</li>
<li><strong>Scope:</strong> (Optional) Specify any required permissions or scopes</li>
<li><strong>Content-Type:</strong> <code>application/x-www-form-urlencoded</code> (Default common for token requests)</li>
</ul>
</li>
<li>Test the Connection
<ul>
<li>Click <strong>Test Connection</strong> to ensure that ZappySys can retrieve the token successfully.</li>
</ul>
</li>
<li>Use the OAuth Connection in API Calls. Once the OAuth connection is established:
<ul>
<li>In SSIS use it in <strong>REST API Task</strong>, <strong>JSON Source</strong>, <strong>XML Source</strong>, <strong>CSV Source</strong>, or <strong>Web API Destination</strong>.</li>
<li>In ODBC use it in <strong>JSON Driver</strong>, <strong>XML Driver</strong>, or <strong>CSV Driver</strong>.</li>
<li>The OAuth token will automatically be included in the <strong>Authorization header</strong> when making API requests.</li>
</ul>
</li>
</ol>
</div>
<div id="attachment_11475" style="width: 711px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/06/oauth2-passward-grant-type-connection-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11475" class="size-full wp-image-11475" src="https://zappysys.com/blog/wp-content/uploads/2017/06/oauth2-passward-grant-type-connection-1.png" alt="Calling API in SSIS using OAuth 2.0 - Password Grant Type" width="701" height="723" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/oauth2-passward-grant-type-connection-1.png 701w, https://zappysys.com/blog/wp-content/uploads/2017/06/oauth2-passward-grant-type-connection-1-291x300.png 291w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-11475" class="wp-caption-text">Calling API in SSIS using OAuth 2.0 &#8211; Password Grant Type</p></div>
<h2>Understand AccessToken and RefreshTokens in OAuth 2.0</h2>
<p>Along with GrantType there is one more concept in OAuth you have to understand. Its about two types of Tokens you get in OAuth 2.0</p>
<ol>
<li>Access Token</li>
<li>Refresh Token</li>
</ol>
<p>Here is brief description about each type of token.</p>
<h3>Refresh Token</h3>
<p>If you are using <strong>Authorization Code Grant Type</strong> (see previous section) then most API will send you RefreshToken and AccessToken after you finish 3-legged authorization first time (i.e. Login Dialog box). Refresh Token usually never expires. Some API may expire refresh tokens but after a long time (e.g. 90 days).  If you have case of expiring RefreshToken then you may have to use <a href="https://zappysys.zendesk.com/hc/en-us/articles/115004555334-How-to-handle-Changing-OAuth-RefreshToken-in-SSIS-ODBC-">this Pattern</a></p>
<h3>Access Token</h3>
<p>Access Token is needed to call API and its usually short lived (expires in 1-2 hours).</p>
<p>If you are using Authorization Code Grant Type  then you have to use RefreshToken to get new AccessToken.</p>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff8b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">Keep both Access and Refresh Token secure. Treat them like a password.</div></div>
<h2>Step-by-Step <span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– API Authentication with SSIS OAuth Connection</span></span></h2>
<p>Now let&#8217;s look at an example of how to call API using SSIS OAuth Connection Manager and REST API Task. We will use <a href="https://developers.hubspot.com/docs/overview" target="_blank" rel="noopener">HubSpot API</a> as an example but concepts remain same for any other API such as <a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/" target="_blank" rel="noopener">Google API</a>, <a href="https://zappysys.com/blog/get-data-from-facebook-in-ssis-using-rest-api/">Facebook</a>, <a href="https://zappysys.com/blog/read-twitter-data-in-ssis-using-rest-api-task-json-source-oauth2/">Twitter</a>, <a href="https://zappysys.com/blog/how-to-import-linkedin-data-in-powerbi/">LinkedIn</a></p>
<ol>
<li>Login into the service provider (whose API you want to use) membership area.<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>: Sometimes you have to create <em>Developer </em>account first and login using it.</div></div></li>
<li>Find API settings and create an application (API App). It will be your little bridge between user&#8217;s data and SSIS. Usually you will have to configure just a few fields:
<ol>
<li>Name</li>
<li>Scopes, your API App will be operating under</li>
<li>Visibility<br />
E.g. for <a href="https://app.hubspot.com/signup/developers/?_ga=2.81860886.1851700985.1694116734-2138228589.1694116734&amp;_gl=1*i41z4w*_ga*MjEzODIyODU4OS4xNjk0MTE2NzM0*_ga_LXTM6CQ0XK*MTY5NDExNjczMy4xLjEuMTY5NDExNjczOC41NS4wLjA." target="_blank" rel="noopener">HubSpot</a>, it looks like this:</p>
<div id="attachment_1201" style="width: 605px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/name-hubspot-application.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1201" class="wp-image-1201 " src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-2.png" alt="REST API App which will be used from within SSIS" width="595" height="267" /></a><p id="caption-attachment-1201" class="wp-caption-text">REST API App which will be used from within SSIS</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>: Your API App will never go out of the defined scope.</div></div></li>
</ol>
</li>
<li>Once you created an application, you should see fields <em>Client ID</em> and <em>Client Secret </em>nearby:
<div id="attachment_1348" style="width: 668px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-authentication-note-client-id-and-client-secret.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1348" class=" wp-image-1348" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-3.png" alt="Write down Client Id and Client Secret for the next step in OAuth authentication process" width="658" height="346" /></a><p id="caption-attachment-1348" class="wp-caption-text">Write down Client Id and Client Secret for the next step in OAuth authentication process</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>: If you don&#8217;t see them right away, try accessing application settings and search them there.</div></div></li>
<li>Write down <em>Client ID</em> and <em>Client Secret</em>. We will need them later for authentication.</li>
<li>Open <em>SSIS Designer</em> and create a new package.</li>
<li>Right mouse click in the <em>Connection Managers</em> area and press <em><em><em>New connection&#8230; </em></em></em>and then <em>ZS-OAUTH</em>. This will create a new <em>OAuth Connection<em><em>.<br />
</em></em></em></p>
<div id="attachment_1334" style="width: 760px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-connection-for-restful-api-authentication-creation.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1334" class="wp-image-1334 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-4.png" alt="Create SSIS OAuth Connection for RESTful API authentication." width="750" height="252" /></a><p id="caption-attachment-1334" class="wp-caption-text">Create SSIS OAuth Connection for RESTful API authentication</p></div></li>
<li>Select<em> OAuth Provider </em>which will be used by an API when authenticating. Usually, <em>OAuth Provider&#8217;s</em> name is present in API&#8217;s name you want to use. E.g. Select <pre class="crayon-plain-tag">Google</pre>  as <em>OAuth Provider</em> for Google Sheets API:
<div id="attachment_1340" style="width: 411px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-connection-provider-selection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1340" class="wp-image-1340 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-5.png" alt="Select predefined OAuth Provider" width="401" height="120" /></a><p id="caption-attachment-1340" class="wp-caption-text">Select predefined OAuth Provider</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>: If you can&#8217;t see the provider you want, you will have to use <pre class="crayon-plain-tag">Custom</pre> option.</div></div></li>
<li><span style="text-decoration: underline;">This step is optional</span> (use it if you didn&#8217;t find predefined <em>OAuth Provider)</em>. For custom OAuth Provider you will need to configure<em>:</em>
<ol>
<li><em> </em><em>Authorization Url</em> and <em>Access Token Url</em>, which you will find in a guideline of an API.<br />
For HubSpot API these look like this:</p>
<div id="attachment_1344" style="width: 582px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-setting-authorization-and-access-token-url1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1344" class="size-full wp-image-1344" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-6.png" alt="Configure SSIS OAuth Connection Authorization and Access Token URLs" width="572" height="61" /></a><p id="caption-attachment-1344" class="wp-caption-text">Configure SSIS OAuth Connection Authorization and Access Token URLs</p></div></li>
<li><em>Callback/Return Url, </em>which you should have the same as <em>Redirect Url</em> field in you API App settings.<br />
For HubSpot API it is alright to enter your secure website address (with <em>https</em>). In this example, we will use <pre class="crayon-plain-tag">https://zappysys.com/oauth</pre>.</p>
<div id="attachment_1345" style="width: 581px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1345" class="size-full wp-image-1345" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-7.png" alt="Set Callback/Return Url in OAuth Connection" width="571" height="123" /><p id="caption-attachment-1345" class="wp-caption-text">Set Callback/Return Url in OAuth Connection</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 be surprised you cannot find <em>Redirect Url</em> field in your API App configuration. Some OAuth Providers don&#8217;t use this option.</div></div></li>
</ol>
</li>
<li>Now it&#8217;s time to supply <em>Client Id</em> and <em>Client Secret </em>you wrote down in Step #4, enter <em>Scopes / Permissions </em>your user will need (we will use <pre class="crayon-plain-tag">contacts</pre>) and <em><em>Generate a Token:<br />
</em></em></p>
<div id="attachment_1352" style="width: 781px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-oauth-connection-configuration-for-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1352" class="size-full wp-image-1352" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-8-1.png" alt="Input Client Id, Client Secret and Scopes to generate a token" width="771" height="403" /></a><p id="caption-attachment-1352" class="wp-caption-text">Input Client Id, Client Secret and Scopes to generate a token</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>:</p>
<ul>
<li>To add a scope for the predefined OAuth Provider, use <em>Select Scopes</em> button.</li>
<li>In scopes, if you set read only permissions you won&#8217;t be able call API methods that require write permissions.</li>
<li>Also be aware that you cannot use different scopes other than you defined in Step #2.</li>
</ul>
</div></div></li>
<li>Login with user account whose data you wish to access or just select a user if no login is needed:
<div id="attachment_1212" style="width: 638px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/select-hubspot-ordinary-account.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1212" class="wp-image-1212 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-9.png" alt="Select the user, whose data you want to access" width="628" height="385" /></a><p id="caption-attachment-1212" class="wp-caption-text">Select the user, whose data you want to access</p></div></li>
<li>Grant user access to your API App:
<div id="attachment_1214" style="width: 696px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/06/grant-access-to-hubspot-app.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1214" class="wp-image-1214 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/06/grant-access-to-hubspot-app-e1497462527310.png" alt="OAuth Connection SSIS component configuration - Grant access to HubSpot REST API App" width="686" height="345" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/grant-access-to-hubspot-app-e1497462527310.png 686w, https://zappysys.com/blog/wp-content/uploads/2017/06/grant-access-to-hubspot-app-e1497462527310-300x151.png 300w" sizes="(max-width: 686px) 100vw, 686px" /></a><p id="caption-attachment-1214" class="wp-caption-text">OAuth Connection SSIS component configuration &#8211; Grant access to HubSpot API App</p></div></li>
<li>You will get a prompt to save <em>Access</em> and <em>Refresh</em> tokens to a backup file. Press &#8220;Yes&#8221; to save them.<br />
<div class="su-note"  style="border-color:#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 will need to pass <pre class="crayon-plain-tag">Refresh Token</pre> as the parameter, when you run the package in another machine. Check <a href="#deployment">Deployment paragraph</a> for more info.</div></div></li>
<li>That&#8217;s it! From now on your SSIS task/component via your API App will be able to use user&#8217;s data which you just granted access to.</li>
</ol>
<h2>Using System Default Browser to get the token</h2>
<p>If embedded browser has some issue to extract your token then you can close the window by pressing <strong>[X]</strong> in the title bar. Once you do that you will be prompted to use System Default browser to finish the token extraction. If you click Yes then Full browser will be launched.</p>
<p><strong>NOTE:</strong> Below feature is added in version published after Dec 31, 2019 (v3.0.0.11231 or later) so make sure you have latest version.</p>
<div id="attachment_8782" style="width: 570px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-flow.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8782" class="size-full wp-image-8782" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-10.png" alt="Using System Default Browser to extract OAuth Token" width="560" height="287" /></a><p id="caption-attachment-8782" class="wp-caption-text">Using System Default Browser to extract OAuth Token</p></div>
<h3>Untrusted App Warning</h3>
<p>Sometimes Google might show you below warning. In order to continue the flow you might have to Click on <strong>Advanced</strong> and then click <strong>Go to YourAppName (unsafe)</strong> like below</p>
<div id="attachment_8779" style="width: 658px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/google-oauth-app-not-trusted.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8779" class="size-full wp-image-8779" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-11.png" alt="How to ignore Google Unsafe App Warning (OAuth Flow)" width="648" height="455" /></a><p id="caption-attachment-8779" class="wp-caption-text">How to ignore Google Unsafe App Warning (OAuth Flow)</p></div>
<h3>Select the account</h3>
<div id="attachment_8780" style="width: 939px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-for-oauth-token-extract.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8780" class="size-full wp-image-8780" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-12.png" alt="Using System Browser" width="929" height="699" /></a><p id="caption-attachment-8780" class="wp-caption-text">Using System Browser</p></div>
<h3>Copy code and finish the flow</h3>
<div id="attachment_8786" style="width: 1135px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/06/manually-extract-oauth-token-use-full-browser.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8786" class="size-full wp-image-8786" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-13.png" alt="Manually Copy Code and Get OAuth Refresh / Access Token " width="1125" height="672" /></a><p id="caption-attachment-8786" class="wp-caption-text">Manually Copy Code and Get OAuth Refresh / Access Token</p></div>
<p>&nbsp;</p>
<h2>Caching tokens (System-wide / multiple threads)</h2>
<p>By default, each connection generates a new token. If you&#8217;re making repeated calls in a loop, you might notice that multiple tokens are created within a short time. To avoid this, you can enable token caching. This allows the same token to be reused across requests, significantly reducing the number of token renewal operations.</p>
<p>To cache token, perform the following steps</p>
<ol>
<li>Goto the <strong>OAuth2 Grant Options</strong> Tab</li>
<li>Check the <strong>Cache token to file</strong> option</li>
<li>Enter Refresh Token / Cached Token File path. If the path is already prepopulated, then enter it where the token file will be saved.</li>
</ol>
<div id="attachment_11479" style="width: 615px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/06/oauth-token-cache-avoid-multiple-calls.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11479" class="size-full wp-image-11479" src="https://zappysys.com/blog/wp-content/uploads/2017/06/oauth-token-cache-avoid-multiple-calls.png" alt="Cache Token (Access token) - Across multiple processes and connections" width="605" height="489" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/oauth-token-cache-avoid-multiple-calls.png 605w, https://zappysys.com/blog/wp-content/uploads/2017/06/oauth-token-cache-avoid-multiple-calls-300x242.png 300w" sizes="(max-width: 605px) 100vw, 605px" /></a><p id="caption-attachment-11479" class="wp-caption-text">Cache Token (Access token) &#8211; Across multiple processes and connections</p></div>
<h2><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">Using OAuth 2.0 in ODBC Drivers / Data gateway</span></span></h2>
<p>So in previous section we talked how to setup OAuth in SSIS. If you like to use similar setup for Drivers in  <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ODBC PowerPack</a> then use below steps.</p>
<p>Following 3 drivers support OAuth Connection.</p>
<div class="su-table su-table-alternate">
<table style="width: 1364px">
<colgroup>
<col style="width: 80px" />
<col style="width: 170px" />
<col />
<col style="width: 140px" /> </colgroup>
<tbody>
<tr>
<th style="width: 90px"></th>
<th style="width: 233px">Driver</th>
<th style="width: 760px">Description</th>
</tr>
<p><!--json driver--></p>
<tr>
<td style="vertical-align: top;width: 90px"><img loading="lazy" decoding="async" class="" src="/images/odbc-powerpack/odbc-json-api-driver.png" alt="ODBC Driver for JSON File, REST, Web API" width="100" height="100" /></td>
<td style="vertical-align: top;width: 233px"><strong>JSON Files / REST API Driver</strong></p>
<a href="//zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/" class="su-button su-button-style-flat" style="color:#FFFFFF;background-color:#106ed3;border-color:#0d58a9;border-radius:0px" target="_blank" rel="noopener noreferrer"><span style="color:#FFFFFF;padding:6px 18px;font-size:14px;line-height:21px;border-color:#589ae1;border-radius:0px"><i class="sui sui-angle-double-right" style="font-size:14px;color:#FFFFFF"></i> Read More</span></a></td>
<td style="vertical-align: top;width: 760px">Must have ODBC Driver for <strong>JSON Files / REST API / OData</strong> Integration Projects. It can be used to read data from local JSON Files or any JSON based API Services (such as <strong>Google Analytics, BigQuery, Office 365 and many more</strong>). It supports high performance JSON Streaming engine with many options such as Pagination, Error handling, Security, Filtering.</td>
</tr>
<p><!--xml driver--></p>
<tr>
<td style="vertical-align: top;width: 90px"><img loading="lazy" decoding="async" class="" src="/images/odbc-powerpack/odbc-xml-api-driver.png" alt="ODBC Driver for XML File, REST, Web API" width="100" height="100" /></td>
<td style="vertical-align: top;width: 233px"><strong>XML Files / SOAP API Driver</strong></p>
<a href="//zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" class="su-button su-button-style-flat" style="color:#FFFFFF;background-color:#106ed3;border-color:#0d58a9;border-radius:0px" target="_blank" rel="noopener noreferrer"><span style="color:#FFFFFF;padding:6px 18px;font-size:14px;line-height:21px;border-color:#589ae1;border-radius:0px"><i class="sui sui-angle-double-right" style="font-size:14px;color:#FFFFFF"></i> Read More</span></a></td>
<td style="vertical-align: top;width: 760px">Must have ODBC Driver for <strong>XML Files / SOAP API / OData</strong> Integration Projects. It can be used to read data from local XML Files or any XML / SOAP based API Services (such as <strong>Google AdWords, DoubleClick, Salesforce and many more</strong>). It supports high performance JSON Streaming engine with many options such as Pagination, Error handling, Security, Filtering.</td>
</tr>
<p><!--csv driver--></p>
<tr>
<td style="vertical-align: top;width: 90px"><img loading="lazy" decoding="async" class="" src="/images/odbc-powerpack/odbc-csv-api-driver.png" alt="ODBC Driver for CSV File, REST, Web API" width="100" height="100" /></td>
<td style="vertical-align: top;width: 233px"><strong>CSV Files / REST API Driver</strong></p>
<a href="//zappysys.com/products/odbc-powerpack/odbc-csv-rest-api-driver/" class="su-button su-button-style-flat" style="color:#FFFFFF;background-color:#106ed3;border-color:#0d58a9;border-radius:0px" target="_blank" rel="noopener noreferrer"><span style="color:#FFFFFF;padding:6px 18px;font-size:14px;line-height:21px;border-color:#589ae1;border-radius:0px"><i class="sui sui-angle-double-right" style="font-size:14px;color:#FFFFFF"></i> Read More</span></a></td>
<td style="vertical-align: top;width: 760px">Using this ODBC Driver you can read from CSV Formatted files or REST API which sends response in CSV format. It supports GZip or Zip format. If CSV data coming from URL you can use many advanced API settings such as Pagination, Error handling, Security.</td>
</tr>
</tbody>
</table>
</div>
<h3>ODBC Driver OAuth Setup</h3>
<p>If you are using <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC Drivers</a> for API integration then use below steps to configure OAuth Connection to call API.</p>
<ol>
<li>Search for ODBC in start menu and select ODBC Data Source (64 bit)<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-data-sources-start-up-screen.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3992" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-ODBC-1.png" alt="Open ODBC Data Sources from Startup menu" width="986" height="622" /></a></li>
<li>Click ADD to Create a New ODBC DSN (Use System Tab if you creating DSN accessed by service account or other users on that machine)</li>
<li>Select desired ZappySys API driver (e.g. JSON Driver, XML Driver or CSV Driver)</li>
<li>When UI is visible like below you can select <strong>Connection Type</strong> dropdown to OAuth and click Configure.
<div id="attachment_5217" style="width: 788px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/gmail-oauth-configuration.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5217" class="wp-image-5217 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/rest-api-authentication-with-oauth-ODBC-2.png" alt="Configure OAuth Connection for ZappySys ODBC Drivers" width="778" height="632" /></a><p id="caption-attachment-5217" class="wp-caption-text">Configure OAuth Connection for ZappySys ODBC Drivers</p></div></li>
</ol>
<h3>Data Gateway OAuth Setup</h3>
<p>If you are using <a href="https://zappysys.com/products/odbc-powerpack/data-gateway/" target="_blank" rel="noopener">Data Gateway</a> for integration scenario like <a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">Import API data in SQL Server</a> then use almost same steps as previous section (ODBC DSN Setup) but in this case we have to click on New Data Source on Gateway Config UI as below.</p>
<div id="attachment_5431" style="width: 572px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5431" class="size-full wp-image-5431" src="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-1.png" alt="Configure Gateway Data Source" width="562" height="311" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-1.png 562w, https://zappysys.com/blog/wp-content/uploads/2018/11/gateway-create-datasource-2-1-300x166.png 300w" sizes="(max-width: 562px) 100vw, 562px" /></a><p id="caption-attachment-5431" class="wp-caption-text">Configure Gateway Data Source</p></div>
<h2></h2>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2><span id="Deploy_to_Production"><a name="deployment"></a>Parameterization and deployment 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>Conclusion</h2>
<p>In this tutorial we learned how to access user&#8217;s data from within SSIS using an API by authenticating with OAuth 2.0. As you have probably noticed already, OAuth 2.0 was used not only for authentication, but for authorization too (remember the <em>Scope </em>you had to set?). In subsequent article you will really get your hands dirty (not really, it is actually simple) and learn how to call an API method using SSIS <em>REST API Task.</em></p>
<h2>Keywords</h2>
<p>Connect to a RESTful API with OAuth using SSIS | How to authenticate to an API with OAuth using SSIS | Authenticate a user using OAuth with SSIS | Grant user access to API using OAuth from within SSIS | Authorize a user to access REST API with OAuth using SSIS</p>
<p>The post <a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/">How to authenticate to an API with OAuth 2.0 using SSIS / ODBC</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to get data from HubSpot API with SSIS</title>
		<link>https://zappysys.com/blog/get-data-from-hubspot-api-with-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 02 Jun 2017 15:31:16 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[hubspot]]></category>
		<category><![CDATA[HubSpot API]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[OAuth Connection]]></category>
		<category><![CDATA[RESTful API]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[ssis json source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1175</guid>

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