<?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>X509 Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/x509/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/x509/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Fri, 21 Nov 2025 03:31:14 +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>X509 Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/x509/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to configure MongoDB SSL Connection in SSIS</title>
		<link>https://zappysys.com/blog/configure-mongodb-ssl-connection-certificate/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 29 Aug 2017 19:50:01 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB Source]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[pem]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[X509]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1719</guid>

					<description><![CDATA[<p>Introduction MongoDB comes with SSL support, which can secure your end-to-end communication. However, setting up a MongoDB SSL Connection may require some configuration on both sides (i.e., Server and Client side). In this post, we aim to secure your MongoDB Integration in SSIS. Now, let&#8217;s look at the steps to configure SSL in MongoDB. Configure [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/configure-mongodb-ssl-connection-certificate/">How to configure MongoDB SSL Connection in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png"><img decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" /></a>MongoDB comes with SSL support, which can secure your end-to-end communication. However, setting up a MongoDB SSL Connection may require some configuration on both sides (i.e., Server and Client side). In this post, we aim to secure your <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-integration-pack/" target="_blank" rel="noopener">MongoDB Integration in SSIS</a>.</p>
<p>Now, let&#8217;s look at the steps to configure SSL in MongoDB.</p>
<h2>Configure SSL Support in MongoDB Server</h2>
<p>To configure MongoDB for SSL connectivity, the very first step is to generate a self-signed certificate in <a href="http://how2ssl.com/articles/working_with_pem_files/" target="_blank" rel="noopener">*.pem format</a> (This must be stored on the server)</p>
<h3>Download and Install OpenSSL</h3>
<p>First step is to <a href="http://slproweb.com/products/Win32OpenSSL.html" target="_blank" rel="noopener">download and install OpenSSL</a>. <span style="box-sizing: border-box; margin: 0px; padding: 0px;">Assuming you are running <strong>a </strong><span style="box-sizing: border-box; margin: 0px; padding: 0px;"><strong>64 Bit Windows</strong> OS, you can download the <strong>64 Bit Lite version</strong> of OpenSSL (about 3 </span>MB).</span> If you install it using default settings, then all binaries will be installed under <strong>C:\OpenSSL-Win64\bin\ </strong></p>
<h3>Create a self-signed certificate and *.pem file using OpenSSL.</h3>
<p>If you don&#8217;t have a trust issue and want to use a self-signed certificate rather than buying from a 3rd-party SSL Certificate Authority, you can create a self-signed certificate using the OpenSSL Command line as shown below. Now let&#8217;s look at how to generate a private key, a certificate file, and finally the *.pem file, which is the only required file by MongoDB.</p>
<p>A PEM file is the most common file format (container file format), which includes a Certificate and a Private Key in a single file.</p>
<p><span style="box-sizing: border-box; margin: 0px; padding: 0px;">Let&#8217;s look at how to <strong>create a PEM file using OpenSSL</strong>.</span></p>
<ol>
<li>First, run the command below. When prompted, enter &#8220;passphrase&#8221; (in our case, enter &#8220;test&#8221;).<br />
<pre class="crayon-plain-tag">openssl genrsa -des3 -out server.key 2048</pre>
</li>
<li>Now run the command below to <strong>generate a private key</strong> (*.key file)<br />
<pre class="crayon-plain-tag">openssl rsa -in server.key -out server.key</pre>
</li>
<li>After the private key is created, run the command below to <strong>create a CSR file</strong> (i.e., &#8220;Certificate Signing Request&#8221;). This file is needed to generate an actual certificate (Self-Signed or Signed by a 3rd Party, such as VeriSign or RapidSSL). If you omit the sub argument from below, then it may ask you a few questions (e.g, company name, department, etc), but for testing purposes, let&#8217;s make it easy 🙂<br />
To enter full details or just provide CN=xxxx<br />
<pre class="crayon-plain-tag">openssl req -sha256 -new -key server.key -out server.csr -subj &quot;/C=US/ST=Georgia/L=Atlanta/O=ZappySys LLC/OU=Org/E=testuser@zappysys.com/CN=localhost&quot;
-- or --
openssl req -sha256 -new -key server.key -out server.csr -subj &quot;/CN=localhost&quot;</pre>
</li>
<li>Now, let&#8217;s run the command below to <strong>generate a certificate file</strong> (*.crt). We are setting the expiration to 365 days; you can adjust as per your needs.<br />
<pre class="crayon-plain-tag">openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt</pre>
</li>
<li>Now, the last step is to <strong>combine the certificate (*.crt) and private key (*.key)</strong> <strong>files<strong> into a single </strong>PEM file</strong> using the command below. It will generate the desired *.pem file format, which can be used by the MongoDB server (In Unix OS, you can use the <strong>cat command</strong> rather than <strong>typing</strong>)<br />
<pre class="crayon-plain-tag">type server.crt server.key &gt; cert.pem</pre>
</li>
</ol>
<p>Once done, your <strong>cert.pem</strong> file will look like the following (Open and view in Notepad)</p><pre class="crayon-plain-tag">-----BEGIN CERTIFICATE-----
MIIDjjCCAnYCCQCDKO4/pCBfqTANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMC
VVMxCzAJBgNVBAgMAkdBMRAwDgYDVQQHDAdBdGxhbnRhMREwDwYDVQQKDAhaYXBw
eVN5czELMAkGA1UECwwCSVQxFTATBgNVBAMMDHphcHB5c3lzLmNvbTEjMCEGCSqG
RF5DmNx6gKlRWlOFmokMCz7wAglErDL4h/I3w6iZaVVkBmeDj30cms/fQ+upAI8U
KrBpNEwOglU9fjqjpnW0u8qGpXIk3NfdCm+6Lr91GL/u/9+gmSYw5YCCF6kYaRA/
2mqLXZ3Xp6WfTfVyQskKMB9D1+7QljqBZmFnTjLCaJ9MdJzzMpFyWPRB4Ix1kAzV
yZk=
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAyo++fr54Wh8anfEDZrr5O1NXwrPZW6KI3dPQ8FVHVDcBPETi
VX3qGcq8vywXH/LdwMEC4EQGED+zo50GmQdNiIzUfsnDbkq6rkqVNKjh7agkDlip
5vK3yuHtYAVp+laJ8X8kKISRttY7kcnl9gSkfTilwpN8//49G45Nx0JFu3o3Ortb
H4FPWjidQBAA6hPxoQi2h7YfEfpICL1RwYDCaQpdwMEJJqzcvaHCpdYVYd5PHLks
xRi8iwKBgA/S5w4/pwrzq0Jab/Afzf8AleZm/xLmXFpglgZF25AtVhpnayoHiTIk
9BdCXydi0ZOg4LtMqkSwt427UWCEnoRRH1WbKH2F9ZRWaELw/ix9RrZgTNmF821F
1/ILtO+QrN8tFnrLX3NAWurxUJxvzhBnvq40ZIHCyWvhRXUTkzTH
-----END RSA PRIVATE KEY-----</pre><p>
&nbsp;</p>
<h3>Edit the MongoDB Server config file (v3.0 or higher)</h3>
<p>Now that we have the *.pem file, we can use it to launch a MongoDB server instance. Before we do that, one more step is needed. We have to specify a few parameters in the MongoDB config file.</p>
<ol>
<li>Navigate to the MongoDB installation directory (where <strong>mongod.exe</strong> is found)</li>
<li>Create an empty text file called mongo-config.txt and enter the following text (assuming cer.pem, mongo-config.txt, and all mongod.exe are in the same folder). The password was tested when we created the PEM file. If you used a different one, then change it below.<br />
<strong>mongo-config.txt</strong><br />
<pre class="crayon-plain-tag">net:  
    bindIp: localhost
    ssl:
        mode: requireSSL
        PEMKeyFile: cert.pem
        PEMKeyPassword: test
        allowInvalidCertificates: true
        allowInvalidHostnames: true</pre>
</li>
</ol>
<h3>Start the MongoDB Server using the Config file</h3>
<p>Once you create a config file, we can start the MongoDB instance using the following command line to use the new config file with SSL mode enabled. That&#8217;s it, your server is now accepting Secure connections using SSL.</p><pre class="crayon-plain-tag">mongod -f &quot;mongod-config.txt&quot;</pre><p>
<h2>Using the SSL option in the SSIS MongoDB Connection</h2>
<p>Now, let&#8217;s look at the steps to secure the MongoDB connection in SSIS.</p>
<h3><span id="Prerequisites">Prerequisites</span></h3>
<p>Before we look at the Step-By-Step section on securing the MongoDB Connection in SSIS, let&#8217;s make sure you meet the following requirements.</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred to 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 the Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>ZappySys SSIS PowerPack</em> installed</a>. Click on the link to download a FREE trial.</li>
<li>You have basic familiarity with MongoDB.</li>
</ol>
<h3>Using SSL in the SSIS MongoDB Connection Manager</h3>
<p>To enable SSL in SSIS, open the MongoDB connection manager and go to the SSL Tab. Check the Enable SSL option as shown below. Once you do this, and if your MongoDB server is configured correctly to use SSL, then your connection Test will be green, and any traffic between you and your MongoDB server will be encrypted using SSL.</p>
<div id="attachment_11646" style="width: 1035px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/SSIS-MongoDB-Connection-SSL-Settings.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-11646" class="wp-image-11646 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/08/SSIS-MongoDB-Connection-SSL-Settings.png" alt="" width="1025" height="540" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/SSIS-MongoDB-Connection-SSL-Settings.png 1025w, https://zappysys.com/blog/wp-content/uploads/2017/08/SSIS-MongoDB-Connection-SSL-Settings-300x158.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/08/SSIS-MongoDB-Connection-SSL-Settings-768x405.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/08/SSIS-MongoDB-Connection-SSL-Settings-720x380.png 720w" sizes="(max-width: 1025px) 100vw, 1025px" /></a><p id="caption-attachment-11646" class="wp-caption-text">SSIS MongoDB Connection &#8211; SSL Settings</p></div>
<h3>Using X509 Client Authentication in SSIS MongoDB Connection Manager</h3>
<p>Now, let&#8217;s look at how to authenticate using the X509 Client Certificate (X509) method. For this method, you must use the PFX certificate format (do not use PEM). To create a PFX file from the PEM we created earlier, you can run the following command. When prompted, use the same password you used before to generate a private key.</p><pre class="crayon-plain-tag">openssl pkcs12 -export -out cert.pfx -inkey server.key -in server.crt</pre><p>
<span style="box-sizing: border-box; margin: 0px; padding: 0px;">To learn more about the whole process of how to configure the MongoDB Server to use Client X509 Certificate, <a href="https://github.com/shauryashaurya/tutorial-x.509certificates-mongo" target="_blank" rel="noopener">check this Article</a>.</span></p>
<p>Let&#8217;s look at the steps to configure the SSIS MongoDB Connection Manager to use X509 Client Certificate Mode.</p>
<ol>
<li>Open ZappySys MongoDB Connection Manager UI</li>
<li>Enter the User ID you created in the <strong>$external</strong> database (This UserID usually matches the Subject of your Certificate). For example, in our case, UserID may appear as follows. Leave the password blank because it&#8217;s not used in the X. 509 method.<br />
<pre class="crayon-plain-tag">emailAddress=user@myemail.com,CN=127.0.0.1,OU=UNIT,O=DEMO,L=city,ST=test,C=AU</pre>
<div id="attachment_11644" style="width: 628px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Set-UserID-of-external-database.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11644" class="wp-image-11644 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Set-UserID-of-external-database.png" alt="" width="618" height="540" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Set-UserID-of-external-database.png 618w, https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Set-UserID-of-external-database-300x262.png 300w" sizes="(max-width: 618px) 100vw, 618px" /></a><p id="caption-attachment-11644" class="wp-caption-text">Configure SSIS MongoDB Connection for Client X509 Certificate (Set UserID of $external database)</p></div>
<div class="mceTemp"></div>
</li>
<li> Now go to the SSL Tab. Check SSL Option, You can check Ignore SSL Validation error (If it&#8217;s a signed certificate)</li>
<li>Select the PFX file path and enter the certificate password if needed. If you type Path, then Subject Line appears automatically (You can use it as UserID field if you were unsure in Step#1 however, we still recommend making sure UserID is an  exact match based on the original name your System Admin created in <strong>$external</strong> DB)
<div class="mceTemp"></div>
<div id="attachment_11643" style="width: 571px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Select-PFX-File-Specify-Password.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11643" class="wp-image-11643 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Select-PFX-File-Specify-Password.png" alt="" width="561" height="541" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Select-PFX-File-Specify-Password.png 561w, https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Select-PFX-File-Specify-Password-300x289.png 300w" sizes="(max-width: 561px) 100vw, 561px" /></a><p id="caption-attachment-11643" class="wp-caption-text">Configure SSIS MongoDB Connection for Client X509 Certificate (Select PFX File &#8211; Specify Password)</p></div>
<div class="mceTemp"></div>
</li>
<li>Now go to the Advanced Tab and enter the Below Option. By default, MongoDB Connection Manager uses the userid/password mode. To use <strong>X509</strong> Auth mode, you must set an option in the Advanced Options table as shown below.<br />
<pre class="crayon-plain-tag">authMechanism=MONGODB-X509</pre>
<div id="attachment_11645" style="width: 571px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Specify-authMechanismMONGODB-X509.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11645" class="wp-image-11645 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Specify-authMechanismMONGODB-X509.png" alt="" width="561" height="541" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Specify-authMechanismMONGODB-X509.png 561w, https://zappysys.com/blog/wp-content/uploads/2017/08/Configure-SSIS-MongoDB-Connection-for-Client-X509-Certificate-Specify-authMechanismMONGODB-X509-300x289.png 300w" sizes="(max-width: 561px) 100vw, 561px" /></a><p id="caption-attachment-11645" class="wp-caption-text">Configure SSIS MongoDB Connection for Client X509 Certificate (Specify authMechanism=MONGODB-X509)</p></div>
<div class="mceTemp"></div>
</li>
<li>Click Test connection to make sure it&#8217;s successful.</li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/configure-mongodb-ssl-connection-certificate/">How to configure MongoDB SSL Connection in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read/load data in Xero using SSIS</title>
		<link>https://zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 25 Jul 2017 03:02:24 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth1]]></category>
		<category><![CDATA[OAuth2.0]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[ssis oauth connection]]></category>
		<category><![CDATA[X509]]></category>
		<category><![CDATA[Xero]]></category>
		<category><![CDATA[Xero Api]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1602</guid>

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