<?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 oauth connection Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/ssis-oauth-connection/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/ssis-oauth-connection/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Tue, 23 Dec 2025 14:14:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.4</generator>

<image>
	<url>https://zappysys.com/blog/wp-content/uploads/2023/01/cropped-zappysys-symbol-large-32x32.png</url>
	<title>ssis oauth connection Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/ssis-oauth-connection/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to read/load data in Xero using SSIS</title>
		<link>https://zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 25 Jul 2017 03:02:24 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth1]]></category>
		<category><![CDATA[OAuth2.0]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[ssis oauth connection]]></category>
		<category><![CDATA[X509]]></category>
		<category><![CDATA[Xero]]></category>
		<category><![CDATA[Xero Api]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1602</guid>

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

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