<?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 rest api task Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/ssis-rest-api-task/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/ssis-rest-api-task/</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 rest api task Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/ssis-rest-api-task/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to call Google DFP API with SSIS &#8211; DoubleClick</title>
		<link>https://zappysys.com/blog/calling-google-dfp-api-with-ssis-doubleclick-soap-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 14 Feb 2017 19:28:31 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[AdSense]]></category>
		<category><![CDATA[AdWords]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[DFP]]></category>
		<category><![CDATA[doubleclick]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<category><![CDATA[ssis xml source]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1000</guid>

					<description><![CDATA[<p>Introduction Google DoubleClick is one of the most popular platforms for Advertisers. Many times you have need for custom integration or Automation for many operations. In this article we will learn how to Call Google DFP API (i.e. DoubleClick for Publishers) without coding using SSIS (Microsoft SQL Server Integration Services). In our previous article we [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/calling-google-dfp-api-with-ssis-doubleclick-soap-api/">How to call Google DFP API with SSIS &#8211; DoubleClick</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/google-doubleclick-dfp-api-integration.png"><img decoding="async" class=" wp-image-1634 alignleft" src="//zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration.png" alt="" width="198" height="198" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration.png 500w, https://zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration-300x300.png 300w" sizes="(max-width: 198px) 100vw, 198px" /></a>Google DoubleClick is one of the most popular platforms for Advertisers. Many times you have need for custom integration or Automation for many operations. In this article we will learn how to Call Google DFP API (i.e. DoubleClick for Publishers) without coding using SSIS (Microsoft SQL Server Integration Services). In our previous article we discussed how to Integrate <a href="https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/" target="_blank" rel="noopener">Google AdWords API using SSIS (Click here)</a>.</p>
<p>If you are new to SSIS then no worry there are plenty of <a href="http://www.bing.com/search?q=ssis+tutorials&amp;src=IE-TopResult&amp;FORM=IE11TR&amp;conversationid=" target="_blank" rel="noopener">tutorials for ssis</a></p>
<p>To achieve Custom integration for DoubleClick (DFP) API we will use <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a>. XML Source is part of <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> which has 45+ connectors and Tasks.</p>
<p>&nbsp;</p>
<h2>Prerequisite</h2>
<p>Before you can finish tasks explained in this article you have to finish below steps. This article assumes you have basic knowledge of SSIS (SQL Server Integration Services)</p>
<ol>
<li>Make sure you SSIS designer installed. Sometimes its referred as BIDS or SSDT (<a href="https://msdn.microsoft.com/en-us/mt186501" target="_blank" rel="noopener">Get from here)</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Download SSIS PowerPack</a></li>
<li><a href="https://www.soapui.org/downloads/soapui.html" target="_blank" rel="noopener">Download SoapUI</a> (Its free third party tool to test SOAP API). SoapUI can help you to generate XML Request BODY easily from WSDL file provided by API Vendor. You can also test your service by supplying parameters.</li>
<li>Optional &#8211; Another very useful Free tool is Fiddler. You can use it to see raw request/response (<a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Check this article</a>)</li>
</ol>
<h2>Download DFP API Example SSIS Package</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/02/Google-DoubleClick-API-SSIS-DEMO.zip" target="_blank" rel="noopener">Click here to DFP API download Sample for SSIS</a> SSIS Package (SSIS 2012, 2014, 2016)</p>
<p>Screenshot of Sample Package:</p>
<div id="attachment_1059" style="width: 977px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-1059" class="size-full wp-image-1059" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick.png" alt="Example SSIS Package - Google DFP API Integration (Read / Write data in Google Double Click for Publisher) - No Coding required" width="967" height="650" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick.png 967w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick-300x202.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick-272x182.png 272w" sizes="(max-width: 967px) 100vw, 967px" /></a><p id="caption-attachment-1059" class="wp-caption-text">Example SSIS Package &#8211; Google DFP API Integration (Read / Write data in Google Double Click for Publisher) &#8211; No Coding required</p></div>
<h2>Making your first DFP API Call using SSIS</h2>
<p>Once you install <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">PowerPack</a> you are ready to execute your very first Google DFP API Call.</p>
<p><strong>NOTE</strong>: If you don&#8217;t have any DFP network for test then see next section (Explains how to create test network for testing).</p>
<p>Lets look at how to call Google DFP API step-by-step.</p>
<ol>
<li>Create new SSIS Project and open package designer</li>
<li>Drag <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS control flow toolbox and drop it on designer.<br />
<div class="su-note"  style="border-color:#e5e5c6;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> is useful when you want to call SOAP/REST API but not necessarily parse response into rows and columns. We will look at <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source</a> later in this article which can actually parse response into rows and columns (Useful to load Google DFP data into SQL Server or other RDBMS / flatfile )</div></div></li>
<li>Double click REST API Task to configure. Select Access mode to [Url from Connection]</li>
<li>Enter following URL in the URL Textbox<br />
<pre class="crayon-plain-tag">&nbsp;https://ads.google.com/apis/ads/publisher/v201702/NetworkService</pre>
</li>
<li>From the connection dialogbox select <strong>ZS-OAUTH</strong> to create new OAuth Connection for DFP API</li>
<li>On OAuth Connection dialogbox select <strong>Google</strong> from Provider dropdown. In this demo we will use Default OAuth App but you can <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">register your own google OAuth app</a> if you wish to use Custom OAuth option from UI.</li>
<li>Enter following Scopes in the Scopes textbox (or select manually by clicking Select Scopes button). Scope is nothing but permission for API (In our case View/Manage DFP data and Read/Write Report Files to Cloud Storage).<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/dfp
https://www.googleapis.com/auth/devstorage.read_only
https://www.googleapis.com/auth/devstorage.write_only
https://www.googleapis.com/auth/cloud-platform.read-only
https://www.googleapis.com/auth/devstorage.full_control
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/devstorage.read_write</pre>
</li>
<li>If you are not going call <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService" target="_blank" rel="noopener">ReportService</a> API to generate Reports in CSV format then you will need only one scope<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/dfp</pre>
</li>
<li>Click Generate Token button. You will see browser popup for login and then Accept option to confirm permissions like below. Once you don&#8217;t it will populate tokens and prompt to save tokens to backup file. Secure token backup to safe place.
<div id="attachment_1034" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-2-connection-call-google-dfp-api-doubleclick-soap-webservice.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1034" class="wp-image-1034" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-2-connection-call-google-dfp-api-doubleclick-soap-webservice.png" alt="SSIS OAuth Connection - Connect to Google DFP API (DoubleClick SOAP Web Service)" width="600" height="491" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-2-connection-call-google-dfp-api-doubleclick-soap-webservice.png 816w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-2-connection-call-google-dfp-api-doubleclick-soap-webservice-300x246.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-1034" class="wp-caption-text">SSIS OAuth Connection &#8211; Connect to Google DFP API (DoubleClick SOAP Web Service)</p></div></li>
<li>Once done Click Test Connection and if its green then Click OK to save connection</li>
<li>Once you are back to REST API Task UI then select Method to <strong>POST</strong></li>
<li>Select Request Body <strong>Content Type</strong> to XML (i.e. text/xml)</li>
<li>Click edit button next to <strong>Request Body</strong> and enter following XML.<br />
<pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader/&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:getAllNetworks/&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre>
<div class="su-note"  style="border-color:#e5e5c6;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">
<p>If you are wondering how did we get above XML fragment then read next section about using 3rd party tool called SoapUI. Also we have detail article for calling SOAP request. <a href="//zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">Check this article on how to use SoapUI (free 3rd party tool) to create SOAP request Bodyfrom WSDL</a>. DFP has many API endpoints for different actions (e.g. <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService" target="_blank" rel="noopener">NetworkService</a> , <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService" target="_blank" rel="noopener">InventoryService</a> , &#8230;). For each service you have different Api URL and different WSDL. In the next section you can learn how to create correct SOAP Body (for POST) using <strong>SoapUI</strong> tool.</p>
<p>For example if you using DFP NetworkService API for version v201702 then your <strong>help page URL would be like this</strong><br />
<a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService" target="_blank" rel="noopener">https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService</a><br />
And on the same page you will see <strong>WSDL link below</strong><br />
<a href="https://adwords.google.com/api/adwords/mcm/v201609/ManagedCustomerService?wsdl" target="_blank" rel="noopener">https://adwords.google.com/api/adwords/mcm/v201609/ManagedCustomerService?wsdl</a><br />
(Just download that WSDL XML and save to local disk then use with SoapUI to generate XML body to submit for any DFP API call.)</p>
</div></div></li>
<li>Once you done with above steps, your Task Configuration will look like below.
<div id="attachment_1035" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-task-call-dfp-google-doubleclick-api-getAllNetworks.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1035" class="wp-image-1035" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-task-call-dfp-google-doubleclick-api-getAllNetworks.png" alt="SSIS Rest API Task - Call Google DoubleClick API - Get all DFP Networks" width="600" height="522" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-task-call-dfp-google-doubleclick-api-getAllNetworks.png 805w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-task-call-dfp-google-doubleclick-api-getAllNetworks-300x261.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-1035" class="wp-caption-text">SSIS Rest API Task &#8211; Call Google DoubleClick API &#8211; Get all DFP Networks</p></div></li>
<li>Now click Test Request button. You will see Response popup with below content if its successful (Scroll at the bottom on response form and you will see XML data) .. see below<br />
<pre class="crayon-plain-tag">------------------------------------
Request
------------------------------------
POST https 1.1 ==&gt; /apis/ads/publisher/v201702/NetworkService
Host: ads.google.com

&gt;&gt;&gt;&gt; HEADERS &lt;&lt;&lt;&lt;&lt;
Authorization: Bearer ya29.Glz-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: text/xml;charset=UTF-8
User-Agent: ZappySysApp
Host: ads.google.com
Content-Length: 291
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

------------------------------------
Response
------------------------------------
POST 1.1 200 OK==&gt; OK

&gt;&gt;&gt;&gt; HEADERS &lt;&lt;&lt;&lt;&lt;
Content-Encoding: 
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Alt-Svc: quic=":443"; ma=2592000; v="35,34"
Transfer-Encoding: chunked
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=UTF-8
Date: Sun, 26 Feb 2017 01:18:32 GMT
Expires: Sun, 26 Feb 2017 01:18:32 GMT
Server: GSE

&gt;&gt;&gt;&gt; Cookies &lt;&lt;&lt;&lt;&lt;

&gt;&gt;&gt;&gt; CONTENT &lt;&lt;&lt;&lt;&lt;

&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;27ab3d2e4e1fcb8f444b317d0b0f871d&lt;/requestId&gt;
			&lt;responseTime&gt;50&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getAllNetworksResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;
				&lt;id&gt;551196&lt;/id&gt;
				&lt;displayName&gt;XFP sandbox property&lt;/displayName&gt;
				&lt;networkCode&gt;238897396&lt;/networkCode&gt;
				&lt;propertyCode&gt;ca-pub-2799179143725683&lt;/propertyCode&gt;
				&lt;timeZone&gt;America/New_York&lt;/timeZone&gt;
				&lt;currencyCode&gt;USD&lt;/currencyCode&gt;
				&lt;effectiveRootAdUnitId&gt;237897516&lt;/effectiveRootAdUnitId&gt;
				&lt;isTest&gt;true&lt;/isTest&gt;
			&lt;/rval&gt;
		&lt;/getAllNetworksResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre>
&nbsp;</li>
</ol>
<h2>How to generate SOAP Request Body using SoapUI tool</h2>
<p>This section describes how to create DoubleClick SOAP API Request Body (XML fragment) for any DFP SOAP API call described anywhere in this article.</p>
<ol>
<li><a href="https://www.soapui.org/downloads/soapui.html" target="_blank" rel="noopener">Download SoapUI</a> (Its free third party tool to test SOAP API). SoapUI can help you to generate XML Request BODY easily from WSDL file provided by API Vendor. You can also test your service by supplying parameters.</li>
<li>Now download WDSL xml for appropriate API calls you want to make. Assume that you want to call  <strong>getAllNetworksResponse</strong> API found under <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService" target="_blank" rel="noopener">NetworkService</a>. For that first navigate to help file page and open help page. Make sure you select correct version from help navigation. Copy WSDL link and open in new browser window. Save XML to local disk (e.g. c:\api\dfp_networkservice_wsdl.xml (See below screenshot how to find DFP API WSDL link)
<div id="attachment_1043" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/get-dftp-soap-api-wsdl-doubleclick-web-service.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1043" class="wp-image-1043" src="//zappysys.com/blog/wp-content/uploads/2017/02/get-dftp-soap-api-wsdl-doubleclick-web-service.png" alt="How to get Google DFP API WSDL URL (Used to generate POST Body)" width="600" height="501" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/get-dftp-soap-api-wsdl-doubleclick-web-service.png 969w, https://zappysys.com/blog/wp-content/uploads/2017/02/get-dftp-soap-api-wsdl-doubleclick-web-service-300x250.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-1043" class="wp-caption-text">How to get Google DFP API WSDL URL (Used to generate POST Body)</p></div></li>
<li>Once SoapUI is downloaded and installed click <strong>File</strong> menu &gt; <strong>Create New SOAP Project</strong> option</li>
<li>Name your project (e.g. DFP API) and specify WSDL URL or File Path if it was saved locally (e.g. c:\api\dfp_networkservice_wsdl.xml) and click OK</li>
<li>Now navigate to API Action for which you would like to get Body. Click Request node (If missing create new) and edit request. You may see XML like below (If some optional parameters not visible in XML then click Re-create request with optional parameters button from toolbar)
<div id="attachment_1044" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-generate-soap-request-body-from-wsdl.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1044" class="wp-image-1044" src="//zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-generate-soap-request-body-from-wsdl.png" alt="Call Google DFP API - Generate SOAP Request Body XML using SoapUI (Google DoubleClick Web Service)" width="600" height="284" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-generate-soap-request-body-from-wsdl.png 727w, https://zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-generate-soap-request-body-from-wsdl-300x142.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-1044" class="wp-caption-text">Call Google DFP API &#8211; Generate SOAP Request Body XML using SoapUI (Google DoubleClick Web Service)</p></div></li>
<li>Edit necessary parameters from above XML code and copy to Body of SSIS REST API Task.</li>
</ol>
<h2>Creating test network &#8211; DFP Sandbox</h2>
<p>Very first step we recommend before testing DFP API call is <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService#makeTestNetwork">create test network</a>. You can call DFP API against LIVE network but not recommended if you are calling create/update API.</p>
<p>To create test network you can follow exact same steps described in the previous section except the Body step (Step#12). Use following Request body to call makeTestNetwork command.</p>
<h3>API makeTestNetwork &#8211; Request</h3>
<p>URL: https://ads.google.com/apis/ads/publisher/v201702/NetworkService<br />
Body (see below):</p><pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader/&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:makeTestNetwork/&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre><p>
Once you click Test you may receive following response. Note your network code (e.g. 1122334455 from below). This network code is used in pretty much all DFP API to view or manage ad network related items or properties.</p>
<h3>API makeTestNetwork &#8211; Response</h3>
<pre class="crayon-plain-tag">&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;ba61d79efee325bf4b5aa45c46836021&lt;/requestId&gt;
			&lt;responseTime&gt;1021&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;makeTestNetworkResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;
				&lt;id&gt;551196&lt;/id&gt;
				&lt;displayName&gt;XFP sandbox property&lt;/displayName&gt;
				&lt;networkCode&gt;1122334455&lt;/networkCode&gt;
				&lt;propertyCode&gt;ca-pub-2799179143725683&lt;/propertyCode&gt;
				&lt;timeZone&gt;America/Los_Angeles&lt;/timeZone&gt;
				&lt;currencyCode&gt;USD&lt;/currencyCode&gt;
				&lt;effectiveRootAdUnitId&gt;237897516&lt;/effectiveRootAdUnitId&gt;
				&lt;isTest&gt;true&lt;/isTest&gt;
			&lt;/rval&gt;
		&lt;/makeTestNetworkResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre>
Above response contains test networkcode copy that code becuase you will need in almost every API call you make later. You can only have one test network. If test network is already created and you try to execute above code then you may receive error  <strong>AuthenticationError.GOOGLE_ACCOUNT_ALREADY_ASSOCIATED_WITH_NETWORK</strong></p>
<p>You can also get network code using two different ways.</p>
<ul>
<li>Visit your DFP console homepage by visiting <a href="https://www.google.com/dfp/" target="_blank" rel="noopener">https://www.google.com/dfp/</a> and you will see network name and code in the top potion. Also its listed in the URL (e.g. https://www.google.com/dfp/1234567)</li>
<li>Another way to get available networks for your login is to visit DFP API Play ground here <a href="https://dfp-playground.appspot.com/" target="_blank" rel="noopener">https://dfp-playground.appspot.com/</a> and you will see network list in the dropdown ( name and network code)</li>
</ul>
<h2>How to Create new Ad Units</h2>
<p>Now lets look at an example which will create few Ad Units by calling <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService#createAdUnits" target="_blank" rel="noopener">createAdUnits</a> API. If you are creating Ad Unit at the root level then you will need to specify correct Parent ID (i.e  effectiveRootAdUnitId). To obtain that Parent ID you may have to call  <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService#getcurrentnetwork" target="_blank" rel="noopener">getCurrentNetwork</a> API. In the response you will see effectiveRootAdUnitId.</p>
<p>There is another way to know effectiveRootAdUnitId or Id of any Ad Units which can be Parent for new AdUnit. Goto google.com/dfp &gt; Click Inventory Tab &gt; Click Ad Units Side menu &gt; Click Download ad units hyper link. You can also download AdUnits as CSV file from DFP Portal and look for Ad Units which are created at the root. Parent ID column for Root level Ad Units is basically called effectiveRootAdUnitId.</p>
<p>Now lets look at how to get EffectiveRootID by calling <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService#getcurrentnetwork" target="_blank" rel="noopener">getCurrentNetwork</a>.</p>
<h3>API getCurrentNetwork &#8211; Request</h3>
<p>URL: https://ads.google.com/apis/ads/publisher/v201702/NetworkService<br />
Body (see below):</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;soap:Header&gt;
	&lt;RequestHeader xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
		&lt;networkCode xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;1122334455&lt;/networkCode&gt;
		&lt;applicationName xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;ZappySysApp&lt;/applicationName&gt;
	&lt;/RequestHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getCurrentNetwork xmlns="https://www.google.com/apis/ads/publisher/v201608" /&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
&nbsp;</p>
<h3>API getCurrentNetwork &#8211; Response</h3>
<pre class="crayon-plain-tag">&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;requestId&gt;81d1b00e8fbfb862129eb2dd485cf7bb&lt;/requestId&gt;
			&lt;responseTime&gt;4507&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getCurrentNetworkResponse xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;rval&gt;
				&lt;id&gt;551196&lt;/id&gt;
				&lt;displayName&gt;XFP sandbox property&lt;/displayName&gt;
				&lt;networkCode&gt;1122334455&lt;/networkCode&gt;
				&lt;propertyCode&gt;ca-pub-2799179143725683&lt;/propertyCode&gt;
				&lt;timeZone&gt;America/New_York&lt;/timeZone&gt;
				&lt;currencyCode&gt;USD&lt;/currencyCode&gt;
				&lt;effectiveRootAdUnitId&gt;237897516&lt;/effectiveRootAdUnitId&gt;
				&lt;isTest&gt;true&lt;/isTest&gt;
			&lt;/rval&gt;
		&lt;/getCurrentNetworkResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre>
&nbsp;</p>
<p>If you want to save single Element Value from Response into SSIS Variable then perform following steps (example of how to get just effectiveRootAdUnitId from above response)</p>
<ol>
<li>On REST API Task &gt; Go to Response Tab &gt; Select Response Content Type = XML</li>
<li>Enter following expression in the XPath filter<br />
<pre class="crayon-plain-tag">//*[local-name() = 'effectiveRootAdUnitId']</pre>
</li>
<li>Check Save response content option</li>
<li>Select Variable from Dropdown &#8211; Click New Variable &gt; Name it RootAdUnitId.</li>
<li>Click Test Request Button to test&#8230;. In the content textbox you will now see only Numeric value extracted by Filter</li>
</ol>
<div id="attachment_1050" style="width: 832px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-save-response-into-variable-xpath-jsonpath-filter-extract-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1050" class="size-full wp-image-1050" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-save-response-into-variable-xpath-jsonpath-filter-extract-value.png" alt="SSIS REST Api Task - How to extract single vale from response and save to SSIS variable" width="822" height="616" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-save-response-into-variable-xpath-jsonpath-filter-extract-value.png 822w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-save-response-into-variable-xpath-jsonpath-filter-extract-value-300x225.png 300w" sizes="(max-width: 822px) 100vw, 822px" /></a><p id="caption-attachment-1050" class="wp-caption-text">SSIS REST Api Task &#8211; How to extract single vale from response and save to SSIS variable</p></div>
<p>Once you know Parent ID for your AdUnit now lets look at how to create Ad Units by calling <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService#createAdUnits" target="_blank" rel="noopener">createAdUnits</a></p>
<h3>API createAdUnits &#8211; Request</h3>
<p>URL: https://ads.google.com/apis/ads/publisher/v201702/InventoryService<br />
Body (see below):</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
	&lt;soap:Header&gt;
		&lt;RequestHeader xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;networkCode xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;1122334455&lt;/networkCode&gt;
			&lt;applicationName xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;ZappySysApp&lt;/applicationName&gt;
		&lt;/RequestHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;createAdUnits xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;adUnits&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;name&gt;Ad_Unit_0&lt;/name&gt;
				&lt;description&gt;Ad unit description #0.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
				&lt;/adUnitSizes&gt;
			&lt;/adUnits&gt;
			&lt;adUnits&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;name&gt;Ad_Unit_1&lt;/name&gt;
				&lt;description&gt;Ad unit description #1.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
				&lt;/adUnitSizes&gt;
			&lt;/adUnits&gt;			
		&lt;/createAdUnits&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<h3>API createAdUnits &#8211; Response</h3>
</p><pre class="crayon-plain-tag">&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;requestId&gt;b244d7ba9b65e96fc42b849a7bfb16e4&lt;/requestId&gt;
			&lt;responseTime&gt;331&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;createAdUnitsResponse xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;rval&gt;
				&lt;id&gt;252312396&lt;/id&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;hasChildren&gt;false&lt;/hasChildren&gt;
				&lt;parentPath&gt;
					&lt;id&gt;237897516&lt;/id&gt;
					&lt;name&gt;ca-pub-2799179143725683&lt;/name&gt;
					&lt;adUnitCode&gt;ca-pub-2799179143725683&lt;/adUnitCode&gt;
				&lt;/parentPath&gt;
				&lt;name&gt;Ad_Unit_0&lt;/name&gt;
				&lt;description&gt;Ad unit description#0.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;status&gt;ACTIVE&lt;/status&gt;
				&lt;adUnitCode&gt;253312396&lt;/adUnitCode&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
						&lt;isAspectRatio&gt;false&lt;/isAspectRatio&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
					&lt;fullDisplayString&gt;300x250&lt;/fullDisplayString&gt;
				&lt;/adUnitSizes&gt;
				&lt;mobilePlatform&gt;SITE&lt;/mobilePlatform&gt;
				&lt;explicitlyTargeted&gt;false&lt;/explicitlyTargeted&gt;
				&lt;inheritedAdSenseSettings&gt;
					&lt;value&gt;
						&lt;adSenseEnabled&gt;true&lt;/adSenseEnabled&gt;
						&lt;borderColor&gt;FFFFFF&lt;/borderColor&gt;
						&lt;titleColor&gt;0000FF&lt;/titleColor&gt;
						&lt;backgroundColor&gt;FFFFFF&lt;/backgroundColor&gt;
						&lt;textColor&gt;000000&lt;/textColor&gt;
						&lt;urlColor&gt;008000&lt;/urlColor&gt;
						&lt;adType&gt;TEXT_AND_IMAGE&lt;/adType&gt;
						&lt;borderStyle&gt;DEFAULT&lt;/borderStyle&gt;
						&lt;fontFamily&gt;DEFAULT&lt;/fontFamily&gt;
						&lt;fontSize&gt;DEFAULT&lt;/fontSize&gt;
					&lt;/value&gt;
				&lt;/inheritedAdSenseSettings&gt;
				&lt;lastModifiedDateTime&gt;
					&lt;date&gt;
						&lt;year&gt;2017&lt;/year&gt;
						&lt;month&gt;2&lt;/month&gt;
						&lt;day&gt;27&lt;/day&gt;
					&lt;/date&gt;
					&lt;hour&gt;7&lt;/hour&gt;
					&lt;minute&gt;23&lt;/minute&gt;
					&lt;second&gt;32&lt;/second&gt;
					&lt;timeZoneID&gt;PST8PDT&lt;/timeZoneID&gt;
				&lt;/lastModifiedDateTime&gt;
				&lt;smartSizeMode&gt;NONE&lt;/smartSizeMode&gt;
				&lt;isSharedByDistributor&gt;false&lt;/isSharedByDistributor&gt;
				&lt;isSetTopBoxEnabled&gt;false&lt;/isSetTopBoxEnabled&gt;
			&lt;/rval&gt;
			&lt;rval&gt;
				&lt;id&gt;252312516&lt;/id&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;hasChildren&gt;false&lt;/hasChildren&gt;
				&lt;parentPath&gt;
					&lt;id&gt;237897516&lt;/id&gt;
					&lt;name&gt;ca-pub-2799179143725683&lt;/name&gt;
					&lt;adUnitCode&gt;ca-pub-2799179143725683&lt;/adUnitCode&gt;
				&lt;/parentPath&gt;
				&lt;name&gt;Ad_Unit_1&lt;/name&gt;
				&lt;description&gt;Ad unit description#2.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;status&gt;ACTIVE&lt;/status&gt;
				&lt;adUnitCode&gt;253312516&lt;/adUnitCode&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
						&lt;isAspectRatio&gt;false&lt;/isAspectRatio&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
					&lt;fullDisplayString&gt;300x250&lt;/fullDisplayString&gt;
				&lt;/adUnitSizes&gt;
				&lt;mobilePlatform&gt;SITE&lt;/mobilePlatform&gt;
				&lt;explicitlyTargeted&gt;false&lt;/explicitlyTargeted&gt;
				&lt;inheritedAdSenseSettings&gt;
					&lt;value&gt;
						&lt;adSenseEnabled&gt;true&lt;/adSenseEnabled&gt;
						&lt;borderColor&gt;FFFFFF&lt;/borderColor&gt;
						&lt;titleColor&gt;0000FF&lt;/titleColor&gt;
						&lt;backgroundColor&gt;FFFFFF&lt;/backgroundColor&gt;
						&lt;textColor&gt;000000&lt;/textColor&gt;
						&lt;urlColor&gt;008000&lt;/urlColor&gt;
						&lt;adType&gt;TEXT_AND_IMAGE&lt;/adType&gt;
						&lt;borderStyle&gt;DEFAULT&lt;/borderStyle&gt;
						&lt;fontFamily&gt;DEFAULT&lt;/fontFamily&gt;
						&lt;fontSize&gt;DEFAULT&lt;/fontSize&gt;
					&lt;/value&gt;
				&lt;/inheritedAdSenseSettings&gt;
				&lt;lastModifiedDateTime&gt;
					&lt;date&gt;
						&lt;year&gt;2017&lt;/year&gt;
						&lt;month&gt;2&lt;/month&gt;
						&lt;day&gt;27&lt;/day&gt;
					&lt;/date&gt;
					&lt;hour&gt;7&lt;/hour&gt;
					&lt;minute&gt;23&lt;/minute&gt;
					&lt;second&gt;32&lt;/second&gt;
					&lt;timeZoneID&gt;PST8PDT&lt;/timeZoneID&gt;
				&lt;/lastModifiedDateTime&gt;
				&lt;smartSizeMode&gt;NONE&lt;/smartSizeMode&gt;
				&lt;isSharedByDistributor&gt;false&lt;/isSharedByDistributor&gt;
				&lt;isSetTopBoxEnabled&gt;false&lt;/isSetTopBoxEnabled&gt;
			&lt;/rval&gt;
				&lt;id&gt;252312876&lt;/id&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;hasChildren&gt;false&lt;/hasChildren&gt;
				&lt;parentPath&gt;
					&lt;id&gt;237897516&lt;/id&gt;
					&lt;name&gt;ca-pub-2799179143725683&lt;/name&gt;
					&lt;adUnitCode&gt;ca-pub-2799179143725683&lt;/adUnitCode&gt;
				&lt;/parentPath&gt;
				&lt;name&gt;Ad_Unit_4&lt;/name&gt;
				&lt;description&gt;Ad unit description.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;status&gt;ACTIVE&lt;/status&gt;
				&lt;adUnitCode&gt;253312876&lt;/adUnitCode&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
						&lt;isAspectRatio&gt;false&lt;/isAspectRatio&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
					&lt;fullDisplayString&gt;300x250&lt;/fullDisplayString&gt;
				&lt;/adUnitSizes&gt;
				&lt;mobilePlatform&gt;SITE&lt;/mobilePlatform&gt;
				&lt;explicitlyTargeted&gt;false&lt;/explicitlyTargeted&gt;
				&lt;inheritedAdSenseSettings&gt;
					&lt;value&gt;
						&lt;adSenseEnabled&gt;true&lt;/adSenseEnabled&gt;
						&lt;borderColor&gt;FFFFFF&lt;/borderColor&gt;
						&lt;titleColor&gt;0000FF&lt;/titleColor&gt;
						&lt;backgroundColor&gt;FFFFFF&lt;/backgroundColor&gt;
						&lt;textColor&gt;000000&lt;/textColor&gt;
						&lt;urlColor&gt;008000&lt;/urlColor&gt;
						&lt;adType&gt;TEXT_AND_IMAGE&lt;/adType&gt;
						&lt;borderStyle&gt;DEFAULT&lt;/borderStyle&gt;
						&lt;fontFamily&gt;DEFAULT&lt;/fontFamily&gt;
						&lt;fontSize&gt;DEFAULT&lt;/fontSize&gt;
					&lt;/value&gt;
				&lt;/inheritedAdSenseSettings&gt;
				&lt;lastModifiedDateTime&gt;
					&lt;date&gt;
						&lt;year&gt;2017&lt;/year&gt;
						&lt;month&gt;2&lt;/month&gt;
						&lt;day&gt;27&lt;/day&gt;
					&lt;/date&gt;
					&lt;hour&gt;7&lt;/hour&gt;
					&lt;minute&gt;23&lt;/minute&gt;
					&lt;second&gt;32&lt;/second&gt;
					&lt;timeZoneID&gt;PST8PDT&lt;/timeZoneID&gt;
				&lt;/lastModifiedDateTime&gt;
				&lt;smartSizeMode&gt;NONE&lt;/smartSizeMode&gt;
				&lt;isSharedByDistributor&gt;false&lt;/isSharedByDistributor&gt;
				&lt;isSetTopBoxEnabled&gt;false&lt;/isSetTopBoxEnabled&gt;
			&lt;/rval&gt;
		&lt;/createAdUnitsResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<h2>Loading Google DoubleClick data into SQL Server Table</h2>
<p>So far we saw how to make simple DFP API calls without doing any parsing. Now lets look at how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a> which not only make API calls but it will parse XML Response into rows and columns which can be loaded into target database such as SQL Server, Oracle, MySQL or even Flat File. XML Source also supports pagination so if you have many records it will automatically loop through all response untill all records are fetched.</p>
<h3>Step-By-Step &#8211; Using XML Source to read Google DFP data (Parse into rows and columns)</h3>
<ol>
<li>Assuming you have tested your first DFP API Call (Explianed in the beginning of this article). You must have OAuth connection tested for API call.</li>
<li>Drag new Data flow task from SSIS Toolbox</li>
<li>Inside Data flow designer drag and drop <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZS XML Source</a> from toolbox</li>
<li>Double click XML Source to configure.</li>
<li>Set URL as below<br />
https://ads.google.com/apis/ads/publisher/v201702/InventoryService</li>
<li>Check Use credentials option and from Drop down select OAuth connection manager (created in previous section)</li>
<li>Select Method = POST,</li>
<li>Select Request Content Type = XML (text/xml)</li>
<li>Enter Body as below (Click edit button).<br />
<pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader&gt;
         &lt;v20:networkCode&gt;238897396&lt;/v20:networkCode&gt;
         &lt;v20:applicationName&gt;ZappySysApp&lt;/v20:applicationName&gt;
      &lt;/v20:RequestHeader&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:getAdUnitsByStatement&gt;
         &lt;v20:filterStatement&gt;
            &lt;v20:query&gt;WHERE Status='ACTIVE'&lt;/v20:query&gt;
         &lt;/v20:filterStatement&gt;
      &lt;/v20:getAdUnitsByStatement&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre>
Notice that in above we calling <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService#getAdUnitsByStatement" target="_blank" rel="noopener">getAdUnitsByStatement </a>API to fetch all Ad Units which are Active. Here is<a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService.Statement" target="_blank" rel="noopener"> more information about Query Syntax</a> for any API call getXXXXXXByStaement</li>
<li>Now click on <strong>Select Filter</strong> button and select results node and click OK. If prompted add array to list.
<div id="attachment_1054" style="width: 965px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-api-set-filter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1054" class="size-full wp-image-1054" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-api-set-filter.png" alt="SSIS XML Source - Get data from Google DFP API using OAuth (Configure URL, Body and Filter)" width="955" height="750" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-api-set-filter.png 955w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-api-set-filter-300x236.png 300w" sizes="(max-width: 955px) 100vw, 955px" /></a><p id="caption-attachment-1054" class="wp-caption-text">SSIS XML Source &#8211; Get data from Google DFP API using OAuth (Configure URL, Body and Filter)</p></div></li>
<li>Click Preview to see data. Click Columns tab to review data types (Auto detected). If you wish to change length or datatype then edit there and check Lock option (Last column)
<div id="attachment_1055" style="width: 669px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-preview-google-dfp-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1055" class="size-full wp-image-1055" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-preview-google-dfp-data.png" alt="SSIS XML Source - Preview Response for Google DoubleClick API Call - Parse into Rows/Columns" width="659" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-preview-google-dfp-data.png 659w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-preview-google-dfp-data-300x124.png 300w" sizes="(max-width: 659px) 100vw, 659px" /></a><p id="caption-attachment-1055" class="wp-caption-text">SSIS XML Source &#8211; Preview Response for Google DoubleClick API Call &#8211; Parse into Rows/Columns</p></div></li>
<li>Click OK to save UI</li>
<li>Connect XML Source to same target (e.g. OLEDB Destination &#8211; SQL Server Connection)</li>
<li>Run data flow
<div id="attachment_1056" style="width: 602px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-load-into-sql-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1056" class="size-full wp-image-1056" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-load-into-sql-server.png" alt="SSIS Execution - Read from Google DFP and load into SQL Server Table" width="592" height="358" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-load-into-sql-server.png 592w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-load-into-sql-server-300x181.png 300w" sizes="(max-width: 592px) 100vw, 592px" /></a><p id="caption-attachment-1056" class="wp-caption-text">SSIS Execution &#8211; Read from Google DFP and load into SQL Server Table</p></div></li>
</ol>
<h3>Configure Pagination for Google DFP API / PQL Query result</h3>
<p>If you have large dataset to read from DoubleClick API ( when calling API such as <strong>getxxxxxxByStatement</strong>) then we recommend to supply LIMIT and OFFSET clause in your <a href="https://developers.google.com/doubleclick-publishers/docs/pqlreference" target="_blank" rel="noopener">PQL query</a>.</p>
<p>For example if you have 2000 ad units and you want to limit response size by maximum 300 rows then your query can be like below</p><pre class="crayon-plain-tag">--For first request (returns results 1-300)
WHERE Status='ACTIVE' LIMIT 300 OFFSET 0

--For second request (returns results 301-600)
WHERE Status='ACTIVE' LIMIT 300 OFFSET 300

--For third request  (returns results 601-900)
WHERE Status='ACTIVE' LIMIT 300 OFFSET 600

........</pre><p>
This looping logic can be complex to implement if you do manually. But no worry if you are using <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a>. It comes with many pagination options (<a href="//zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">Click here to read more about pagination</a>)</p>
<p>See below screenshot how to configure Pagination options for Google DoubleClick API. Basically two places you have to change. Inside body you have to set placeholder and change few settings on Pagination Tab.</p>
<div id="attachment_1052" style="width: 726px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-paginate-large-resultset-google-dfp-api-doubleclick-pql-query-paging.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1052" class="size-full wp-image-1052" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-paginate-large-resultset-google-dfp-api-doubleclick-pql-query-paging.png" alt="SSIS XML Source - Configure Pagination for Google DoubleClick API data fetch - PQL LIMIT and OFFSET clause for Google DFP API" width="716" height="608" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-paginate-large-resultset-google-dfp-api-doubleclick-pql-query-paging.png 716w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-paginate-large-resultset-google-dfp-api-doubleclick-pql-query-paging-300x255.png 300w" sizes="(max-width: 716px) 100vw, 716px" /></a><p id="caption-attachment-1052" class="wp-caption-text">SSIS XML Source &#8211; Configure Pagination for Google DoubleClick API data fetch &#8211; PQL LIMIT and OFFSET clause for Google DFP API</p></div>
<div id="attachment_1053" style="width: 715px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-configure-pagination-using-post-data-method-call-google-dfp-api-doubleclick.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1053" class="size-full wp-image-1053" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-configure-pagination-using-post-data-method-call-google-dfp-api-doubleclick.png" alt="SSIS XML Source - Configure Pagination for Google DoubleClick API data fetch - Set Pagination Mode" width="705" height="510" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-configure-pagination-using-post-data-method-call-google-dfp-api-doubleclick.png 705w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-configure-pagination-using-post-data-method-call-google-dfp-api-doubleclick-300x217.png 300w" sizes="(max-width: 705px) 100vw, 705px" /></a><p id="caption-attachment-1053" class="wp-caption-text">SSIS XML Source &#8211; Configure Pagination for Google DoubleClick API data fetch &#8211; Set Pagination Mode</p></div>
<h2>Create CSV Report File and Download in GZip format (*.gz)</h2>
<p>Sometime you have to download large amount of data (Possibly millions of rows) in that case Bulk approach would be better. <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService" target="_blank" rel="noopener">DFP ReportService API</a> allows to call following APIs which can be used to produce CSV report file in *.gz format and then you can download it using REST API Task.</p>
<p>Below are high level steps you have to perform to produce report file and download it.</p>
<ul>
<li>Create the ReportJob by invoking <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.html#runReportJob">runReportJob</a> command .</li>
<li>Poll the ReportJob object using <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.html#getReportJob">ReportService.getReportJob</a> (This is required because file is not available right away) .</li>
<li>Continue to poll the ReportJob object until the <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.ReportJob.html#reportJobStatus">reportJobStatus</a> field is equal to <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.ReportJobStatus.html#COMPLETED">COMPLETED</a> or <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.ReportJobStatus.html#FAILED">FAILED</a>.</li>
<li>If successful, fetch the URL for downloading the report by invoking <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.html#getReportDownloadURL">getReportDownloadURL</a>.</li>
</ul>
<p>Here is the sample SSIS Package to Perform this Action.</p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/02/Google-DoubleClick-API-SSIS-DEMO.zip" target="_blank" rel="noopener">Click here to DFP API download Sample for SSIS</a> SSIS Package (SSIS 2012, 2014, 2016)</p>
<p>See below screenshot how to generate Google DFP Report File and download / extract (Unzip) using Drag and Drop SSIS workflow.</p>
<div id="attachment_1179" style="width: 837px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-doubleclick-soap-create-report-download-file-csv-gzip-format.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1179" class="size-full wp-image-1179" src="//zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-doubleclick-soap-create-report-download-file-csv-gzip-format.png" alt="Create Google DFP Report File (CSV / Gzip) and Download Using SSIS (Example of ReportService functions runReportJob, getReportJob and .getReportDownloadURL)" width="827" height="739" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-doubleclick-soap-create-report-download-file-csv-gzip-format.png 827w, https://zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-doubleclick-soap-create-report-download-file-csv-gzip-format-300x268.png 300w" sizes="(max-width: 827px) 100vw, 827px" /></a><p id="caption-attachment-1179" class="wp-caption-text">Create Google DFP Report File (CSV / Gzip) and Download Using SSIS (Example of ReportService functions runReportJob, getReportJob and .getReportDownloadURL)</p></div>
<h3>Call runReportJob (Start DFP Report JOB)</h3>
<p>Very first step to produce DFP Report file is call <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.html#runReportJob">ReportService &gt;&gt; runReportJob</a> API. See below Command.</p>
<p><strong>Extract Single XML Node Value from SOAP API Response using XPATH</strong></p>
<p>Once you get response you can extract id of your JOB using XPAth Expression (See REST API Task response settings tab. Change Format to XML and type following XPATH expression. This will look for &lt;id&gt;111111&lt;/id&gt; node anywhere in SOAP response XML and extract value (i.e. 111111 )  .. For screenshot see next section</p><pre class="crayon-plain-tag">//*[local-name() = 'id']</pre><p>
<strong>Request</strong></p><pre class="crayon-plain-tag">POST https://ads.google.com/apis/ads/publisher/v201702/ReportService HTTP/1.1
Authorization: Bearer ya29.xxxxxxxxxxxxxxxxxxxxxAKqG89gM-TpReRXO
User-Agent: ZappySysApp/1.0.2017.10531
Content-Type: text/xml
Accept: */*
Cache-Control: no-cache
Host: ads.google.com
Content-Length: 1018
Expect: 100-continue
Accept-Encoding: gzip, deflate

&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
	&lt;soapenv:Header&gt;
		&lt;v20:RequestHeader&gt;
			&lt;v20:networkCode&gt;238897396&lt;/v20:networkCode&gt;
			&lt;v20:applicationName&gt;ZappySysApp&lt;/v20:applicationName&gt;
		&lt;/v20:RequestHeader&gt;
	&lt;/soapenv:Header&gt;
	&lt;soapenv:Body&gt;
		&lt;v20:runReportJob&gt;
			&lt;v20:reportJob&gt;
				&lt;v20:reportQuery&gt;
					&lt;v20:dimensions&gt;DATE&lt;/v20:dimensions&gt;
					&lt;v20:dimensions&gt;LINE_ITEM_ID&lt;/v20:dimensions&gt;
					&lt;v20:dimensions&gt;LINE_ITEM_NAME&lt;/v20:dimensions&gt;
					&lt;v20:dimensions&gt;AD_UNIT_NAME&lt;/v20:dimensions&gt;
					&lt;v20:columns&gt;AD_SERVER_IMPRESSIONS&lt;/v20:columns&gt;
					&lt;v20:columns&gt;AD_SERVER_CLICKS&lt;/v20:columns&gt;
					&lt;v20:dimensionAttributes&gt;LINE_ITEM_COST_TYPE&lt;/v20:dimensionAttributes&gt;
					&lt;v20:dimensionAttributes&gt;LINE_ITEM_GOAL_QUANTITY&lt;/v20:dimensionAttributes&gt;
					&lt;v20:dateRangeType&gt;LAST_MONTH&lt;/v20:dateRangeType&gt;
				&lt;/v20:reportQuery&gt;
			&lt;/v20:reportJob&gt;
		&lt;/v20:runReportJob&gt;
	&lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Fri, 02 Jun 2017 21:23:41 GMT
Expires: Fri, 02 Jun 2017 21:23:41 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Content-Length: 999

&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;f03e7e474fde2a5f9c5d7c9d7eb83923&lt;/requestId&gt;
			&lt;responseTime&gt;846&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;runReportJobResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;
				&lt;id&gt;10000297829&lt;/id&gt;
				&lt;reportQuery&gt;
					&lt;dimensions&gt;DATE&lt;/dimensions&gt;
					&lt;dimensions&gt;LINE_ITEM_ID&lt;/dimensions&gt;
					&lt;dimensions&gt;LINE_ITEM_NAME&lt;/dimensions&gt;
					&lt;dimensions&gt;AD_UNIT_NAME&lt;/dimensions&gt;
					&lt;adUnitView&gt;TOP_LEVEL&lt;/adUnitView&gt;
					&lt;columns&gt;AD_SERVER_IMPRESSIONS&lt;/columns&gt;
					&lt;columns&gt;AD_SERVER_CLICKS&lt;/columns&gt;
					&lt;dimensionAttributes&gt;LINE_ITEM_COST_TYPE&lt;/dimensionAttributes&gt;
					&lt;dimensionAttributes&gt;LINE_ITEM_GOAL_QUANTITY&lt;/dimensionAttributes&gt;
					&lt;dateRangeType&gt;LAST_MONTH&lt;/dateRangeType&gt;
					&lt;useSalesLocalTimeZone&gt;false&lt;/useSalesLocalTimeZone&gt;
					&lt;includeZeroSalesRows&gt;false&lt;/includeZeroSalesRows&gt;
				&lt;/reportQuery&gt;
			&lt;/rval&gt;
		&lt;/runReportJobResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<h3>Call getReportJob (Poll JOB Status)</h3>
<p>Second step is to make sure is Report Status check. For large report it make take several seconds or minutes before you can get Download URL (See Next Step). If you try to call Next step before Report is ready then you may get error. So better to add Polling logic.</p>
<p><strong>Extract Single XML Node Value from SOAP API Response using XPATH</strong></p>
<p>&nbsp;</p>
<p>Once you get response you can extract status of your JOB using XPAth Expression (See REST API Task response settings tab. Change Format to XML and type following XPATH expression. This will look for &lt;rval&gt;IN_PROGRESS&lt;/rval&gt; node anywhere in SOAP response XML and extract value (i.e. IN_PROGRESS )</p><pre class="crayon-plain-tag">//*[local-name() = 'rval']</pre><p>
<div id="attachment_1182" style="width: 719px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-xml-response-extract-node-value-xpath-soap-body.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1182" class="size-full wp-image-1182" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-xml-response-extract-node-value-xpath-soap-body.png" alt="Extract Single XML Node Value from SOAP API Response - Use XPATH in SSIS" width="709" height="417" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-xml-response-extract-node-value-xpath-soap-body.png 709w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-xml-response-extract-node-value-xpath-soap-body-300x176.png 300w" sizes="(max-width: 709px) 100vw, 709px" /></a><p id="caption-attachment-1182" class="wp-caption-text">Extract Single XML Node Value from SOAP API Response &#8211; Use XPATH in SSIS</p></div>
<p><strong>Request</strong></p><pre class="crayon-plain-tag">POST https://ads.google.com/apis/ads/publisher/v201702/ReportService HTTP/1.1
Authorization: Bearer ya29.xxxxxxxxxxxxxxxxxxXmWqmq
User-Agent: ZappySysApp/1.0.2017.10531
Content-Type: text/xml
Accept: */*
Cache-Control: no-cache
Host: ads.google.com
Content-Length: 524
Expect: 100-continue
Accept-Encoding: gzip, deflate

&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader&gt;
         &lt;v20:networkCode&gt;238897396&lt;/v20:networkCode&gt;
         &lt;v20:applicationName&gt;ZappySysApp&lt;/v20:applicationName&gt;
      &lt;/v20:RequestHeader&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:getReportJobStatus&gt;
       &lt;v20:reportJobId&gt;10000297829&lt;/v20:reportJobId&gt;
      &lt;/v20:getReportJobStatus&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Fri, 02 Jun 2017 21:23:47 GMT
Expires: Fri, 02 Jun 2017 21:23:47 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Content-Length: 451

&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;d52cb3a3d68af24aec2f9b0284379700&lt;/requestId&gt;
			&lt;responseTime&gt;803&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getReportJobStatusResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;COMPLETED&lt;/rval&gt;
		&lt;/getReportJobStatusResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
&nbsp;</p>
<h3>Call getReportDownloadURL (Get Download URL)</h3>
<p>Once you get status = COMPLETED in above API Call (i.e.  getReportJobStatus) then you ready to call getReportDownloadURL  to fetch URL which you can download.</p>
<p>Here is the API sample Request and Response</p>
<p><strong>Request</strong></p><pre class="crayon-plain-tag">POST https://ads.google.com/apis/ads/publisher/v201702/ReportService HTTP/1.1
Authorization: Bearer ya29.xxxxxxxxxxxxxxxxxxBp84ltTNyVRb9hlUEWx
User-Agent: ZappySysApp/1.0.2017.10531
Content-Type: text/xml
Accept: */*
Cache-Control: no-cache
Host: ads.google.com
Content-Length: 581
Expect: 100-continue
Accept-Encoding: gzip, deflate

&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader&gt;
         &lt;v20:networkCode&gt;238897396&lt;/v20:networkCode&gt;
         &lt;v20:applicationName&gt;ZappySysApp&lt;/v20:applicationName&gt;
      &lt;/v20:RequestHeader&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:getReportDownloadURL&gt;
       &lt;v20:reportJobId&gt;10000297829&lt;/v20:reportJobId&gt;
       &lt;v20:exportFormat&gt;CSV_DUMP&lt;/v20:exportFormat&gt;
      &lt;/v20:getReportDownloadURL&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre><p>
&nbsp;</p>
<p><strong>Response</strong></p><pre class="crayon-plain-tag">HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Fri, 02 Jun 2017 21:23:49 GMT
Expires: Fri, 02 Jun 2017 21:23:49 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Content-Length: 1039

&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;8e5ac0bbeb8e88c180ea442fc5378d99&lt;/requestId&gt;
			&lt;responseTime&gt;1957&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getReportDownloadURLResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;https://storage.googleapis.com/dfp-report-export/caxxxxxxxx-xxxxxxxxxxxxxxb?GoogleAccessId=3769xxxxxxxxxxx-qxxxxxxxxxxxxxxxxsqdb5dvi8g@developer.gserviceaccount.com&amp;amp;Expires=1496438929&amp;amp;Signature=vnhCiAIqd%2BFgWCtAHo9roFOI3W%2BveUTYuSvyBQ9gtMI2HDTXOCVDh7wzUV%2BPBJZZghaL6k8wKYq33GA4NpjZVNYuaAgPLWgGwAUPdtioHRi%2Bt3Eymp%2FAPRGIoos0ekP3O7l%2FPNPxenC6UTP087HV3j06V%2Fuui9ixpKZWGCK8r56oUPj6S8q1hG95Ns3d3sEcuz3%2BkShu6GYG5mqir5vjtZPuzwsr%2F96G5Kk123mke%2B%2FIVRJGoqnCMghNWtIG1yR1IdZx%2FIpit%2FnaJ9HP6IvAr3oMIXkQ3cHv%2FtOhXGy9dTG34q%2FKDbtkSJAayHgjlSLPGKucygcXBhUrbywBu8Y77A%3D%3D&lt;/rval&gt;
		&lt;/getReportDownloadURLResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<strong>Extract Single XML Node Value from SOAP API Response using XPATH</strong></p>
<p>Once you get response you can extract status of your JOB using XPAth Expression (See REST API Task response settings tab. Change Format to XML and type following XPATH expression. This will look for &lt;rval&gt;https://storage.googleapis.com/dfp-report-export/caxx&#8230;&#8230;&#8230;.&lt;/rval&gt; node anywhere in SOAP response XML and extract value (i.e. URL)</p>
<h3>Download File Using REST API Task</h3>
<p>Once you get URL its time to download it. You can use REST API Task to download the file. On Response Setting Tab specify full file path (e.g. c:\report_csv.gz) and make sure Binary option is checked (Found next to the Save Path)</p>
<h2>Making things dynamic</h2>
<p>If you want to supply certain parameters at runtime (e.g. from SSIS Variable) rather than hard code then you can use Variable Placeholders any where in Request Body, URL or Headers. Click Insert Variable option found in Edit screen</p>
<p>Here is an example of dynamic URL (API Version stored in SSIS Variable)</p><pre class="crayon-plain-tag">https://ads.google.com/apis/ads/publisher/{{User::ApiVer}}/NetworkService</pre><p>
<h2>Deployment to Production</h2>
<p>When you ready to deploy your SSIS Package to production make sure to change Test NetworkCode supplied inside Request Body to your Production Ad Network. Also Set RefreshToken Property of OAuth Connection Manager (Get it from Backup file saved when you created OAuth connection first time). Once you set RefreshToken of connection manager you won&#8217;t have to Login again to get a new token.</p>
<h2>Conclusion</h2>
<p>Traditionally if you wanted to integrate Google DFP API (DoubleClick API) calls inside your ETL workflow then it required some sort of coding effort (e.g. Use C# SDK, JAVA SDK or Python SDK). Coding effort is not only time consuming and expensive but also hard to maintain for any non-coder (e.g. ETL Developer or DBA).<br />
Thanks to <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> which changed the way developers do API integration. Now you can reduce time to implement and total cost of you API integration project significantly by using drag and drop approach. This approach is not only easy to maintain but also fast and high quality. You can use ZappySys REST/SOAP SSIS Connectors and SSIS Tasks for any API integration project such as Google DFP API. <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Try SSIS PowerPack</a> for free to explore possibilities. If you have any issue with your integration <a href="//zappysys.com/support/">Contact Support</a></p>
<p>The post <a href="https://zappysys.com/blog/calling-google-dfp-api-with-ssis-doubleclick-soap-api/">How to call Google DFP API with SSIS &#8211; DoubleClick</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>
		<item>
		<title>How to call Elasticsearch API using SSIS</title>
		<link>https://zappysys.com/blog/call-elasticsearch-api-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 17 Jan 2017 00:22:47 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Parser Transform]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[elasticsearch]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=943</guid>

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

					<description><![CDATA[<p>Introduction In this post you will learn how to use FREE SSIS Regex Parser Task along with REST API Task to extract HTML content in few clicks. Scenario Assume that you want to search certain keywords from Bing or google and want to know how many pages found for that keyword. Url for search would [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/using-ssis-regex-parser-task-extracting-html-content/">Using SSIS Regex Parser Task for Extracting HTML Content</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis-regex-parser-task.png"><img loading="lazy" decoding="async" class="size-full wp-image-2974 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis-regex-parser-task.png" alt="" width="100" height="100" /></a>In this post you will learn how to use FREE <a href="//zappysys.com/products/ssis-powerpack/ssis-regex-parser-task/" target="_blank" rel="noopener">SSIS Regex Parser Task</a> along with <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> to extract HTML content in few clicks.</p>
<p>Scenario</p>
<p>Assume that you want to search certain keywords from Bing or google and want to know how many pages found for that keyword. Url for search would be something like http://www.bing.com/search?q=regex where regex is our search word.</p>
<p>When page is returned view source code of that page and you will find tag like below.</p><pre class="crayon-plain-tag">&lt;span class="sb_count" data-bm="4"&gt;21,00,000 results&lt;/span&gt;</pre><p>
What we want is number 21,00,000 using Regular expression pattern search.</p>
<h2>Step-By-Step : Extract HTML Tag value using Regex Expression</h2>
<ol>
<li>Download and Install <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> (It includes FREE <a href="//zappysys.com/products/ssis-powerpack/ssis-regex-parser-task/" target="_blank" rel="noopener">SSIS Regex Parser Task</a> )</li>
<li>Create new SSIS Package</li>
<li>Drag ZS REST API Task on Control flow designer from SSIS Toolbox</li>
<li>Double click to configure the task. Enter URL you like to fetch e.g. http://www.bing.com/search?q=regex</li>
<li>Click on Response Tab and check Save response option. Select Save to Variable. If needed create new variable.</li>
<li>Click Test (Scroll at the bottom to see html content)</li>
<li>Now drag ZS Regex Parser Task and connect with REST API Task</li>
<li>Select Variable which will hold HTML text you like to parse.</li>
<li>Enter following expression and map target to some Variable if you like to save extracted value. Below expression ends with {{0,1}} which means extract first match and 2nd group of that match (0 based Index). 2nd group of match will hold actual count of search result. If you omit {{x,y}} at the end then {{0,0}} is used.<br />
<pre class="crayon-plain-tag">\&lt;span\s*\w*\s*class="sb_count"\s*&gt;\s*(?&lt;p2&gt;[0-9,.]*){{0,1}}</pre>
See below screenshot</p>
<div id="attachment_920" style="width: 710px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/12/ssis-regex-expression-extract-html-tag-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-920" class="wp-image-920" src="//zappysys.com/blog/wp-content/uploads/2016/12/ssis-regex-expression-extract-html-tag-value.png" alt="SSIS Regex Parser Task - Extract HTML Tag Value using Regular Expression" width="700" height="461" srcset="https://zappysys.com/blog/wp-content/uploads/2016/12/ssis-regex-expression-extract-html-tag-value.png 881w, https://zappysys.com/blog/wp-content/uploads/2016/12/ssis-regex-expression-extract-html-tag-value-300x198.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-920" class="wp-caption-text">SSIS Regex Parser Task &#8211; Extract HTML Tag Value using Regular Expression</p></div></li>
<li>In the above step you can select Variable as Input or use placeholder in Direct string (e.g  {{Use::varHtml}} )</li>
<li> You can also connect ZS Logging task to show extracted value</li>
</ol>
<p>Here is final flow.</p>
<div id="attachment_921" style="width: 700px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/12/ssis-regex-parse-example-download-page-extract-html-tag-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-921" class="size-full wp-image-921" src="//zappysys.com/blog/wp-content/uploads/2016/12/ssis-regex-parse-example-download-page-extract-html-tag-value.png" alt="SSIS Regular expression parsing example" width="690" height="406" srcset="https://zappysys.com/blog/wp-content/uploads/2016/12/ssis-regex-parse-example-download-page-extract-html-tag-value.png 690w, https://zappysys.com/blog/wp-content/uploads/2016/12/ssis-regex-parse-example-download-page-extract-html-tag-value-300x177.png 300w" sizes="(max-width: 690px) 100vw, 690px" /></a><p id="caption-attachment-921" class="wp-caption-text">SSIS Regular expression parsing example</p></div>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/using-ssis-regex-parser-task-extracting-html-content/">Using SSIS Regex Parser Task for Extracting HTML Content</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Convert CURL to SSIS PowerPack / ODBC for API Call</title>
		<link>https://zappysys.com/blog/using-ssis-curl-syntax-to-ssis-api-task/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 10 Nov 2016 19:35:43 +0000</pubDate>
				<category><![CDATA[SSIS Tips & How-Tos]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[postman]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<category><![CDATA[ssis xml source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=884</guid>

					<description><![CDATA[<p>Introduction Often, REST API documentation uses example syntax for the curl command-line tool because it&#8217;s one of the most popular tools for making API calls. However, suppose you are an SSIS developer using ZappySys API Drivers/Connectors from either the SSIS PowerPack or the ODBC PowerPack. In that case, this blog post will help you translate the curl command [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/using-ssis-curl-syntax-to-ssis-api-task/">Convert CURL to SSIS PowerPack / ODBC for API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-tip.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1897" src="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-tip.png" alt="" width="90" height="90" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-tip.png 180w, https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-tip-150x150.png 150w" sizes="(max-width: 90px) 100vw, 90px" /></a><span style="box-sizing: border-box; margin: 0px; padding: 0px;">Often, REST API documentation uses example syntax for <a href="https://curl.haxx.se/" target="_blank" rel="noopener"><strong>the curl</strong></a><a href="https://curl.haxx.se/" target="_blank" rel="noopener"> command-line tool</a> because it&#8217;s one of the most popular tools for making API calls.</span> <span style="box-sizing: border-box; margin: 0px; padding: 0px;"><span style="box-sizing: border-box; margin: 0px; padding: 0px;"><span style="box-sizing: border-box; margin: 0px; padding: 0px;">However, suppose you are an SSIS developer using <strong>ZappySys API Drivers</strong>/Connectors from either the SSIS PowerPack or the ODBC PowerPack.</span> In that case,</span> this blog post will help you translate the <strong>curl command line</strong> syntax to similar options available in the ZappySys Product.</span> For SSIS PowerPack products, you can refer to Connectors/Tasks such as <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZappySys REST API Task</a> / <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source Connector</a> / <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">XML Source</a>. To make this article short and simple, we will show many screenshots from SSIS PowerPack UI, but the concepts are the same when you use other products, such as ODBC PowerPack <a href="https://zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/" target="_blank" rel="noopener">JSON Driver / REST</a>  or <a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">XML Driver</a>.</p>
<p>&nbsp;</p>
<p>If you are using <a href="https://www.getpostman.com/downloads/" target="_blank" rel="noopener"><strong>Postman</strong></a> to call the API, then <a href="https://zappysys.com/blog/postman-to-ssis-odbc-powerpack/" target="_blank" rel="noopener">refer to this article</a></p>
<p>If you are using <a href="https://www.telerik.com/fiddler" target="_blank" rel="noopener"><strong>Fiddler</strong></a> to call an API, then <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">refer to this article</a></p>
<h2></h2>
<h2>CheatSheet &#8211; Curl to SSIS PowerPack / ODBC PowerPack</h2>
<p>Before we dig down more. Let&#8217;s look at how each command-line <a href="https://curl.haxx.se/docs/manpage.html" target="_blank" rel="noopener">parameter from CURL</a> maps to SSIS PowerPack settings.</p>
<div class="su-table su-table-alternate">
<table>
<colgroup>
<col width="320" />
<col />
<col /> </colgroup>
<tbody>
<tr>
<th>CURL Parameter (Short / Long)</th>
<th>Purpose</th>
<th>SSIS PowerPack Setting</th>
</tr>
<tr>
<td><em>method</em></td>
<td>Pass HTTP method (e.g., GET, POST, PUT, DELETE)</td>
<td>Select <strong>Method</strong> from Request Method Dropdown on  <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZappySys REST API Task</a> or <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source Connector</a>, or <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">XML Source</a>, <a href="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2015/11/ssis-http-post-data-to-api-url-restful-json-web-request.png?w=774&amp;ssl=1" target="_blank" rel="noopener">like this</a></td>
</tr>
<tr>
<td><strong>-u</strong> <em>userid:password, </em><a href="https://curl.haxx.se/docs/manpage.html#-u" target="_blank" rel="noopener"><strong>&#8211;user</strong></a> <em>userid:password </em></td>
<td>Authenticate using Basic Authentication using UserID and Password</td>
<td><span style="margin: 0px;padding: 0px">Use the HTTP Connection Manager to enable Basic Auth,<a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/" target="_blank" rel="noopener"> the</a>n supply the username and password.</span></td>
</tr>
<tr>
<td><strong>-H</strong> <em>&#8220;name: value&#8221;, </em><a href="https://curl.haxx.se/docs/manpage.html#-H" target="_blank" rel="noopener"><strong>&#8211;header</strong></a> <em>&#8220;name: value&#8221; </em></td>
<td>Supply HTTP Header(s)</td>
<td>Click on the Raw Edit option or enter key-value pairs of HTTP headers in the Headers grid  <a href="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2015/11/ssis-http-post-data-to-api-url-restful-json-web-request.png?w=774&amp;ssl=1" target="_blank" rel="noopener">like this</a></td>
</tr>
<tr>
<td><strong>-d</strong> <em>&#8220;key=value&#8221;,  </em><a href="https://curl.haxx.se/docs/manpage.html#-d" target="_blank" rel="noopener"><strong>&#8211;data</strong></a> <em>&#8220;key=value&#8221;<br />
</em></td>
<td>Supply BODY parameters using www-form-urlencoded Content Type</td>
<td>Click Edit next to the Request Data text box and supply Body. If you need to pass content in JSON / XML, then select the Request ContentType dropdown <a href="https://i0.wp.com/zappysys.com/blog/wp-content/uploads/2015/11/ssis-http-post-data-to-api-url-restful-json-web-request.png?w=774&amp;ssl=1" target="_blank" rel="noopener">like this</a></td>
</tr>
<tr>
<td><strong>-d</strong> <em>&#8220;some data&#8221;,</em> <em> </em><a href="https://curl.haxx.se/docs/manpage.html#-d" target="_blank" rel="noopener"><strong>&#8211;data</strong></a> <em>&#8220;some data&#8221;<br />
</em><strong>-d</strong> <em>@filepath,</em> <em> </em><a href="https://curl.haxx.se/docs/manpage.html#-d" target="_blank" rel="noopener"><strong>&#8211;data</strong></a> <em>@filepath<br />
</em></td>
<td>Supply BODY parameters using Content-Type other than www-form-urlencoded. You can also supply content from a file.</td>
<td>Click Edit next to the Request Data text box and supply Body. If you need to pass content in JSON / XML, select the Request ContentType dropdown as shown. To upload content stored from a local file, <a href="https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/" target="_blank" rel="noopener">use this option</a>.</td>
</tr>
<tr>
<td><strong>-F</strong> <em>key=value</em>, <a href="https://curl.haxx.se/docs/manpage.html#-f" target="_blank" rel="noopener"><strong>&#8211;form</strong></a> key=value</td>
<td>Supply Content-Type multipart/form-data according to <a href="http://www.ietf.org/rfc/rfc2388.txt">RFC 2388</a></td>
<td>Enable the Multipart option for Request on the ZappySys UI, <a href="https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/#Method2_8211_Upload_files_using_Multi-Part_Form_Data_mode_Mixed_content_multiple_files" target="_blank" rel="noopener">like this</a></td>
</tr>
<tr>
<td><strong>-k</strong>, <a href="https://curl.haxx.se/docs/manpage.html#-k" target="_blank" rel="noopener"><strong>&#8211;insecure</strong></a></td>
<td>Ignore SSL Certificate-related errors (e.g., allow expired certificate or untrusted certificate)</td>
<td><span style="margin: 0px;padding: 0px">Go to the Advanced Tab and check the &#8221; ignore SSL Related Errors option <a href="https://zappysys.zendesk.com/hc/article_attachments/360000122334/mceclip2.png" target="_blank" rel="noopener">like this</a>.</span></td>
</tr>
<tr>
<td><strong>-x</strong>, <a href="https://curl.haxx.se/docs/manpage.html#-x" target="_blank" rel="noopener"><strong>&#8211;proxy</strong></a> <em>[protocol://]host[:port]</em></td>
<td>Specify Proxy Settings</td>
<td>You can enable System default proxy or a custom proxy using the Proxy Tab in the OAuth / HTTP Connection Manager. <a href="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2016/07/ssis-powerpack-http-proxy-options.png?ssl=1" target="_blank" rel="noopener">Check this</a>.</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<h2>Convert Curl Syntax to SSIS PowerPack &#8211; REST API Task / JSON / XML Connector</h2>
<p>Take a look at the following example of <strong>CURL </strong>syntax</p><pre class="crayon-plain-tag">curl POST -u myusername:mypassword -H "Accept: application/json" -H "AppVersion:1.0" "https://mysite/v1/api/customers/" -d "customerid=AAA&amp;OrderDate=2016-01-01"</pre><p>
<strong>Where :</strong></p>
<pre class="crayon-plain-tag">-u</pre>  or <pre class="crayon-plain-tag">--user</pre>  = UserID and Password for server (This option sends credentials in BASIC Authentication mode)<br />
<pre class="crayon-plain-tag">-H</pre>  or <pre class="crayon-plain-tag">--header</pre>  = HTTP Header (e.g. Key: Value)<br />
<pre class="crayon-plain-tag">-d</pre>  or <pre class="crayon-plain-tag">--data</pre>  = Data for POST</p>
<p>For step-by-step information, check Article <a href="https://zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">Learn how to POST data to a URL using SSIS</a></p>
<p>Here is the screenshot of HTTP POST in JSON format using the <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZappySys REST API Task</a></p>
<div id="attachment_11608" style="width: 848px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/11/REST-API-task-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11608" class="wp-image-11608 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/11/REST-API-task-configuration.png" alt="" width="838" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2016/11/REST-API-task-configuration.png 838w, https://zappysys.com/blog/wp-content/uploads/2016/11/REST-API-task-configuration-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/11/REST-API-task-configuration-768x674.png 768w" sizes="(max-width: 838px) 100vw, 838px" /></a><p id="caption-attachment-11608" class="wp-caption-text">Convert CURL Command Line Syntax to SSIS &#8211; Perform HTTP POST operation using SSIS REST API Task &#8211; Send data in JSON content type</p></div>
<p>If you wish to POST data and parse the JSON response into rows, you can use the <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a>. JSON Source has a powerful JSON Parser that parses large JSON (stored in a file, an API URL, or a Direct string) into Rows and Columns. This is useful if you wish to save the response into a target such as SQL Server or a CSV file.</p>
<div id="attachment_11606" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/11/JSON-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11606" class="wp-image-11606 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/11/JSON-configuration.png" alt="" width="828" height="745" srcset="https://zappysys.com/blog/wp-content/uploads/2016/11/JSON-configuration.png 828w, https://zappysys.com/blog/wp-content/uploads/2016/11/JSON-configuration-300x270.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/11/JSON-configuration-768x691.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-11606" class="wp-caption-text">JSON Source example</p></div>
<h3>HTTP Headers &#8211; Convert Curl Syntax to SSIS</h3>
<p>Set up HTTP headers in ZappySys Task/Connect, or click on Raw Edit or Add/Edit items in Grid.</p>
<h3>HTTP Credentials &#8211; Convert Curl Syntax to SSIS</h3>
<p>Here is how you pass credentials in the curl command line.</p><pre class="crayon-plain-tag">curl.exe https://myserver.com/api -u myusername:mypassword</pre><p>
To setup HTTP credentials in SSIS for Basic / NTFS or Kerberos use HTTP Connection Manager (Access Mode must be changed to Url from Connection on <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZappySys REST API Task</a> and for <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source Connector</a> or <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">XML Source</a>  check Use Connection Option)</p>
<p>If you have OAuth 2.0 Credentials (Application ID, Application Secret) then use <a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">SSIS OAuth Connection Manager</a> rather than <a href="http://view-source://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection</a></p>
<p>Check this article to learn about <a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/" target="_blank" rel="noopener">how to pass HTTP Basic Credentials in SSIS PowerPack</a></p>
<h3>Proxy Setting &#8211; Convert Curl Syntax to SSIS</h3>
<p>Here is how you pass Proxy server info in cUrl command line (<pre class="crayon-plain-tag">-x</pre>  along with Proxy Server Host/IP and Port)</p><pre class="crayon-plain-tag">curl.exe -x 192.168.2.1:8888 https://myserver.com/api</pre><p>
<h2>Convert Curl Syntax to SSIS &#8211; Client Certificate Settings</h2>
<div>
<h3 class="screenshot_header">HTTP Connection Manager UI</h3>
<p><img decoding="async" class="figureimage" title="HTTP Connection Manager UI" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/http-connection/ssis-http-connection-manager-ui.png" alt="HTTP Connection Manager UI" /></p>
</div>
<div>
<h3 class="screenshot_header">Passing client certificate along with Web request (i.e. pfx/pkcs12/p12)</h3>
<p><img decoding="async" class="figureimage" title="Passing client certificate along with Web request (From Local/User store)" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/http-connection/http-web-request-send-client-side-certificate.png" alt="Passing client certificate along with Web request (From Local/User store)" /></p>
</div>
<div>
<h3 class="screenshot_header">Passing client certificate from file path (i.e. pfx/pkcs12/p12)</h3>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2016/11/Passing-client-certificate.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-11607" src="https://zappysys.com/blog/wp-content/uploads/2016/11/Passing-client-certificate.png" alt="" width="721" height="549" srcset="https://zappysys.com/blog/wp-content/uploads/2016/11/Passing-client-certificate.png 721w, https://zappysys.com/blog/wp-content/uploads/2016/11/Passing-client-certificate-300x228.png 300w" sizes="(max-width: 721px) 100vw, 721px" /></a></p>
</div>
<p>The post <a href="https://zappysys.com/blog/using-ssis-curl-syntax-to-ssis-api-task/">Convert CURL to SSIS PowerPack / ODBC for API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Call Semantics3 REST API in SSIS use OAuth1</title>
		<link>https://zappysys.com/blog/call-semantics3-rest-api-in-ssis-use-oauth1/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 15 Oct 2016 02:00:27 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth1]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[semantics3]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=823</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to call Sementics3 REST API using SSIS PowerPack. Using drag and drop approach you can consume data from Semantics3 REST API service. In this post we will use ZappySys JSON Source to read data from Amazon MWS API and load into SQL Server. We will also use REST API Task to [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/call-semantics3-rest-api-in-ssis-use-oauth1/">Call Semantics3 REST API in SSIS use OAuth1</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this post you will learn how to <em>call <a href="http://docs.semantics3.com/docs/api-requests" target="_blank" rel="noopener">Sementics3</a> REST API</em> using <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a>.</p>
<p>Using drag and drop approach you can <em>consume data from Semantics3 REST API service.</em> In this post we will use <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys JSON Source</a> to read data from Amazon MWS API and load into SQL Server. We will also use <a href="//zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">REST API Task</a> to call any API from Marketplace Web service and save output into Variable.</p>
<h2>Assumption</h2>
<p>This post assumes following things</p>
<ol>
<li>You have basic knowledge of SSIS and JSON format.</li>
<li>You have registered for Semantics3 API Access. If not then it takes less than 5 minutes to <a href="https://dashboard.semantics3.com/signup" target="_blank" rel="noopener">register for free here</a> to get started.</li>
<li>You have tested few API calls using <a href="https://dashboard.semantics3.com/p#/playground" target="_blank" rel="noopener">Semantics3 REST API Playground</a> this will give you idea about various API you can call and parameters you need to pass.</li>
</ol>
<h2>Step-By-Step &#8211; Call Semantics3 REST API using SSIS</h2>
<p>To consume data from any JSON Source (File or REST API) you can use  <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON Source.</a> or <a href="//zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">REST API Task.</a> In below example you will see how to call Semantics3 REST API and save output into SSIS Variable. With this approach you can call any API (GET / POST / DELETE / PUT)</p>
<ol>
<li>Download and Install SSIS PowerPack</li>
<li>Create test package</li>
<li>From SSIS toolbox drag <a href="//zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a>  and double click on the task to configure it</li>
<li>Select Request URL Access Mode = [Url from Connection]</li>
<li>Enter URL as below<br />
<pre class="crayon-plain-tag">https://api.semantics3.com/v1/products?q=%7b%22search%22%3a%22iphone%22%7d</pre>
In above URL<br />
** q=%7b%22search%22%3a%22iphone%22%7d =&gt; This is your search query in URL encoded format. Data without URL encode may look like this q={&#8220;search&#8221; : &#8220;iphone&#8221; }<br />
** If you have stored query in plain text (not encoded) in SSIS variable then you can use URLENC format specifier like this q={{User::varQ,URLENC}} . This will automatically encode data for you.</li>
<li>In Select Url Connection dropdown select New OAUTH connection option.</li>
<li>When prompted on OAuth connection UI select Provider=Custom, Enter ApiKey (i.e. Client ID) and Secret (i.e. Client Secret). If you not sure what is this then check your Developer console &gt; Applications Tab. Select OAuth1 from Version dropdown.
<div id="attachment_840" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-oauth-1-connection-manager-semantics3-rest-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-840" class="size-full wp-image-840" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-oauth-1-connection-manager-semantics3-rest-api-call.png" alt="Semantics3 API Call using SSIS OAuth1 Connection Manager" width="675" height="491" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-oauth-1-connection-manager-semantics3-rest-api-call.png 675w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-oauth-1-connection-manager-semantics3-rest-api-call-300x218.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-840" class="wp-caption-text">Semantics3 API Call using SSIS OAuth1 Connection Manager</p></div></li>
<li>Click OK to save UI. Do not click test because it may not work yet.</li>
<li>Now click Test and see content in the Preview window.
<div id="attachment_841" style="width: 711px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-semantics3-rest-api-oauth.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-841" class="size-full wp-image-841" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-semantics3-rest-api-oauth.png" alt="Call Semantics3 REST API using SSIS REST API Task" width="701" height="579" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-semantics3-rest-api-oauth.png 701w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-semantics3-rest-api-oauth-300x248.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-841" class="wp-caption-text">Call Semantics3 REST API using SSIS REST API Task</p></div></li>
<li>If you wish to save response data into SSIS variable then goto response Tab and check save option and select variable name.</li>
</ol>
<h2>Load Semantics3 data into SQL Server using SSIS (REST API Call)</h2>
<p>In this section we will see how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON Source</a> to read data from Semantics3 REST API and load into SQL Server</p>
<p>For making things simple we are calling</p>
<ol>
<li>Download and Install SSIS PowerPack</li>
<li>Create test package</li>
<li>From SSIS toolbox drag Data Flow task and double click task to go to Data Flow designer</li>
<li>Drag <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> from SSIS Toolbox</li>
<li>Configure JSON Source as below. You can use Select Filter option to select hierarchy (JSON Array). Then click Preview to see data.
<div id="attachment_839" style="width: 849px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-semantics3-rest-api-oauth1-read-json-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-839" class="size-full wp-image-839" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-semantics3-rest-api-oauth1-read-json-source.png" alt="Get data from Semantics3 API using SSIS JSON Source" width="839" height="635" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-semantics3-rest-api-oauth1-read-json-source.png 839w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-semantics3-rest-api-oauth1-read-json-source-300x227.png 300w" sizes="(max-width: 839px) 100vw, 839px" /></a><p id="caption-attachment-839" class="wp-caption-text">Get data from Semantics3 API using SSIS JSON Source</p></div></li>
<li>Drag OLEDB destination from SSIS Toolbox.</li>
<li>Connect JSON Source to OLEDB Destination and map input column to target table</li>
<li>Execute dataflow to load Semantics3 Data into SQL Server (or any destination such as File, Oracle, MySQL)
<div id="attachment_838" style="width: 591px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-extract-data-semantics3-rest-api-load-into-sql-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-838" class="size-full wp-image-838" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-extract-data-semantics3-rest-api-load-into-sql-server.png" alt="Read from Semantics3 REST API Call - Load into SQL Server using SSIS" width="581" height="379" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-extract-data-semantics3-rest-api-load-into-sql-server.png 581w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-extract-data-semantics3-rest-api-load-into-sql-server-300x196.png 300w" sizes="(max-width: 581px) 100vw, 581px" /></a><p id="caption-attachment-838" class="wp-caption-text">Read from Semantics3 REST API Call &#8211; Load into SQL Server using SSIS</p></div></li>
</ol>
<h2>Conclusion</h2>
<p>Semantics3 API provides great way to automate many functionality for searching and ordering millions of products into your custom App. Using ZappySys <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> you can consume data from any REST API or Web service without replying on SDK / coding approach (e.g. C#, Java, Python, Ruby).</p>
<p>The post <a href="https://zappysys.com/blog/call-semantics3-rest-api-in-ssis-use-oauth1/">Call Semantics3 REST API in SSIS use OAuth1</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read / write Google SpreadSheet using SSIS</title>
		<link>https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 24 Sep 2016 23:21:11 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[Google Drive]]></category>
		<category><![CDATA[Google Spreadsheet]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=798</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to get data from Google SpreadSheet (REST API) using SSIS. We will use drag and drop REST API connectors from SSIS PowerPack. No need to download any SDK or learn programming language (e.g. JAVA, C#, Ruby, Python) when you use SSIS PowerPack Connectors. We will use Google [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/">How to read / write Google SpreadSheet using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/google-sheets-connector/">API Connector for Google Sheets Online</a> which makes it much simpler to <strong>Read/Write Google Sheets Data in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).</p>
</div></div>
<a href="//zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1670" src="//zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration.png" alt="" width="150" height="171" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration.png 350w, https://zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration-263x300.png 263w" sizes="(max-width: 150px) 100vw, 150px" /></a>In this post you will learn how to <em>get data from Google SpreadSheet</em> (REST API) using SSIS. We will use drag and drop REST API connectors from <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a>. No need to download any SDK or learn programming language (e.g. JAVA, C#, Ruby, Python) when you use SSIS PowerPack Connectors. We will use Google Drive API and Google Sheets API to get file list and export SpreadSheet as CSV file in few clicks (Using OAuth 2.0 connection in SSIS).</p>
<p>In this tutorial we will use <a href="//zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">REST API Task</a> to call some ad-hoc API (e.g. get File List from Google Drive) and save output into Variable or File. We will use <a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth connection</a> along with <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys JSON Source connector</a> to read data from Google SpreadSheet (Use Drive API) and load into SQL Server (Export Google SpreadSheet to CSV).</p>
<h2>Create Google API Project</h2>
<p>First step to access any Google API is create an API Project in Google Console. If you don&#8217;t want to go through this then Skip this Step-1 and in the next section select Default OAuth App option on OAth Connection Manager (This is the most easiest option for now unless you want to use your own OAuth App).</p>
<p><a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Check this article</a> for step-by-step instructions. When you follow these instructions make sure you enable Google Drive API (In the article it shows how to enable YouTube API as an example but you will need to enable Drive API for this article).</p>
<h2>Create OAuth Connection Manager in SSIS</h2>
<p>Once you create Google API project and obtained Client ID and Client Secret your next step is to create <a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> in SSIS. ZappySys OAuth connection manager comes with many predefined OAuth Providers (e.g. Facebook, Twitter, Google etc) but you can also define custom OAuth settings for any OAuth enabled API.</p>
<p>To create SSIS OAuth 2.0 Connection for Google API perform following steps.</p>
<ol>
<li>Download and Install SSIS PowerPack</li>
<li>Create new SSIS Package</li>
<li>Right click in Connection Manager Area and Click &#8220;New Connection&#8221;</li>
<li>When prompted select ZS-OAUTH connection type</li>
<li>On the OAuth Connection Manager Select Provider=<strong>Google Sheets + Drive</strong>.</li>
<li>You can keep &#8220;Use Default App&#8221; selected or choose Custom App. <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Click here to learn &#8211; how to register Custom Google App</a></li>
<li>If you choose the Custom App option then <strong>enter the below scopes</strong> (or click Select Scopes). If you choose the default app then it&#8217;s not required.
<p>This will allow read / write access to Drive Files or Sheet (E.g. Reading file content / Export file to CSV). You can use Scope browser to see many other available permissions.</p><pre class="crayon-plain-tag">https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/spreadsheets.readonly</pre><p>
Click Generate Token button.</p>
<div id="attachment_847" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-oauth-connection-google-drive-api-access-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-847" class="wp-image-847" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-oauth-connection-google-drive-api-access-file.png" alt="SSIS OAuth Connection Manager - Access Google Drive API using OAuth 2.0" width="600" height="351" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-oauth-connection-google-drive-api-access-file.png 957w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-oauth-connection-google-drive-api-access-file-300x176.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-847" class="wp-caption-text">SSIS OAuth Connection Manager &#8211; Access Google Drive API using OAuth 2.0</p></div></li>
<li>You will see UI as below&#8230; Click Accept (You may have to scroll to see that button sometimes)</li>
<li>Click Test to see connection is working.</li>
</ol>
<p><strong>NOTE:</strong> If you don&#8217;t want to use Default OAuth App provided by ZappySys then select &#8220;Use Custom OAuth App&#8221; option (App created in previous section) specify your ClientID, ClientSecret.</p>
<h2>Find Google Sheet ID for API call</h2>
<p>Before we can read or write Sheet data in SSIS we need to know Google Driver File ID. We will use this ID in next few sections.</p>
<p>Easiest way to find File ID is look at the URL like below. If you need to know ID at runtime dynamically then refer last section.</p>
<p>&nbsp;</p>
<div id="attachment_8450" style="width: 806px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8450" class="size-full wp-image-8450" src="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png" alt="Get Google Drive File ID for API call (Sheet ID)" width="796" height="286" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png 796w, https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call-300x108.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call-768x276.png 768w" sizes="(max-width: 796px) 100vw, 796px" /></a><p id="caption-attachment-8450" class="wp-caption-text">Get Google Drive File ID for API call (Sheet ID)</p></div>
<h2>Reading Google SpreadSheet Data in SSIS</h2>
<p>Basically there are two ways you can export / read Google SpreadSheet data.</p>
<ul>
<li>Method-1 : Read Google SpreadSheet using SSIS JSON / REST API Source
<ul>
<li>In this approach we directly pull data from SpreadSheet using <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get" target="_blank" rel="noopener">Core Google SpreadSheet.Values API</a> to read particular Tab from Sheet and you can also specify Range. This is most effective way to read. Make sure you have <strong>v2.5.0.10807 or higher version</strong> (released after Aug 03 2017). New version added <a href="//zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">2D array transformation options to parse multi-dimensional arrays</a> found in SpreadSheet API JSON response.</li>
</ul>
</li>
<li>Method-2 : Read Google SpreadSheet using Flat File Source (as CSV)
<ul>
<li>Another approach is export SpreadSheet as CSV format. Then use Flat File Source to read that data and load into Target (E.g. SQL Server)</li>
</ul>
</li>
</ul>
<h3>Method-1 : Read Google SpreadSheet using SSIS JSON / REST API Source</h3>
<p>Now lets look at real steps to read Google SpreadSheet. To get values from specific tab and specific cell-row range you have to use <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get" target="_blank" rel="noopener">Google SpreadSheet.Values API</a></p>
<p>In this example we will load below Google Spreadsheet into SQL Server</p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example.png"><img loading="lazy" decoding="async" class="alignnone wp-image-1657" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example.png" alt="" width="521" height="327" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example.png 777w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example-300x188.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example-768x482.png 768w" sizes="(max-width: 521px) 100vw, 521px" /></a></p>
<h4><strong>Step-By-Step : Loading Google SpreadSheet into SQL Server using SSIS</strong></h4>
<ol>
<li>Drag and drop data flow on the control flow designer surface</li>
<li>Double click data flow and you will see SSIS Toolbox refreshed with new components</li>
<li>Drag ZS JSON Source from SSIS Toolbox onto Data flow designer surface</li>
<li>Double click JSON SOurce and configure below setting
<ol>
<li>Enter your Spreadsheet URL in the following format<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{your-file-id}/values/{cell-range}</pre>
For example purpose we will use <a href="https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit#gid=0" target="_blank" rel="noopener">this public SpreadSheet provided by Google</a>. If spreadsheet fileid is <strong>1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms</strong> (see previous section how to get fileid) and your tab name is <strong>Class Data</strong> and you like to extract data from <strong>A to F</strong> columns <strong>starting from 2nd row</strong> then your Cell range in the URL can be <strong>&#8216;Class Data&#8217;!A2:F</strong><br />
Here is the actual URL we will use for demo<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/'Class Data'!A2:F</pre>
&#8212; OR &#8212;<br />
You can also enter like below (If you omit Tab name then first table is used)<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/A1:F

--OR-- Use below URL for to supply Column names manually (Start from A2)

https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/A2:F</pre>
You can also enter like below, specify first row and last row<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/A1:F101</pre>
</li>
<li>Check Use credentials and select OAuth connection we created in previous section</li>
<li>Click on Select Filter and select values node and click OK  or you can directly enter following filter.<br />
<pre class="crayon-plain-tag">$.values[*]</pre>
<div id="attachment_1652" style="width: 894px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1652" class="size-full wp-image-1652" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api.png" alt="Configure SSIS JSON/REST API Source - Read data from Google SpreadSheet API " width="884" height="673" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api.png 884w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-300x228.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-768x585.png 768w" sizes="(max-width: 884px) 100vw, 884px" /></a><p id="caption-attachment-1652" class="wp-caption-text">Configure SSIS JSON/REST API Source &#8211; Read data from Google SpreadSheet API</p></div></li>
<li>Now click on array Transformation tab. Now we will show you two different ways to configure column names.</li>
<li><strong>Method-1: Auto Detect Column Names</strong> (added in <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/release-notes.htm" target="_blank" rel="noopener">version 3.1.2</a>)<br />
In recent version we added column less array transformation where we have option to detect first record as column name.</p>
<ol>
<li>Select Transform Type as Column less array</li>
<li>Check option First line has column names like below example (Ignore direct Sample JSON &#8211; We provided for demo only. In your case it will be URL)
<div id="attachment_9118" style="width: 645px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9118" class="wp-image-9118 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png" alt="JSON With 2D Array Pattern - Column names in First Row (Google Sheets API Pattern)" width="635" height="669" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png 635w, https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern-285x300.png 285w" sizes="(max-width: 635px) 100vw, 635px" /></a><p id="caption-attachment-9118" class="wp-caption-text">JSON With 2D Array Pattern &#8211; Column names in First Row (Google Sheets API Pattern)</p></div></li>
</ol>
</li>
<li><strong>Method-2: Manually Enter Column Names</strong> (For old version)
<ol>
<li>Select Transform simple 2D array option from dropdown</li>
<li>Check Specify columns list manually</li>
<li>Enter column names (Must match the order and count based on range you selected)<br />
<pre class="crayon-plain-tag">Student Name,Gender,Class Level,Home State,Major,Extracurricular Activity</pre>
<div id="attachment_1653" style="width: 878px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1653" class="size-full wp-image-1653" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2.png" alt="Configure SSIS JSON/REST API Source 2D Array Transformation for Google SpreadSheet API " width="868" height="255" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2.png 868w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2-300x88.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2-768x226.png 768w" sizes="(max-width: 868px) 100vw, 868px" /></a><p id="caption-attachment-1653" class="wp-caption-text">Configure SSIS JSON/REST API Source 2D Array Transformation for Google SpreadSheet API</p></div></li>
</ol>
</li>
<li>Now click Preview to see the data
<div id="attachment_1654" style="width: 872px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1654" class="size-full wp-image-1654" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3.png" alt="Configure SSIS JSON/REST API Source - Preview Google SpreadSheet Data" width="862" height="678" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3.png 862w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3-300x236.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3-768x604.png 768w" sizes="(max-width: 862px) 100vw, 862px" /></a><p id="caption-attachment-1654" class="wp-caption-text">Configure SSIS JSON/REST API Source &#8211;<br />Preview Google SpreadSheet Data</p></div></li>
<li>Click OK to save UI</li>
<li>Attach your JSON Source to target (e.g. OLEDB Destination for SQL Server Table).</li>
<li>Configure Destination
<div id="attachment_1655" style="width: 825px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1655" class="size-full wp-image-1655" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load.png" alt="Configure SQL Server destination for Google SpreadSheet to SQL Data load" width="815" height="489" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load.png 815w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load-300x180.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load-768x461.png 768w" sizes="(max-width: 815px) 100vw, 815px" /></a><p id="caption-attachment-1655" class="wp-caption-text">Configure SQL Server destination for Google SpreadSheet to SQL Data load</p></div></li>
<li>Execute SSIS Package to load Google SpreadSheet data int SQL Server
<div id="attachment_1656" style="width: 628px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-loading-google-spreadsheet-to-sql-server-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1656" class="size-full wp-image-1656" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-loading-google-spreadsheet-to-sql-server-example.png" alt="SSIS Example -Loading data from Google SpreadSheet into SQL Server Table" width="618" height="311" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-loading-google-spreadsheet-to-sql-server-example.png 618w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-loading-google-spreadsheet-to-sql-server-example-300x151.png 300w" sizes="(max-width: 618px) 100vw, 618px" /></a><p id="caption-attachment-1656" class="wp-caption-text">SSIS Example -Loading data from Google SpreadSheet into SQL Server Table</p></div></li>
</ol>
</li>
</ol>
<h3>Method-2 : Read Google SpreadSheet using Flat File Source (as CSV)</h3>
<p>Once we have Google Drive fileId we can perform following actions to export data into CSV file format. After that you can easily read CSV using SSIS FlatFile Source and load into SQL Server or other target.</p>
<h4>Export Google SpreadSheet as CSV file using SSIS REST API Task</h4>
<p>Here are the steps to export Google Drive SpreadSheet to CSV file</p>
<ol>
<li>Just like previous section configure REST API Task</li>
<li>Enter following URL (See we used FileId from SSIS variable. You can hardcode too.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/drive/v3/files/{{User::varFileId}}/export?mimeType=text/csv</pre>
</li>
<li>Goto response tab. Check Save response and select &#8220;Save to file option&#8221;.</li>
<li>Enter file path.</li>
<li>Response character set select utf-8 (This will allow Unicode characters in response)</li>
<li>Click Test to see preview
<div id="attachment_850" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-export-google-spreadsheet-to-csv-format-call-google-drive-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-850" class="wp-image-850" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-export-google-spreadsheet-to-csv-format-call-google-drive-api.png" alt="Export Google SpreadSheet to CSV file format using SSIS - Call Google Drive API to Export" width="600" height="503" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-export-google-spreadsheet-to-csv-format-call-google-drive-api.png 701w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-export-google-spreadsheet-to-csv-format-call-google-drive-api-300x252.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-850" class="wp-caption-text">Export Google SpreadSheet to CSV file format using SSIS &#8211; Call Google Drive API to Export</p></div></li>
<li>Click OK to save</li>
</ol>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: New version now includes CSV Source for API. Use that if you want to consume Google Spread Sheet data in Data Flow. However we still recommend JSON Source (As per previous section to read data. Use CSV export method only if JSON API is not working for you for some reason.</div></div>
<h4>Load Google SpreadSheet data into SQL Server using SSIS (REST API Call)</h4>
<p>Once you export SpreadSheet to CSV file you can easily consume it to load into SQL Server or any Target (e.g. Oracle, MySQL) using Native SSIS FlatFile Source and OLEDB/ADO.net Destination.</p>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> Using FlatFile Source is not covered in Article. You can find many articles online which shows how to use SSIS FlatFile Source.</div></div>
<h2>Write data to Google Spread Sheet</h2>
<p>Now lets look at how to write to Google SpreadSheet. To write multiple rows in a single request you may use <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate" target="_blank" rel="noopener">batchUpdate API</a>. Also check this link to <a href="https://developers.google.com/sheets/api/guides/values" target="_blank" rel="noopener">learn more</a>.</p>
<p>Below is sample request to write data to columns and some data to rows (set majorDimension = <strong>COLUMNS</strong> to <strong>write vertical</strong> and use <strong>ROWS</strong> to <strong>write horizontally</strong>. You can mix multiple ways just like below example)</p><pre class="crayon-plain-tag">POST 
https://sheets.googleapis.com/v4/spreadsheets/1lkMEgu0zm2Q-cnPeoNZp4hqeIuASxXSpsrxtDDV89tg/values:batchUpdate
Authorization: Bearer ya29.Gl3WBFb3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
Accept: */*

{
  "valueInputOption": "USER_ENTERED",
  "data": [
    {
      "range": "Sheet2!A1:A4",
      "majorDimension": "COLUMNS",
      "values": [
        ["Item", "Wheel", "Door", "Engine"]
      ]
    },
    {
      "range": "Sheet2!B1:D2",
      "majorDimension": "ROWS",
      "values": [
        ["Cost", "Stocked", "Ship Date"],
        ["$20.50", "4", "3/1/2016"]
      ]
    }
  ]
}</pre><p>
<div id="attachment_2050" style="width: 1282px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2050" class="size-full wp-image-2050" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth.png" alt="Write data to Google SpreadSheet using REST API Task (OAuth 2.0 Connection)" width="1272" height="668" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth.png 1272w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth-300x158.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth-768x403.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth-1024x538.png 1024w" sizes="(max-width: 1272px) 100vw, 1272px" /></a><p id="caption-attachment-2050" class="wp-caption-text">Write data to Google SpreadSheet using REST API Task (OAuth 2.0 Connection)</p></div>
<p>&nbsp;</p>
<h2>Update Google Sheet Cells &#8211; Single Range (Set Values for multiple cells)</h2>
<p>Now let&#8217;s look at the below example of updating multiple cells in google Sheet. For more information, you can see the <a href="https://developers.google.com/sheets/api/samples/writing" target="_blank" rel="noopener">example here</a>. For parameter detail review this API documentation.</p>
<p>You can use<a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener"> SSIS REST API Task</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> to achieve Spread Sheet Update scenario. For simple example lets use REST API Task.</p>
<ol>
<li>Drag and Drop ZS REST API Task on the control flow designer</li>
<li>Edit Task and select URL from Connection Method</li>
<li>Select OAuth Connection from the dropdown (Same connection we created in the previous section)</li>
<li>Enter the URL as below. Change Sheet ID, Range designator and API URL Parameters as per your need.<br />
<em>https://sheets.googleapis.com/v4/spreadsheets/<strong>[Sheet-ID-Here]</strong>/values/<strong>[Range-Here]</strong></em>?[<em><strong>Parameters-Here]
</strong></em><strong>Example URL (some part masked with xxxxxxxx):  </strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc/values/Sheet1!A2:B4?valueInputOption=USER_ENTERED</pre>
</li>
<li>Change Request Method to <strong>PUT</strong></li>
<li>Change Request Content type to <strong>application/json</strong></li>
<li>Enter Request Body as below (Assuming we need to update 4 cells)<br />
<pre class="crayon-plain-tag">{
"majorDimension": "ROWS",
  "values": [
   ["row1_cellA","row1_cellB"],
   ["row2_cellA","row2_cellB"],
  ]
}</pre>
</li>
<li>Click Test Request see it works.
<div id="attachment_4521" style="width: 947px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4521" class="size-full wp-image-4521" src="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells.png" alt="Calling Google Sheet API to Update Multiple Cell Values" width="937" height="948" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells.png 937w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells-297x300.png 297w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells-768x777.png 768w" sizes="(max-width: 937px) 100vw, 937px" /></a><p id="caption-attachment-4521" class="wp-caption-text">Calling Google Sheet API to Update Multiple Cell Values</p></div></li>
</ol>
<h2>Update Google Sheet Cells &#8211; Multiple Ranges</h2>
<p>If you like to update values which needs to define multiple ranges then you need to use <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate" target="_blank" rel="noopener">batchUpdate API</a>. Import changes are you can&#8217;t include Range in the URL like previous example of Single Range Update. Also you have to use POST method and body with multiple ranges.</p>
<p>Example of sheet update with multiple range</p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHxxxxxxxxxxxxxxxc/values:batchUpdate?valueInputOption=USER_ENTERED
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "data": [
    {
      "range": "Sheet1!A2:B3",
      "majorDimension": "ROWS",
      "values": [
        [
          "row1_cellA",
          "row1_cellB"
        ],
        [
          "row2_cellA",
          "row2_cellB"
        ]
      ]
    },
    {
      "range": "Sheet1!D2:E3",
      "majorDimension": "ROWS",
      "values": [
        [
          "row1_cellD",
          "row1_cellE"
        ],
        [
          "row2_cellD",
          "row2_cellE"
        ]
      ]
    }
  ]
}</pre><p>
&nbsp;</p>
<h2>Write SQL Server data to Google Sheet</h2>
<p>Now let&#8217;s look at real world example. How to write data from SQL Server table or other source and send to Google Sheet.</p>
<ol>
<li>Drag and Drop SSIS Data Flow Task from SSIS Toolbox<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Drag source (e.g. OLEDB Source) and configure it to read from source like SQL Server Table
<div id="attachment_7289" style="width: 515px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/oledb-source-drag-and-drop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7289" class="size-full wp-image-7289" src="https://zappysys.com/blog/wp-content/uploads/2019/06/oledb-source-drag-and-drop.png" alt="OLE DB Source - Drag and Drop" width="505" height="190" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/oledb-source-drag-and-drop.png 505w, https://zappysys.com/blog/wp-content/uploads/2019/06/oledb-source-drag-and-drop-300x113.png 300w" sizes="(max-width: 505px) 100vw, 505px" /></a><p id="caption-attachment-7289" class="wp-caption-text">OLE DB Source &#8211; Drag and Drop</p></div></li>
<li>Drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/">ZS JSON Generator</a>.
<ol>
<li>Connect Source to JSON Generator (blue arrow)</li>
<li>Double click it to configure</li>
<li>Select Output Mode as <strong>Single Dataset Array</strong> option for Mode. Enter Some Batch value (e.g. 500) this will make sure we send 500 rows at a time to Google API call. This way if we have many rows its not rejected by API call.</li>
<li>Click <strong>Add element</strong> (Select <strong>Static Element</strong>) . Name: <strong>majorDimension</strong> and Value: <strong>ROWS</strong></li>
<li>Now click Add Document Array icon, name as <strong>values</strong></li>
<li>check Treat as <strong>2D array</strong> option and click OK to save</li>
<li>Now under values node click <strong>Add elements</strong> &gt; Select <strong>Multiple Columns</strong> and Add columns you like to add.</li>
<li>Click OK to save JSON GeneratorBelow is just an example How you can use Batch Settings to create JSON with N rows in each JSON document.<br />
<img decoding="async" src="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-json-with-batch-setting.png?resize=720%2C564&amp;ssl=1" alt="Using SSIS JSON Generator Transform with Batch Option (Multiple Records in a single document)" /></li>
</ol>
</li>
<li>Now drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">ZS Web API destination</a>
<ol>
<li>Connect JSON Generator to Web API destination (blue arrow)</li>
<li>Double click it to configure</li>
<li>Select same OAuth connection manager created in earlier section (Assuming you had all scopes with write permission)</li>
<li>Now select <strong>Input column</strong> for <strong>Body </strong>(JSON Generator Output)</li>
<li>Enter API call URL as below (Replace <strong>ID</strong> with your own id)<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{your-file-id}/values/Sheet1!A2?valueInputOption=USER_ENTERED</pre>
</li>
<li>Select Request Method as <strong>PUT</strong></li>
<li>Select content type as <strong>application/json</strong></li>
<li>You can enter sample Body As below.<br />
<pre class="crayon-plain-tag">{
"majorDimension": "ROWS",
  "values": [
   ["Bob","bob@mycompany.com",55],
   ["Sam","sam@mycompany.com",57]
  ]
}</pre>
</li>
<li>Click Test Request / Response button. Check your Sheet in browser after it see it updates?</li>
<li>If you see <strong>200 OK</strong> response means we are good to go.</li>
<li>Run package and see your real data updated in Sheet.</li>
</ol>
</li>
</ol>
<h2>Format Cells using Google Sheet API</h2>
<p>Now let&#8217;s look at an example to format cell using Google Sheet API (e.g. Change Font, Color, Border, Background). For more information review <a href="https://developers.google.com/sheets/api/samples/formatting" target="_blank" rel="noopener">this API documentation</a>.</p>
<p>To format Sheet you first need to get SheetID  (keep in mind this is not same as spreadsheetId which you used in URL). SheetId is basically numeric ID of your Tab in WorkSheet.</p>
<h3>Get SheetID</h3>
<p><strong>Request</strong></p><pre class="crayon-plain-tag">GET https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHtxxxxxxxxxxxxxx</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">{
  "spreadsheetId": "1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc",
  "properties": {
    "title": "Test.xlsx",
    "locale": "en",
    "autoRecalc": "ON_CHANGE",
    "timeZone": "America/Los_Angeles",
    "defaultFormat": {
      "backgroundColor": {
        "red": 1,
        "green": 1,
        "blue": 1
      },
      "padding": {
        "right": 3,
        "left": 3
      },
      "verticalAlignment": "BOTTOM",
      "wrapStrategy": "OVERFLOW_CELL",
      "textFormat": {
        "foregroundColor": {},
        "fontFamily": "Calibri",
        "fontSize": 11,
        "bold": false,
        "italic": false,
        "strikethrough": false,
        "underline": false
      }
    }
  },
  "sheets": [
    {
      "properties": {
        "sheetId": 1896331083,
        "title": "Sheet1",
        "index": 0,
        "sheetType": "GRID",
        "gridProperties": {
          "rowCount": 1000,
          "columnCount": 26,
          "rowGroupControlAfter": true,
          "columnGroupControlAfter": true
        }
      }
    }
  ],
  "spreadsheetUrl": "https://docs.google.com/spreadsheets/d/1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc/edit"
}</pre><p>
Notice that in above response we see <strong>&#8220;sheetId&#8221;: 1896331083</strong>. This ID we will use in the Update API to format Cells.</p>
<h3>Update Borders Example</h3>
<p>Here is the example of Google Sheet Formatting API <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#updatebordersrequest" target="_blank" rel="noopener">updateBorders Request</a></p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSxxxxlt4BRoX8rCHrORJc:batchUpdate
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "requests": [
    {
      "updateBorders": {
        "range": {
          "sheetId": 1896331083,
          "startRowIndex": 0,
          "endRowIndex": 10,
          "startColumnIndex": 0,
          "endColumnIndex": 6
        },
        "top": {
          "style": "DASHED",
          "width": 1,
          "color": {
            "blue": 1.0
          },
        },
        "bottom": {
          "style": "DASHED",
          "width": 1,
          "color": {
            "blue": 1.0
          },
        },
        "innerHorizontal": {
          "style": "DASHED",
          "width": 1,
          "color": {
            "blue": 1.0
          },
        },
      }
    }
  ]
}</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">{
  "spreadsheetId": "1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc",
  "replies": [
    {}
  ]
}</pre><p>
&nbsp;</p>
<h3>Update Cell Font Style (Bold, Style, Color, Background)</h3>
<p>Now let&#8217;s look at how to use <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#RepeatCellRequest" target="_blank" rel="noopener">repeateCellRequest</a> to apply certain type of formatting to multiple cells. This may be color, font style, background color.</p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3xxxxxx4BRoX8rCHrORJc:batchUpdate
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "requests": [
    {
      "repeatCell": {
        "range": {
          "sheetId": 1896331083,
          "startRowIndex": 0,
          "endRowIndex": 1
        },
        "cell": {
          "userEnteredFormat": {
            "backgroundColor": {
              "red": 0,
              "green": 0.5,
              "blue": 0.7,
              "alpha": 1.3
            },
            "textFormat": {
              "foregroundColor": {
                "red": 1
              },
              "bold": true,
              "italic": true,
              "strikethrough": true,
              "underline": true
            }
          }
        },
        "fields": "userEnteredFormat"
      }
    }
  ]
}</pre><p>
In above example we have applied <strong>textFormat</strong> and <strong>backgroundColor</strong> but you can use any of below sections.<br />
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">
<span class="pun">{<br />
</span><span class="str">&#8220;numberFormat&#8221;<span class="pun">: </span><span class="pun">{</span><span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#NumberFormat">NumberFormat</a></code>)</span> <span class="pun">}</span><span class="pun">,</span><br />
&#8220;backgroundColor&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#Color">Color</a></code>)</span> <span class="pun">}</span><span class="pun">,</span><br />
&#8220;borders&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#Borders">Borders</a></code>)</span> <span class="pun">}</span><span class="pun">,</span><br />
&#8220;padding&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#Padding">Padding</a></code>)</span> <span class="pun">}</span><span class="pun">,</span><br />
&#8220;horizontalAlignment&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#HorizontalAlign">HorizontalAlign</a></code>)</span><span class="pun">,</span><br />
&#8220;verticalAlignment&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#VerticalAlign">VerticalAlign</a></code>)</span><span class="pun">,</span><br />
&#8220;wrapStrategy&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#WrapStrategy">WrapStrategy</a></code>)</span><span class="pun">,</span><br />
&#8220;textDirection&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#TextDirection">TextDirection</a></code>)</span><span class="pun">,</span><br />
&#8220;textFormat&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#TextFormat">TextFormat</a></code>)</span> <span class="pun">}</span><span class="pun">,<br />
</span> &#8220;hyperlinkDisplayType&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#HyperlinkDisplayType">HyperlinkDisplayType</a></code>)</span><span class="pun">,</span><br />
&#8220;textRotation&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#TextRotation">TextRotation</a></code>)</span> <span class="pun">}</span><br />
<span class="pun">}</span></span><br />
</div></div>
<h3>Set Currency Formatting</h3>
<p>Here is an example request to set currency formatting</p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc:batchUpdate
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "requests": [
    {
      "repeatCell": {
        "range": {
          "sheetId": 1896331083,
          "startRowIndex": 1,
          "startColumnIndex": 4,
          "endColumnIndex": 5
        },
        "cell": {
          "userEnteredFormat": {
            "numberFormat": {
              "type": "CURRENCY",
              "pattern": "$#,##0.00"
            }
          }
        },
        "fields": "userEnteredFormat.numberFormat"
      }
    }
  ]
}</pre><p>
<h3>Set Cell Validation</h3>
<p>You can also set cell validation by calling following API call. This will restrict user&#8217;s ability to enter wrong data in certain cells.</p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc:batchUpdate
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "requests": [
    {
      "setDataValidation": {
        "range": {
          "sheetId": 1896331083,
          "startRowIndex": 1,
          "startColumnIndex": 0,
          "endColumnIndex": 6
        },
        "rule": {
          "condition": {
            "type": "ONE_OF_LIST",
            "values": [
              {
                "userEnteredValue": "Red"
              },
              {
                "userEnteredValue": "Green"
              },
              {
                "userEnteredValue": "Yellow"
              }
            ]
          },
          "inputMessage": "Color must be Red, Yellow or Green",
          "strict": true,
          "showCustomUi": true
        }
      }
    }
  ]
}</pre><p>
&nbsp;</p>
<h2>Dynamically obtain File ID for Google Drive REST API call</h2>
<p>Once OAuth connection is defined you can now call any valid API from Google based on Permission you requested in OAuth Connection. OAuth connection takes care of renewing you Token and passing Authorization as per OAuth standard. All these protocol complexity is hidden from you.</p>
<p>First step to get data from Google SpreadSheet using REST API call is get fileId of the Google Drive File you want to read. The easiest way to know file ID is call following API. Below API call returns name, ID and other information about file(s). You can get only fileID and use that in Next Section to export Google SpreadSheet to CSV format.</p><pre class="crayon-plain-tag">https://www.googleapis.com/drive/v3/files</pre><p>
OR</p><pre class="crayon-plain-tag">https://www.googleapis.com/drive/v3/files/?q=name%3D'Customers'</pre><p>
<strong>NOTE:</strong> For more information about searching files in Google drive / getting list of files using search expression language <a href="https://developers.google.com/drive/v3/web/search-parameters#examples" target="_blank" rel="noopener">check this link.</a> Make sure expression is URL encoded (e.g. name=&#8217;Customers&#8217; should be passed as name%3D&#8217;Customers&#8217;)</p>
<p>Above API returns response as below. Notice the name and fileId. We will use <strong>fileId</strong> when calling export API in next section.</p><pre class="crayon-plain-tag">{
 "kind": "drive#fileList",
 "files": [
  {
   "kind": "drive#file",
   "id": "1lkMEgu0zm2Q-cnPeoNZp4hqeIuASxXSpsrxtDDV89tg",
   "name": "Customers",
   "mimeType": "application/vnd.google-apps.spreadsheet"
  },
  {
   "kind": "drive#file",
   "id": "0B6UyXr6ZlIFTc3RhcnRlcl9maWxl",
   "name": "How to get started with Drive",
   "mimeType": "application/pdf"
  }
 ]
}</pre><p>
If you want to automate retrieval of fileId from document name then perform the following steps.</p>
<ol>
<li>In the SSIS package Control flow. Drag and drop ZS REST API Task from SSIS toolbox</li>
<li>In the Request Access mode, select &#8220;URL from Connection&#8221; option</li>
<li>Select OAuth connection manager (Created in Section-2)</li>
<li>Enter URL as below (It will return any file name equals to Customers (%3D is encoded value for = sign)<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/drive/v3/files/?q=name%3D'Customers'</pre>
</li>
<li>Click Test (You will see file information)
<div id="attachment_848" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-call-google-drive-api-get-file-list.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-848" class="wp-image-848" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-call-google-drive-api-get-file-list.png" alt="Get Google Drive File List in SSIS - Call Google Drive API. Search file by name or expression " width="600" height="451" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-call-google-drive-api-get-file-list.png 776w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-call-google-drive-api-get-file-list-300x225.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-848" class="wp-caption-text">Get Google Drive File List in SSIS &#8211; Call Google Drive API to search file by name or expression</p></div></li>
<li>If you want to extract only fileID from full JSON then go to response tab</li>
<li>Select Format=JSON, Enter following JSONPath expression to extract only fileId from first record<br />
<pre class="crayon-plain-tag">$.files[0].id</pre>
</li>
<li>Check save response content, select SSIS variable where you want to save fileId as below. Now click Test to see preview of response. You will notice now only fileId will be returned from full JSON response.
<div id="attachment_849" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-get-google-drive-fileid-from-file-name-using-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-849" class="wp-image-849" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-get-google-drive-fileid-from-file-name-using-api-call.png" alt="Get Google Drive fileid from file name using api call in SSIS" width="600" height="475" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-get-google-drive-fileid-from-file-name-using-api-call.png 681w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-get-google-drive-fileid-from-file-name-using-api-call-300x237.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-849" class="wp-caption-text">Get Google Drive fileid from file name using API call in SSIS</p></div></li>
<li>Click OK to save task</li>
</ol>
<h2>Conclusion</h2>
<p>Google Drive API and Google Sheets API provides a great way to automate file related functionality. However, to call Google API  you have to use SDK / coding approach (e.g. C#, Java, Python, Ruby). Luckily ZappySys <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> provides a great way to integrate any Google API call via simple drag and drop approach without coding. Try out yourself see how long it takes to call virtually any REST API.</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/">How to read / write Google SpreadSheet using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS &#8211; Extract single XML node using XPath from SOAP response</title>
		<link>https://zappysys.com/blog/ssis-extract-single-xml-node-using-xpath-soap-response/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 07 Sep 2016 16:01:07 +0000</pubDate>
				<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<category><![CDATA[ssis xml source]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xpath]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=770</guid>

					<description><![CDATA[<p>Introduction In this post, you will learn how to extract a single XML node value from your XML web response (SOAP Web service call) using an XPath expression in the SSIS REST API Web Service Task and the XML Parser Task. This article assumes you have basic knowledge of how to call a REST API or a [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-extract-single-xml-node-using-xpath-soap-response/">SSIS &#8211; Extract single XML node using XPath from SOAP response</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><span style="box-sizing: border-box; margin: 0px; padding: 0px;">In this post, you will learn how to extract a single XML node value from your XML web response (SOAP Web service call) using an XPath expression in <a target="_blank" rel="noopener"><em><span style="color: #248cc8;">the SSIS REST API Web Service Task</span></em></a> and the <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-parser-task/" target="_blank" rel="noopener">XML Parser Task</a>.</span></p>
<p>This article assumes you have basic knowledge of how to call a REST API or a SOAP Web service in SSIS. If you are not familiar with that, then refer to the following articles.</p>
<p><a title="Permalink to Calling SOAP Web Service in SSIS (XML Source)" href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" rel="bookmark">Calling SOAP Web Service in SSIS (XML Source)</a></p>
<p><a title="Permalink to Call REST API using SSIS Web Service Task / JSON / XML Source" href="https://zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" rel="bookmark">Call REST API using SSIS Web Service Task / JSON / XML Source</a></p>
<h2>Calling REST / SOAP Web service using the SSIS REST API Task</h2>
<p>Refer to the following video on how to call a REST API web service.</p>
<div id="attachment_11523" style="width: 848px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2015/08/SSIS-REST-Api-Task-HTTP-POST-SSIS-Call-Web-Service.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11523" class="size-full wp-image-11523" src="https://zappysys.com/blog/wp-content/uploads/2015/08/SSIS-REST-Api-Task-HTTP-POST-SSIS-Call-Web-Service.png" alt="" width="838" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2015/08/SSIS-REST-Api-Task-HTTP-POST-SSIS-Call-Web-Service.png 838w, https://zappysys.com/blog/wp-content/uploads/2015/08/SSIS-REST-Api-Task-HTTP-POST-SSIS-Call-Web-Service-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/08/SSIS-REST-Api-Task-HTTP-POST-SSIS-Call-Web-Service-768x674.png 768w" sizes="(max-width: 838px) 100vw, 838px" /></a><p id="caption-attachment-11523" class="wp-caption-text">Calling REST API in SSIS using REST API Task, Pass headers, Body, Url Parameters</p></div>
<h2>Extract the REST API Response into a file</h2>
<p>Here is how you can save the response into a variable or a file. Go to the Response settings tab and select the check Response content option, as shown below. You can also Filter Response content (e.g., Extract only a single value from a node).</p>
<div id="attachment_11595" style="width: 848px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11595" class="size-full wp-image-11595" src="https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression.png" alt="" width="838" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression.png 838w, https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression-768x674.png 768w" sizes="(max-width: 838px) 100vw, 838px" /></a><p id="caption-attachment-11595" class="wp-caption-text">SSIS Rest API Task &#8211; Extract data from a single XML node using XPath expression (Namespace used)</p></div>
<h2>Extract a single XML Node using XPath (XML with Namespace)</h2>
<p>To extract a single value from the Response XML, you can define an XPath expression on the REST API Response tab as follows. If your response XML document contains namespaces (e.g., the node looks like this: &lt;ns1:Body xmlns:ns1=&#8221;http://abc.com&#8221;&gt;&lt;ns1:Data&gt;abcdefg&lt;/ns1:Data&gt;&lt;/ns1:Body&gt;), then you have to write XPath in a particular way, as shown below. Notice we have not specified the Namespace prefix ns1</p>
<p><strong>Sample XML Document (Or web response from SOAP Service)</strong></p><pre class="crayon-plain-tag">&lt;ns1:Body xmlns:ns1="http://abc.com"&gt;
	&lt;ns1:Data&gt;abcdefg&lt;/ns1:Data&gt;
&lt;/ns1:Body&gt;</pre><p>
<strong>XPath Expression Example:</strong></p><pre class="crayon-plain-tag">//*[local-name()='Data']</pre><p>
<strong>XPath Output:</strong></p>
<p>The above expression will produce the following result</p><pre class="crayon-plain-tag">abcdefg</pre><p>
<h2>Extract Attribute Value using XPath local-name() function</h2>
<p>Now, let&#8217;s find out how to extract the attribute value rather than the element.</p>
<p>Consider the following XML. Let&#8217;s say we want to extract the id from the data node. In such a case, the previous XPath expression won&#8217;t work, so we need to use a slightly different XPath.</p><pre class="crayon-plain-tag">&lt;ns1:Body xmlns:ns1="http://abc.com"&gt;
	&lt;ns1:Data id="12345"&gt;abcdefg&lt;/ns1:Data&gt;
&lt;/ns1:Body&gt;</pre><p>
Let&#8217;s use the <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-parser-task/" target="_blank" rel="noopener">XML Parser Task</a> to test XPath.</p>
<h3>Expression 1 &#8211; Get value by direct attribute name</h3>
<p>Write the following expression as below and click Test</p><pre class="crayon-plain-tag">//@*[local-name()='id']</pre><p>
<div id="attachment_11593" style="width: 727px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-Use-local-name-function.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11593" class="size-full wp-image-11593" src="https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-Use-local-name-function.png" alt="" width="717" height="572" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-Use-local-name-function.png 717w, https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-Use-local-name-function-300x239.png 300w" sizes="(max-width: 717px) 100vw, 717px" /></a><p id="caption-attachment-11593" class="wp-caption-text">Extract XML Attribute Value using XPath expression (Use local-name function)</p></div>
<h3>Expression 2 &#8211; Get specific element attribute value</h3>
<p>If you want to be specific and read the value of the <code>id</code> attribute from a particular <code>data</code> element, you can use an expression like this:</p><pre class="crayon-plain-tag">//*[local-name()='Data']/@*[local-name()='id']</pre><p>
<div id="attachment_11594" style="width: 842px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11594" class="size-full wp-image-11594" src="https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-2.png" alt="" width="832" height="583" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-2.png 832w, https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-2-300x210.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/Extract-XML-Attribute-Value-using-XPath-expression-2-768x538.png 768w" sizes="(max-width: 832px) 100vw, 832px" /></a><p id="caption-attachment-11594" class="wp-caption-text">Extract XML Attribute Value using XPath expression 2</p></div>
<h2>Configure the SSIS Rest API Task to filter XML Response using XPath</h2>
<p>The screenshot below shows how to filter XML data using an XPath expression. You can save extracted data to an SSIS Variable or save it to a file.</p>
<div id="attachment_11595" style="width: 848px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11595" class="size-full wp-image-11595" src="https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression.png" alt="" width="838" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression.png 838w, https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/SSIS-Rest-API-Task-Extract-data-from-single-XML-node-using-XPath-expression-768x674.png 768w" sizes="(max-width: 838px) 100vw, 838px" /></a><p id="caption-attachment-11595" class="wp-caption-text">SSIS Rest API Task &#8211; Extract data from a single XML node using XPath expression (Namespace used)</p></div>
<h2>More Examples of XPath expressions</h2>
<pre class="crayon-plain-tag">XPath expression examples:
============================

Example1: Extract value of any element by node name (without namespace specified) 

&lt;ns1:AuthInfo&gt;&lt;ns1:Token&gt;aaaaa&lt;/ns1:Token&gt;&lt;/ns1:AuthInfo&gt;

XPath Expression:  //*[local-name() = 'Token']
Returns: aaaaa
----------------------------
Example2: Extract text of element called Token 

&lt;AuthInfo&gt;&lt;Token&gt;aaaaa&lt;/Token&gt;&lt;/AuthInfo&gt;

XPath Expression:  ./AuthInfo/Token/text()
Returns: aaaaa
----------------------------
Example3: Extract value of attribute called Version 

&lt;Doc&gt;&lt;Row Version="1" /&gt;&lt;/Doc&gt;

XPath Expression:  ./Doc/Row/@Version
Returns: 1
----------------------------
Example4: Extract value of following-sibling node or use preceding-sibling 

&lt;Response&gt;
	&lt;Prop&gt;
		&lt;PropName&gt;User&lt;/PropName&gt;
		&lt;PropVal&gt;admin&lt;/PropVal&gt;
	&lt;/Prop&gt;
	&lt;Prop&gt;
		&lt;PropName&gt;SessionId&lt;/PropName&gt;
		&lt;PropVal&gt;s_123456&lt;/PropVal&gt;
	&lt;/Prop&gt;
&lt;/Response&gt;

Expression:  //*[local-name()='PropName' and text()='SessionID']/following-sibling::node()[local-name()='PropValue']
Returns: s_123456
----------------------------
Example5: Extract node value with matching attribute 

&lt;Response&gt;&lt;Prop Name="SessionId"&gt;s_1234&lt;/Prop&gt;&lt;/Response&gt;

XPath Expression:  //*[local-name()='Prop' and @Name='SessionId']
Returns: s_1234
----------------------------
Example6: Extract attribute value by name (without namespace specified) 

s_1234

XPath Expression:  //@*[local-name()='token']
Returns: 123456
----------------------------</pre>
<p>The post <a href="https://zappysys.com/blog/ssis-extract-single-xml-node-using-xpath-soap-response/">SSIS &#8211; Extract single XML node using XPath from SOAP response</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>REST API File Upload using SSIS (Multi Part POST)</title>
		<link>https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 02 Jun 2016 22:42:27 +0000</pubDate>
				<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[http post]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[restful]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=540</guid>

					<description><![CDATA[<p>Introduction In this post, you will learn how to use the SSIS REST API Task to perform REST API File Upload (i.e., RESTful file upload) to a web server. Typically, to access the REST API, you need to use a programming language, but in this post, we will use a drag-and-drop visual approach. File upload using [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/">REST API File Upload using SSIS (Multi Part POST)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this post, you will learn how to use the <a target="_blank" rel="noopener">SSIS REST API Task</a> to perform REST API File Upload (i.e., RESTful file upload) to a web server. Typically, to access the REST API, you need to use a programming language, but in this post, we will use a drag-and-drop visual approach.</p>
<p>File upload using HTTP/HTTPS protocol, sometimes also known as multipart/form-data POST. Many REST APIs support file upload using HTTP methods such as POST or PUT.</p>
<p><b>Real-world scenarios:</b></p>
<ul>
<li>Uploading images/media to <a href="https://dev.twitter.com/rest/reference/post/account/update_profile_image" target="_blank" rel="noopener">Twitter</a> or Facebook</li>
<li><a href="http://developers.marketo.com/documentation/rest/import-lead/" target="_blank" rel="noopener">Import Marketo Lead files</a> using REST API</li>
</ul>
<h2>How to do REST API File Upload using SSIS</h2>
<p>First, you will have to download a <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">FREE Trial of SSIS PowerPack</a> (It comes with many REST API Connectors and over 30+ functional tasks/components)</p>
<ol>
<li>Download and install <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here</a></li>
<li>From the toolbox of the SSIS designer, drag the <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">ZS SSIS REST API Task</a></li>
<li>Double-click the <strong>REST API Task</strong> to configure it</li>
<li>Specify URL where you wish to <strong>POST file</strong>/other data<br />
Example: http://myserver/api/v1/uploaddata</li>
<li>Select HTTP Request Method as <strong>POST</strong> ( make sure your API Documentation for this. Sometimes it&#8217;s <strong>PUT</strong> rather than  POST)</li>
<li><strong>Check the File Upload </strong>option next to the Body text box (<span style="color: #ff6600; text-decoration: underline;">This is most important so don&#8217;t forget 🙂</span> )</li>
</ol>
<h3>Method 1 &#8211; Upload file using Raw Mode (Or POST data from a local file)</h3>
<p>The first method of uploading a file or posting data to the server from a local file is a RAW upload. To enable this you simply have to make sure 2 things.</p>
<ol>
<li>Check the File upload option next to Body.</li>
<li>In the Body, enter the local file path starting with the @ sign (e.g., @D:\Zappysys\CSV files\example1.csv)</li>
</ol>
<p>When you don&#8217;t include a Key/Value pair and only the filepath is found, then the request is treated as a RAW Upload. In raw uploads, the default content type is application/octet-stream. If you want to put a custom Content-Type, then edit the Headers in the Grid.</p>
<p>The above technique can be used to read POST data content from a local file. Using this method, only one file can be uploaded. If the remote server supports multiple files (i.e., Multi-Part/Form-Data POST), use the following process. See the screenshot below of the file content upload using Raw mode. We used <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a> to inspect the REST API Task&#8217;s Web requests.</p>
<div id="attachment_11586" style="width: 969px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/06/POST-file-data-using-SSIS-Raw-file-upload.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11586" class="size-full wp-image-11586" src="https://zappysys.com/blog/wp-content/uploads/2016/06/POST-file-data-using-SSIS-Raw-file-upload.png" alt="" width="959" height="683" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/POST-file-data-using-SSIS-Raw-file-upload.png 959w, https://zappysys.com/blog/wp-content/uploads/2016/06/POST-file-data-using-SSIS-Raw-file-upload-300x214.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/06/POST-file-data-using-SSIS-Raw-file-upload-768x547.png 768w" sizes="(max-width: 959px) 100vw, 959px" /></a><p id="caption-attachment-11586" class="wp-caption-text">POST file data using SSIS ( Raw file upload)</p></div>
<h3>Method 2 &#8211; Upload file(s) using Multi-Part / Form Data mode (Mixed content, multiple files)</h3>
<p>The second method for file upload is Multi-Part Upload. The advantage of using this method is that you can POST upload a key/value pair along with single or multiple files. To use this method, you must make sure the API supports it on the other end. Use the steps below to POST data using the Multi-Part method.  SSIS PowerPack detects RAW mode vs Multi-Part POST based on BODY content. If the Body contains an Equal sign somewhere and the File Upload option is checked, then it&#8217;s treated as a Multi-Part upload. If File Upload Option is checked and Body contains only file path which starts with @ sign then its treated as Raw content upload.</p>
<ol>
<li>Check the File upload option next to Body.</li>
<li>Now, click the edit button next to the Body text box. You may specify files/fields you wish to submit along with your request in the following format. It&#8217;s a key/value pair separated by a new line. An equal sign (=) must separate each key/value pair.<strong>NOTE: </strong>Any value starting with an at symbol (@) is treated as a File Path. If you don&#8217;t want that behavior, then use a slash, also known as an escape sequence (e.g., Somefield3StartsWithAt=\@MyTwitterHandle). You can do the same thing to add a new line character in your value. Use \r\n for a new line. Use \t for tab. Also, notice that the field name can be anything unless your API expects it in a specific way. Example: Twitter Image Upload API may expect your image file as a media field. In that case you would write &#8230;.  media=@c:\data\someimage.png &#8230;. rather than File1=@c:\data\someimage.png<br />
<pre class="crayon-plain-tag">File1=@c:\data\somedata.txt
File1.Content-Type=text/plain
File2=@c:\data\someimage.png
File2.Content-Type=image/png
Somefield1=abcdef
Somefield2=123456
Extrafield3WithNewLine=This is line1\r\nThis is line2 with tab\t and more \t tab
Somefield3StartsWithAt=\@MyTwitterHandle</pre>
Click OK to Save above.</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: If you do not specify Content-Type of file using <pre class="crayon-plain-tag">SomeFieldName.Content-Type</pre> attribute, then the system automatically detects based on the file extension. To exclude content-type altogether, you have to set it as a blank string, like below<br />
<pre class="crayon-plain-tag">file1=@c:\temp\dump.json
file1.Content-Type=</pre>
</div></div></li>
<li>Now, click the Test button in the UI to make sure everything looks good.
<div id="attachment_11587" style="width: 848px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/06/Uploading-files-using-REST-API-in-SSIS-REST-API-File-upload-using-Multipart-form-data-POST.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11587" class="size-full wp-image-11587" src="https://zappysys.com/blog/wp-content/uploads/2016/06/Uploading-files-using-REST-API-in-SSIS-REST-API-File-upload-using-Multipart-form-data-POST.png" alt="" width="838" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/Uploading-files-using-REST-API-in-SSIS-REST-API-File-upload-using-Multipart-form-data-POST.png 838w, https://zappysys.com/blog/wp-content/uploads/2016/06/Uploading-files-using-REST-API-in-SSIS-REST-API-File-upload-using-Multipart-form-data-POST-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/06/Uploading-files-using-REST-API-in-SSIS-REST-API-File-upload-using-Multipart-form-data-POST-768x674.png 768w" sizes="(max-width: 838px) 100vw, 838px" /></a><p id="caption-attachment-11587" class="wp-caption-text">Uploading files using REST API in SSIS ( REST API File upload using Multipart form-data POST)</p></div></li>
</ol>
<h2>Understanding Multipart Upload / File Upload</h2>
<p>Now, let&#8217;s take a look at what it looks like in <a href="https://www.telerik.com/download/fiddler/fiddler4" target="_blank" rel="noopener">Fiddler</a> when an actual <strong>Multipart POST request</strong> is made for the REST API File upload. Notice that each field included in our HTTP POST request is separated by some random boundary. The REST API Task automatically generates this boundary. If you post an Image, then you will see binary data rather than text for file content. Here are <a href="https://zappysys.zendesk.com/hc/en-us/articles/360036068434" target="_blank" rel="noopener">some known issues</a> you need to be aware of.</p>
<div id="attachment_11585" style="width: 1000px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/06/fiddler-http-multipart-form-data-example-rest-api-file-upload-post-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11585" class="wp-image-11585 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/06/fiddler-http-multipart-form-data-example-rest-api-file-upload-post-1.png" alt="HTTP Multipart POST - File Upload Example - Check Fiddler Request" width="990" height="557" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/fiddler-http-multipart-form-data-example-rest-api-file-upload-post-1.png 990w, https://zappysys.com/blog/wp-content/uploads/2016/06/fiddler-http-multipart-form-data-example-rest-api-file-upload-post-1-300x169.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/06/fiddler-http-multipart-form-data-example-rest-api-file-upload-post-1-768x432.png 768w" sizes="(max-width: 990px) 100vw, 990px" /></a><p id="caption-attachment-11585" class="wp-caption-text">HTTP Multipart POST &#8211; File Upload Example &#8211; Check Fiddler Request</p></div>
<p><strong>Here is a Sample Multi-Part request.</strong></p>
<p>Notice a few things</p>
<ul>
<li>The first line of the body content is &#8220;Boundary.&#8221;</li>
<li>Last line in the body is also a Boundary, but it has two extra dashes at the end after the boundary line (i.e. &#8212;&#8212;&#8212;&#8211;xyzzzzz&#8211; )</li>
<li>Notice <strong>name=&#8221;something&#8221;</strong>. This is an essential attribute. This is how the target server knows which item to extract from your response.</li>
<li>Content-Type is automatically determined for a Multi-Part item when it is a file upload. Based on extension, ZappySys automatically selects the most common content type. See the next section.</li>
</ul>
<p>&nbsp;</p><pre class="crayon-plain-tag">POST https://somecompany.com/downloads/files/test/uploadtest.aspx HTTP/1.1
User-Agent: ZappySysApp/1.0.2019.10822
x-custom-hdr: 69c05bf5b6ef48dbb73c55020c50e027
Content-Type: multipart/form-data; boundary=---------------------------WebKitFormBoundary55fd218185294c408e9ef21a4ac82825
Host: somecompany.com
Content-Length: 3619
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

-----------------------------WebKitFormBoundary55fd218185294c408e9ef21a4ac82825
Content-Disposition: form-data; name="File1"; filename="MultiPartFileUpload1.txt"
Content-Type: text/plain

A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----------------------------WebKitFormBoundary55fd218185294c408e9ef21a4ac82825
Content-Disposition: form-data; name="File2"; filename="MultiPartFileUpload2.txt"
Content-Type: text/plain

B00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----------------------------WebKitFormBoundary55fd218185294c408e9ef21a4ac82825
Content-Disposition: form-data; name="Extrafield1"

aaaa
-----------------------------WebKitFormBoundary55fd218185294c408e9ef21a4ac82825
Content-Disposition: form-data; name="Extrafield2"

bbbb
-----------------------------WebKitFormBoundary55fd218185294c408e9ef21a4ac82825
Content-Disposition: form-data; name="Extrafield3WithNewLine"

This is line1
This is line2 with tab	tab	tab
-----------------------------WebKitFormBoundary55fd218185294c408e9ef21a4ac82825
Content-Disposition: form-data; name="Extrafield3WithAt"

@MyTwitterHandle
-----------------------------WebKitFormBoundary55fd218185294c408e9ef21a4ac82825--</pre><p>
<h2>Known Issues</h2>
<p>Sometimes you may receive the following error if your server is expecting \r\n after the last Multi-Part boundary. <a href="https://zappysys.zendesk.com/hc/en-us/articles/360036068434" target="_blank" rel="noopener">Here is the fix</a> for this error.</p><pre class="crayon-plain-tag">The remote server returned an error: (500) Internal Server Error.
Response Url: https://your-host/api

Status Code: InternalServerError 

Response Body: {"Message":"An error has occurred."
,"ExceptionMessage":"Unexpected end of MIME multipart stream. MIME multipart message is not complete.","ExceptionType":"System.IO.IOException","StackTrace":" at System.Net.Http.Formatting.Parsers.MimeMultipartBodyPartParser.&lt;ParseBuffer&gt;d__0.MoveNext()\r\n at System.Net.Http.HttpContentMultipartExtensions.MoveNextPart(MultipartAsyncContext context)"
}</pre><p>
<h2>Most common extension and Content-Type</h2>
<p>In the multi-part upload, you might have noticed that ZappySys adds a content type for some file extensions. <a href="https://zappysys.zendesk.com/hc/en-us/articles/360034303774" target="_blank" rel="noopener">Here is a full list</a> of some common extensions and their content-type</p>
<h2>Conclusion</h2>
<p>If you need to perform REST API file upload or REST API integration without learning complex APIs or programming languages (e.g., Python, Java, C#), SSIS PowerPack provides a perfect way to integrate REST APIs with your existing system. You can uncover endless possibilities with a drag-and-drop approach that is not only simple to use but also offers many options for complex scenarios.</p>
<h2>Keywords</h2>
<p>How to perform rest api file upload | How to do RESTful file upload in C# | How to do multipart file upload without cURL | How to upload multiple files using HTTP multipart forms | Rest Client Upload File | C# REST API Upload File | Rest API Upload Image | Rest API Upload File</p>
<p>The post <a href="https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/">REST API File Upload using SSIS (Multi Part POST)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Calling Web API in SSIS with Authorization and Redirect</title>
		<link>https://zappysys.com/blog/pass-authorization-header-redirected-location/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 26 May 2016 17:15:38 +0000</pubDate>
				<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=537</guid>

					<description><![CDATA[<p>Introduction In some cases when you call API to http URL it may redirect you to different location (Also known as 301 or 302 redirect). Best example is when you type https://www.zappysys.com it will redirect you to https://zappysys.com. This can cause issue in some case if you are passing credentials (i.e. UserID / Password) because [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/pass-authorization-header-redirected-location/">Calling Web API in SSIS with Authorization and Redirect</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In some cases when you call API to http URL it may redirect you to different location (Also known as 301 or 302 redirect). Best example is when you type https://www.zappysys.com it will redirect you to https://zappysys.com. This can cause issue in some case if you are passing credentials (i.e. UserID / Password) because by default your credentials are not passed to redirected URL (This is security feature to avoid sending your credentials to different URL than you anticipated). So how to send Authorization to second URL if second URL expects same credentials too? Well not to worry&#8230; it&#8217;s just one extra step in that case. Lets see how to do that.</p>
<h2>Pass Authorization to 301 / 302 Redirect URL</h2>
<p>Assume that you have to call below API URL which requires <a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/" target="_blank" rel="noopener">Basic Authentication (UserID/Password)</a> and it also redirects to some other URL which also needs same credentials. For this purpose we need to mainly perform below important changes.</p><pre class="crayon-plain-tag">http://httpbin.org/redirect-to?url=http%3A%2F%2Fexample.com%2F</pre><p>
<ol>
<li>First drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS Control Flow Toolbox</li>
<li>Change Url mode to URL from connection. Click New Connection.</li>
<li>Configure your connection with API Url, UrserID and Password as below. Click OK to save connection.
<div id="attachment_2340" style="width: 907px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-301-302-redirect-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2340" class="size-full wp-image-2340" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-301-302-redirect-example.png" alt="SSIS REST API Example - Call with 301 / 302 Redirect " width="897" height="713" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-301-302-redirect-example.png 897w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-301-302-redirect-example-300x238.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-301-302-redirect-example-768x610.png 768w" sizes="(max-width: 897px) 100vw, 897px" /></a><p id="caption-attachment-2340" class="wp-caption-text">SSIS REST API Example &#8211; Call with 301 / 302 Redirect</p></div></li>
<li>Now go to Advanced Tab and Check Prevent 301 redirect option
<div id="attachment_2341" style="width: 544px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-prevent-301-302-redirect.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2341" class="size-full wp-image-2341" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-prevent-301-302-redirect.png" alt="SSIS REST API Task - Disable automatic redirect option" width="534" height="373" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-prevent-301-302-redirect.png 534w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-prevent-301-302-redirect-300x210.png 300w" sizes="(max-width: 534px) 100vw, 534px" /></a><p id="caption-attachment-2341" class="wp-caption-text">SSIS REST API Task &#8211; Disable automatic redirect option</p></div></li>
<li>Now go to Response Settings Tab and Map Location Header as below (Assuming you have created SSIS Variable named NewLocation (string type) )
<div id="attachment_2342" style="width: 785px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-api-call-save-response-header-capture-redirect-location-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2342" class="size-full wp-image-2342" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-api-call-save-response-header-capture-redirect-location-example.png" alt="SSIS REST API Task - Map response header to SSIS Variable" width="775" height="711" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-api-call-save-response-header-capture-redirect-location-example.png 775w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-api-call-save-response-header-capture-redirect-location-example-300x275.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-api-call-save-response-header-capture-redirect-location-example-768x705.png 768w" sizes="(max-width: 775px) 100vw, 775px" /></a><p id="caption-attachment-2342" class="wp-caption-text">SSIS REST API Task &#8211; Map response header to SSIS Variable</p></div></li>
<li>Click OK to save.</li>
</ol>
<h2>Call API URL from URL</h2>
<ol>
<li>Now drag another <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS Control Flow Toolbox</li>
<li>Change Url mode to URL from connection. Select connection created in previous section.</li>
<li>Now configure your Url as below so we read it from Variable.
<div id="attachment_2343" style="width: 981px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-url-from-variable-pass-userid-password.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2343" class="size-full wp-image-2343" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-url-from-variable-pass-userid-password.png" alt="SSIS REST API Task - Calling API URL from SSIS Variable " width="971" height="700" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-url-from-variable-pass-userid-password.png 971w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-url-from-variable-pass-userid-password-300x216.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-url-from-variable-pass-userid-password-768x554.png 768w" sizes="(max-width: 971px) 100vw, 971px" /></a><p id="caption-attachment-2343" class="wp-caption-text">SSIS REST API Task &#8211; Calling API URL from SSIS Variable</p></div></li>
<li>That&#8217;s it Save the task and run package.</li>
</ol>
<h2>Debug Web API call using Fiddler</h2>
<p>To test how things looking behind the scene we strongly suggest to use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">tool like  fiddler</a>.</p>
<p>See how Fiddler shows 302 Status code for First API call and see how it passes Authorization (UserID/Password). You can also test Just first task without [Prevent 301/302 redirect] option see what happens]
<div id="attachment_2344" style="width: 1297px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2344" class="size-full wp-image-2344" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png" alt="Debugging Web API call using Fiddler in SSIS" width="1287" height="564" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png 1287w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-300x131.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-768x337.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-1024x449.png 1024w" sizes="(max-width: 1287px) 100vw, 1287px" /></a><p id="caption-attachment-2344" class="wp-caption-text">Debugging Web API call using Fiddler in SSIS</p></div>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/pass-authorization-header-redirected-location/">Calling Web API in SSIS with Authorization and Redirect</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
