<?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 xml source Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/ssis-xml-source/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/ssis-xml-source/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 11 Mar 2026 07:08:08 +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 xml source Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/ssis-xml-source/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to read large XML / JSON file in SSIS (3 Million Rows in 3 Mins)</title>
		<link>https://zappysys.com/blog/read-large-xml-json-file-ssis-fast-process-million-rows/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 08 Jan 2018 16:55:09 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[performance tips]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[ssis xml source]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2467</guid>

					<description><![CDATA[<p>Introduction In this post we will learn how to use ZappySys SSIS XML Source or ZappySys SSIS JSON Source  to read large XML or JSON File (Process 3 Million rows in 3 minutes &#8211; 1.2 GB file). If you use default settings to read data then it may result into OutOfMemory Exception so we will outline [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-large-xml-json-file-ssis-fast-process-million-rows/">How to read large XML / JSON file in SSIS (3 Million Rows in 3 Mins)</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 we will learn how to use <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys SSIS XML Source</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys SSIS JSON Source</a>  to read large XML or JSON File (Process 3 Million rows in 3 minutes &#8211; 1.2 GB file).</p>
<p>If you use default settings to read data then it may result into OutOfMemory Exception so we will outline few techniques which will enable high performance Streaming Mode rather than In-memory load of entire file.</p>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we parse very large XML or JSON files using SSIS , you will need to make sure following prerequisites are met.</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>You have at least two sample files&#8230; One file must be small dataset (less than 10 MB if possible). We will  use small dataset file during design mode to get metadata and see data preview on the Component UI.</li>
<li>Second XML file is the big file with full dataset you like to parse at runtime.</li>
<li>Make sure <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>SSIS PowerPack</em></a> is installed. <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">Click here to download</a>.</li>
</ol>
<p>&nbsp;</p>
<h2>Step-By-Step : Reading large XML file (SSIS XML Source)</h2>
<p>Now let&#8217;s look at how to read large XML file (e.g. 3 Million rows or more) using <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys XML Source</a> in SSIS. Below steps are identical for  <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON Source</a>  too (Except Step#7).</p>
<ol>
<li>Open SSIS Designer and drag Data Flow from SSIS Toolbox</li>
<li>Double click Data Flow Task to switch to Data flow designer</li>
<li>Now drag ZS XML Source on the surface from SSIS Toolbox.</li>
<li>Double click ZS XML Source and specify <pre class="crayon-plain-tag">small dataset file</pre>  path you like to parse. (e.g.  c:\data\customer_small.xml )</li>
<li>Click on Select Filter button to find Node which will be treated as Array. Once you close the Filter Browse Dialog. Append <pre class="crayon-plain-tag">--FAST</pre>  Your Expression may look like below.<br />
<pre class="crayon-plain-tag">$.Root.Row--FAST</pre></li>
<li>Now <strong>uncheck  </strong> <pre class="crayon-plain-tag">Include Parent Columns option</pre></li>
<li><strong>Check </strong><pre class="crayon-plain-tag">Enable Performance Option</pre><strong><strong><strong>  (For JSON Source Skip this step)</strong></strong></strong><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: Try to enable Performance mode setting after you Select Filter (by using smaller dataset file). Once filter is set you can check enable performance mode and make sure following two settings are correctly set (Option#2 needs new version &#8211; SSIS v4.1+ / ODBC v1.4+).<br />
(1) On <strong>Array Handling Tab</strong> &#8211; Set Array node name (must be <strong>only one entry</strong>). For example your Filter is $.DATA.ORDER[*] then you can enter <pre class="crayon-plain-tag">ORDER</pre>
(2) On <strong>Advanced Filter Options Tab</strong> &#8211; Enter all unwanted Tag names you like to Skip. For example if you have other arrays like PRODUCT or CUSTOMER then enter <pre class="crayon-plain-tag">PRODUCT,CUSTOMER</pre>
</div></div><strong><strong><br />
</strong></strong></li>
<li>Your setting may look like below<br />
<strong><strong><br />
</strong></strong></p>
<div id="attachment_2472" style="width: 1006px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-2472" class="size-full wp-image-2472" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode.png" alt="Configure XML source or JSON Source for Very Large Data File (Streaming mode for High Performance)" width="996" height="708" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode.png 996w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode-300x213.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-json-xml-file-parse-stream-mode-768x546.png 768w" sizes="(max-width: 996px) 100vw, 996px" /></a><p id="caption-attachment-2472" class="wp-caption-text">Configure XML source or JSON Source for Very Large Data File (Streaming mode for High Performance)</p></div></li>
<li>Click Preview to verify data (Adjust Filter if needed to extract correct Hierarchy)
<div id="attachment_2473" style="width: 667px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-preview-sample-xml-json-data.png"><img decoding="async" aria-describedby="caption-attachment-2473" class="size-full wp-image-2473" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-preview-sample-xml-json-data.png" alt="Preview XML or JSON File data using SSIS XML Source or JSON Source" width="657" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-preview-sample-xml-json-data.png 657w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-preview-sample-xml-json-data-300x176.png 300w" sizes="(max-width: 657px) 100vw, 657px" /></a><p id="caption-attachment-2473" class="wp-caption-text">Preview XML or JSON File data using SSIS XML Source or JSON Source</p></div></li>
<li>Click on Columns Tab</li>
<li>Change Scan Row count to 3000 or more and Click on <pre class="crayon-plain-tag">Refresh Column</pre> .</li>
<li>Select Guess 4x , Check Lock, Check Reset and Click OK like below. At runtime if you ever get error about Data Type Issue you can always adjust this later on too. Make sure Lock column is set to avoid setting reset for manually changed columns. For more information on metadata changes <a href="https://zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">check this article</a>
<div id="attachment_2470" style="width: 987px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing.png"><img decoding="async" aria-describedby="caption-attachment-2470" class="size-full wp-image-2470" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing.png" alt="SSIS Metadata Options - JSON / XML File Parsing" width="977" height="661" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing.png 977w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing-300x203.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-metadata-scan-options-xml-json-parsing-768x520.png 768w" sizes="(max-width: 977px) 100vw, 977px" /></a><p id="caption-attachment-2470" class="wp-caption-text">SSIS Metadata Options &#8211; JSON / XML File Parsing</p></div></li>
<li>Click OK to save settings.</li>
<li>Now Right click on XML Component &gt; Click Properties. Change <pre class="crayon-plain-tag">DirectPath</pre>  property to original file path (large file) (e.g. <pre class="crayon-plain-tag">c:\data\customers_large.xml</pre>  ). Save Package.</li>
<li>Now you can run your SSIS Package from Designer or Command line. As you see in the below screenshot that there is virtually no memory pressure when you enable stream mode. Thanks to ZappySys unique XML / JSON Parsing Engine. When streaming mode is enabled file is not loaded into memory for parsing rather than that it only reads record by record to process very large JSON or XML file.In our below example we used <strong>Windows 7 Desktop, 16GB RAM, 4 Core i7 64 bit CPU</strong>. It took around <pre class="crayon-plain-tag">3 Minutes to Parse 3 Million Records (1.2 GB big XML file)</pre> . If you Parse JSON file then it can be even faster due to compact size.
<div id="attachment_2471" style="width: 1048px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2471" class="size-full wp-image-2471" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example.png" alt="Reading Very Large XML or JSON File using SSIS (Stream Mode for High Performance)" width="1038" height="696" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example.png 1038w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example-300x201.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example-768x515.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example-1024x687.png 1024w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-read-very-large-xml-json-file-example-272x182.png 272w" sizes="(max-width: 1038px) 100vw, 1038px" /></a><p id="caption-attachment-2471" class="wp-caption-text">Reading Very Large XML or JSON File using SSIS (Stream Mode for High Performance)</p></div></li>
</ol>
<h2>Step-By-Step : Reading very large JSON file (SSIS JSON Source)</h2>
<p>Reading very large JSON file using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON Source</a>  has exact same steps described in above section except two changes. You have to use ZS JSON Source and skip Step#7 (Check Enable Performance Mode &#8211; This option is not available JSON Source).</p>
<h2>Parsing very large XML File with Multiple Arrays</h2>
<p>Now let&#8217;s discuss a scenario which can result in OutOfMemory Exception unless you tweak some extra options. Assume you have file structure like below.<br />
NOTE: This will only work in version <strong>4.1.0</strong> or later (in SSIS PowerPack) or <strong>1.4.0</strong> or later for ODBC PowerPack</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Data&gt;
	&lt;Product&gt;....&lt;Product&gt;
	&lt;Product&gt;....&lt;Product&gt;
	.... many more....
	&lt;Product&gt;....&lt;Product&gt;
	
	&lt;Customer&gt;....&lt;Customer&gt;
	&lt;Customer&gt;....&lt;Customer&gt;
	.... many more....
	&lt;Customer&gt;....&lt;Customer&gt;
	
	&lt;Row&gt;....&lt;Row&gt;
	&lt;Row&gt;....&lt;Row&gt;
	.... many more....
	&lt;Row&gt;....&lt;Row&gt;
&lt;/Data&gt;</pre><p>
Notice that in above XML it has 3 different nodes (For Product, Customer and Order). If you try to extract Orders it might fail with OutOfMemory Exception because it needs to scan large XML before it can hit First Order node. To solve this issue you can adjust following 2 settings.</p>
<ol>
<li>On Array Handling Tab you have following<br />
<pre class="crayon-plain-tag">Row</pre>
</li>
<li>On Advanced Filter Options tab enter Following two nodes which we dont want to extract.<br />
<pre class="crayon-plain-tag">Product,Customer</pre>
</li>
</ol>
<p>Thats it. This will avoid excessive Memory pressure to find very first node before it can start Stream.</p>
<div id="attachment_9286" style="width: 453px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-array-extract.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9286" class="size-full wp-image-9286" src="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-array-extract.png" alt="Parse XML Array - Performance Mode Setting" width="443" height="150" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-array-extract.png 443w, https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-array-extract-300x102.png 300w" sizes="(max-width: 443px) 100vw, 443px" /></a><p id="caption-attachment-9286" class="wp-caption-text">Parse XML Array &#8211; Performance Mode Setting</p></div>
<p>&nbsp;</p>
<div id="attachment_9287" style="width: 680px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-exclude-nodes-by-name.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9287" class="size-full wp-image-9287" src="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-exclude-nodes-by-name.png" alt="Parse Large XML - Exclude nodes by name" width="670" height="149" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-exclude-nodes-by-name.png 670w, https://zappysys.com/blog/wp-content/uploads/2018/01/xml-parse-exclude-nodes-by-name-300x67.png 300w" sizes="(max-width: 670px) 100vw, 670px" /></a><p id="caption-attachment-9287" class="wp-caption-text">Parse Large XML &#8211; Exclude nodes by name</p></div>
<h2>Conclusion</h2>
<p>As you saw in this article that ZappySys SSIS PowerPack is designed to handle very large dataset in JSON or XML. We also support very large CSV and Excel files too which are not covered in this article. <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Download SSIS PowerPack</a> to explore 70+ more components by yourself to make your ETL simple and Fast.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/read-large-xml-json-file-ssis-fast-process-million-rows/">How to read large XML / JSON file in SSIS (3 Million Rows in 3 Mins)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<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 loading="lazy" 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 loading="lazy" 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>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>How to call Amazon MWS API using SSIS</title>
		<link>https://zappysys.com/blog/call-amazon-mws-api-using-ssis-marketplace-web-service/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 15 Oct 2016 04:42:21 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS CSV Source]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[Amazon MWS]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[looping]]></category>
		<category><![CDATA[paging]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis xml source]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=822</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to call Amazon MWS API (Amazon Marketplace Web Service) or Amazon Product Advertising API using SSIS PowerPack. Using drag and drop approach you can consume data from Amazon MWS XML Web service. In this post we will use ZappySys XML Source connector to read data from Amazon MWS [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/call-amazon-mws-api-using-ssis-marketplace-web-service/">How to call Amazon MWS 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:#e2dec9;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:#fcf8e3;border-color:#ffffff;color:#8a6d3b;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">
<strong><span style="vertical-align: text-bottom;font-size: 0.86em;">⚠️</span> Deprecation Notice: MWS API is deprecated</strong><br />
Amazon&#8217;s MWS (Marketplace Web Service) is being deprecated and <strong>replaced by the newer AWS Selling Partner API (SP-API).</strong> For a more robust and secure integration, we <strong>recommend</strong> using our <strong><a href="/api/integration-hub/amazon-selling-partner-connector/">AWS Selling Partner (SP-API) Connector</a>.</strong> As Amazon is phasing out MWS functionality and eventually plans to fully deprecate it.<br />
</div></div>
<p><a href="//zappysys.com/blog/wp-content/uploads/2016/10/amazon-mws-api-integration.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1632" src="//zappysys.com/blog/wp-content/uploads/2016/10/amazon-mws-api-integration.png" alt="" width="120" height="120" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/amazon-mws-api-integration.png 505w, https://zappysys.com/blog/wp-content/uploads/2016/10/amazon-mws-api-integration-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2016/10/amazon-mws-api-integration-300x300.png 300w" sizes="(max-width: 120px) 100vw, 120px" /></a>In this post you will learn how to <em>call Amazon MWS API</em> (<a href="https://developer.amazonservices.com/" target="_blank" rel="noopener">Amazon Marketplace Web Service</a>) or <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/GSG/Welcome.html" target="_blank" rel="noopener">Amazon Product Advertising API</a> 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 Amazon MWS XML Web service.</em> In this post we will use <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys XML Source connector</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>Prerequisites</h2>
<p>This post assumes following things</p>
<ol>
<li>Basic knowledge of SSIS and XML format.</li>
<li>Amazon MWS Account and and valid AWSAccessKeyId and Secret Key to call Amazon MWS API <a href="https://zappysys.com/blog/import-amazon-mws-data-power-bi/#Obtain_MWS_API_Access_Key_Secret_and_Seller_ID" target="_blank" rel="noopener">(How to obtain Key / Secret and SellerId ? )</a>.</li>
<li>You have tested few API calls using <a href="https://mws.amazonservices.com/scratchpad/index.html" target="_blank" rel="noopener">Amazon MWS Scratchpad</a> this will give you idea about various API you can call and parameters you need to pass.</li>
</ol>
<h2>Testing MWS Requests using ScratchPad</h2>
<p>Very first step we recommend before you call MWS API in SSIS is to get familiar with <a href="https://mws.amazonservices.com/scratchpad/index.html" target="_blank" rel="noopener">Amazon MWS Scratchpad</a> tool. Check this article for <a href="https://zappysys.com/blog/import-amazon-mws-data-power-bi/#About_Amazon_MWS_API">detailed steps</a>.  You can also use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/">Fiddler</a> to debug some requests.</p>
<div id="attachment_4847" style="width: 933px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/amazon-mws-api-response-scratchpad-listmatchingproducts-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4847" class="size-full wp-image-4847" src="https://zappysys.com/blog/wp-content/uploads/2018/09/amazon-mws-api-response-scratchpad-listmatchingproducts-example.png" alt="Calling Amazon MWS API in Scratchpad Testing Tool (Response Details Tab) - ListMatchingProducts Example" width="923" height="527" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/amazon-mws-api-response-scratchpad-listmatchingproducts-example.png 923w, https://zappysys.com/blog/wp-content/uploads/2018/09/amazon-mws-api-response-scratchpad-listmatchingproducts-example-300x171.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/amazon-mws-api-response-scratchpad-listmatchingproducts-example-768x439.png 768w" sizes="(max-width: 923px) 100vw, 923px" /></a><p id="caption-attachment-4847" class="wp-caption-text">Calling Amazon MWS API in Scratchpad Testing Tool (Response Details Tab) &#8211; ListMatchingProducts Example</p></div>
<h2>Call Amazon MWS API using SSIS</h2>
<p>To consume data from any XML Source (File, SOAP Web Service or XML API) you can use  <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys XML Source<br />
connector.</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 Amazon MWS API and save output into 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://mws.amazonservices.com/Orders/2013-09-01</pre>
In above URL<br />
** mws.amazonservices.com =&gt; This is your endpoint. If you are not in USA then <a href="http://docs.developer.amazonservices.com/en_UK/dev_guide/DG_Endpoints.html" target="_blank" rel="noopener">Click here</a> to find correct endpoint<br />
** /Orders =&gt; That&#8217;s your API you want to call<br />
** /2013-09-01 =&gt; That&#8217;s your API version (You have to add this same version in your POST Body too (see next section).</li>
<li>In Select Url Connection dropdown select New OAUTH connection option.</li>
<li>When prompted on OAuth connection UI select Provider=Amazon MWS, Enter AWSAccessKey and Secret key and Click OK (If you have MWSAuthToken then enter in Access Token field else leave it empty). Do not test because it may not work yet.
<div id="attachment_825" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-api-marketplace-web-service-connection-manager.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-825" class="size-full wp-image-825" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-api-marketplace-web-service-connection-manager.png" alt="SSIS OAuth Connection - Call Amazon MWS API (Marketplace Web service API) " width="675" height="475" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-api-marketplace-web-service-connection-manager.png 675w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-api-marketplace-web-service-connection-manager-300x211.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-825" class="wp-caption-text">SSIS OAuth Connection &#8211; Call Amazon MWS API (Marketplace Web service API)</p></div></li>
<li>Another Setting you may turn on is Retry Handling. This allows to over come ThresholdLimitReached error when we <a href="https://docs.developer.amazonservices.com/en_UK/dev_guide/DG_Throttling.html" target="_blank" rel="noopener">call API too fast</a>.
<div id="attachment_7156" style="width: 599px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/http-retry-settings-oauth-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7156" class="size-full wp-image-7156" src="https://zappysys.com/blog/wp-content/uploads/2018/09/http-retry-settings-oauth-connection.png" alt="Retry Options" width="589" height="429" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/http-retry-settings-oauth-connection.png 589w, https://zappysys.com/blog/wp-content/uploads/2018/09/http-retry-settings-oauth-connection-300x219.png 300w" sizes="(max-width: 589px) 100vw, 589px" /></a><p id="caption-attachment-7156" class="wp-caption-text">Retry Options</p></div></li>
<li>Now select Method=POST, and in the body enter following<br />
<pre class="crayon-plain-tag">Action=GetServiceStatus&amp;SellerId=A77XXXXXXX&amp;Version=2013-09-01</pre>
If your API requires pagination (more than 100 records from response) then refer next section (Sample Package). In the case of Pagination your second request may look like below<br />
<pre class="crayon-plain-tag">Action=YourActionNameWithNextToken&amp;SellerId=A77XXXXXXX&amp;Version=2013-09-01&amp;NextToken={{User::vNextToken,FUN_URLENC}}</pre>
<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> Enter all required parameters in the following format, as shown below. All values need to be URL-encoded. If you use SSIS variable, use it along with <strong>FUN_URLENC</strong> format specifier, e.g. <strong>{{User::myVariable,FUN_URLENC}}</strong>. If you use a hard-coded value, and not sure if it is URL-encoded, then encode it with the same <strong>FUN_URLENC</strong> format specifier/function, e.g. <strong>&lt;&lt;myValue,FUN_URLENC&gt;&gt;</strong>. Always check if SSIS configuration matches the one you see in <em>MWS ScratchPad Request</em> <em>Details</em>.<br />
<strong>Format:</strong><br />
<code>param1=value1&amp;param2=&lt;&lt;value2,FUN_URLENC&gt;&gt;&amp;param3={{User::myVar,FUN_URLENC}}</code></div></div></li>
<li>Now click Test and see content in the Preview window.
<div id="attachment_826" style="width: 786px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-amazon-mws-api-marketplace-webservice-use-rest-api-task.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-826" class="size-full wp-image-826" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-amazon-mws-api-marketplace-webservice-use-rest-api-task.png" alt="SSIS REST API Task - Call Amazon MWS API - Get XML data save into SSIS variable" width="776" height="652" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-amazon-mws-api-marketplace-webservice-use-rest-api-task.png 776w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-amazon-mws-api-marketplace-webservice-use-rest-api-task-300x252.png 300w" sizes="(max-width: 776px) 100vw, 776px" /></a><p id="caption-attachment-826" class="wp-caption-text">SSIS REST API Task &#8211; Call Amazon MWS API &#8211; Get XML data save into SSIS variable</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>Amazon MWS API Pagination</h2>
<p>Many Amazon MWS API calls by default don&#8217;t return all records (Explained <a href="https://docs.developer.amazonservices.com/en_US/dev_guide/DG_NextToken.html" target="_blank" rel="noopener">here</a>). Rather than returning all rows you may get partial response (e.g. Max 50 or 100 rows). If you want to get all records then you have to use NextToken  found in your XML. For API which requires pagination, in that case your POST body may be different for 2nd or higher requests. Notice how we changed Action and appended NextToken=xxxxxxxxxxx in the second request. Also notice we used encoded token (URL encoded). This is very important because as per Amazon Specs this value has to be Url Encoded.</p>
<p>We also documented similar use case of <a href="https://zappysys.com/blog/import-amazon-mws-data-power-bi/#Using_Pagination_in_Amazon_MWS_API_calls" target="_blank" rel="noopener">Amazon MWS Pagination for Power BI (Check this one)</a> its mostly same setup except 2-3 properties might be named different way.</p>
<p>Now lets look at sample request / response for paginated MWS requests (For clarity we have removed many common Parameters which are automatically added at runtime e.g. Signature, Timestamp). We use <a href="https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_ListOrders.html" target="_blank" rel="noopener">ListOrders</a> (First Request) and <a href="https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_ListOrdersByNextToken.html" target="_blank" rel="noopener">ListOrderByNextToken</a> (Second+ requests)</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: Most of Amazon MWS API calls are heavily throttled means you cannot call more than X calls per minute or hour. So Refer to <a href="https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Throttling.html" target="_blank" rel="noopener">Throttling Limits</a> for each API Endpoint.</div></div>
<p><strong>First Request</strong></p><pre class="crayon-plain-tag">POST https://mws.amazonservices.com/Orders/2013-09-01

Action=ListOrders&amp;SellerId=A10zzzzzzz&amp;CreatedAfter=2018-09-01T04%3A00%3A00Z</pre><p>
<strong>First Response</strong></p><pre class="crayon-plain-tag">&lt;?xml version="1.0"?&gt;
&lt;ListOrdersResponse xmlns="https://mws.amazonservices.com/
    Orders/2013-09-01"&gt;
    &lt;ListOrdersResult&gt;
        &lt;NextToken&gt;2YgYW55IxxxxxxxxxxxxVyZS4=&lt;/NextToken&gt;
        &lt;LastUpdatedBefore&gt;2017-02-25T18%3A10%3A21.687Z&lt;/LastUpdatedBefore&gt;
        &lt;Orders&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
        &lt;/Orders&gt;
    &lt;/ListOrdersResult&gt;
&lt;/ListOrdersResponse&gt;</pre><p>
&nbsp;</p>
<p><strong>Second Request or higher (MWS API with Pagination using NextToken)</strong></p><pre class="crayon-plain-tag">POST https://mws.amazonservices.com/Orders/2013-09-01

Action=ListOrdersByNextToken&amp;SellerId=A10zzzzzzz&amp;CreatedAfter=2018-09-01T04%3A00%3A00Z&amp;NextToken=YOUR_ENCODED_TOKEN_FROM_PREV_REQUEST</pre><p>
<strong>Second or higher Response</strong></p><pre class="crayon-plain-tag">&lt;?xml version="1.0"?&gt;
&lt;ListOrdersByNextTokenResponse xmlns="https://mws.amazonservices.com/
    Orders/2013-09-01"&gt;
    &lt;ListOrdersByNextTokenResult&gt;
        &lt;NextToken&gt;2YgYW55IxxxxxxxxxxxxVyZS4=&lt;/NextToken&gt;
        &lt;LastUpdatedBefore&gt;2017-02-25T18%3A10%3A21.687Z&lt;/LastUpdatedBefore&gt;
        &lt;Orders&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
        &lt;/Orders&gt;
    &lt;/ListOrdersResult&gt;
&lt;/ListOrdersResponse&gt;</pre><p>
<h3>Sample SSIS Package</h3>
<p>If you want to see complete working package for pagination pattern then <a href="https://zappysys.com/blog/wp-content/uploads/2016/10/Amazon_MWS_API_With_LoopEasy_2012.zip" target="_blank" rel="noopener">download from here</a>. Change AccessKey, SecretKey, SellerID and Path as needed to make this package work.</p>
<p>Here is the screenshot of example SSIS package for Amazon MWS.</p>
<div id="attachment_7144" style="width: 641px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-api-pagination-example-listorders-nexttoken.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7144" class="size-full wp-image-7144" src="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-api-pagination-example-listorders-nexttoken.png" alt="Amazon MWS APi Pagination (ListOrders , ListOrdersByNextToken Example)" width="631" height="761" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-api-pagination-example-listorders-nexttoken.png 631w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-api-pagination-example-listorders-nexttoken-249x300.png 249w" sizes="(max-width: 631px) 100vw, 631px" /></a><p id="caption-attachment-7144" class="wp-caption-text">Amazon MWS APi Pagination (ListOrders , ListOrdersByNextToken Example)</p></div>
<p>&nbsp;</p>
<h3>Copy/Paste Properties</h3>
<p>Here is copy/paste values for properties listed above.</p><pre class="crayon-plain-tag">DirectPath:  https://mws.amazonservices.com/Orders/2013-09-01
EnablePageTokenForBody: True
Filter:  $.ListOrders[$tag$]Response.ListOrders[$tag$]Result.Orders.Order[*]
HasDifferentNextPageInfo: True
HttpRequestData:  Action=ListOrders[$tag$]&amp;SellerId=A1xxxxxxxx&amp;CreatedAfter=2018-09-01T04%3A00%3A00Z&amp;MarketplaceId.Id.1=ATVPDKIKX0DER
HttpRequestMethod:  POST
NextUrlAttribute: $.ListOrders[$tag$]Response.ListOrders[$tag$]Result.NextToken
NextUrlSuffix: &amp;NextToken=&lt;%nextlink_encoded%&gt;
NetUrlWait: 10000 (ms) -- slow down to avoid throttling ... Max 6 requests per minute, increase if you get API Limit Error
PagePlaceholders:  body=|ByNextToken;filter=|ByNextToken</pre><p>
&nbsp;</p>
<h3>Understanding Pagination Properties</h3>
<p>Here are various properties you have to set for Pagination.</p>
<div class="su-table su-table-alternate">
<table style="border-collapse: collapse;width: 100%;height: 154px" border="1">
<tbody>
<tr style="height: 22px">
<td style="width: 14.5161%;height: 22px">Property</td>
<td style="width: 85.4839%;height: 22px">Description</td>
</tr>
<tr style="height: 66px">
<td style="width: 14.5161%;height: 66px">Src</td>
<td style="width: 85.4839%;height: 66px">Change this to correct URL. Look at Scratchpad Response Details Tab and Findout first line after POST and before &#8220;?&#8221; . e.g. /Orders/2013-09-01  this will be used in your URL.<br />
<strong>Example: </strong><br />
https://mws.amazonservices.com/Orders/2013-09-01</td>
</tr>
<tr style="height: 22px">
<td style="width: 14.5161%;height: 22px">Body (i.e. RequestData)</td>
<td style="width: 85.4839%;height: 22px">Scratchpad shows HTTP POST section. You can copy that and remove  System supplied parameters and then arrange all in one line to form your Body for request.</p>
<p><strong>Example:</strong></p><pre class="crayon-plain-tag">POST /Orders/2013-09-01?AWSAccessKeyId=AKxxxxxxxxxx
  &amp;Action=ListOrders
  &amp;SellerId=A10zzzzzzz
  &amp;SignatureVersion=2
  &amp;Timestamp=2018-09-17T21%3A35%3A57Z
  &amp;Version=2013-09-01
  &amp;Signature=3GigipfRsQgzzzzzzzzzzzzzs%3D
  &amp;SignatureMethod=HmacSHA256</pre><p>
Above HTTP POST can be used as below for your Body in ZappySys Driver. Rest of the parameters are automatically supplied by system. See special placeholder named [$tag$] this gets replaced at runtime when you set <strong>EnablePageTokenForBody=True</strong> and <strong>HasDifferentNextPageInfo=True</strong></p><pre class="crayon-plain-tag">Action=ListOrders[$tag$]&amp;SellerId=A10zzzzzzz&amp;CreatedAfter=2018-09-01T04%3A00%3A00Z</pre><p>
</td>
</tr>
<tr style="height: 22px">
<td style="width: 14.5161%;height: 22px">Filter</td>
<td style="width: 85.4839%;height: 22px">Change this parameter according to XML structure in the response.<br />
For example: If you see below response (first xml) in Scratchpad then your Filter will be<br />
<strong>$.ListOrdersResponse.ListOrdersResult.Orders.Order[*]</strong><br />
to enable pagination refer to <a href="https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_ListOrdersByNextToken.html" target="_blank" rel="noopener">Sample listed here</a> (click Example response at the bottom of that page). In second response and onwards your Filter should be below (See Bold Part).<br />
$ListOrders<strong>ByNextToken</strong>Response.ListOrders<strong>ByNextToken</strong>Result.Orders.Order[*]However in Driver we <strong>replace ByNextToken</strong> with <strong>[$tag$]</strong>. Like below. Using [$tag$] will automatically pick up the correct filter based on page number. You must set HasDifferentNextPageInfo=True to use [$tag$] feature.<strong>$.ListOrders[$tag$]Response.ListOrders[$tag$]Result.Orders.Order[*]</strong>Example of <strong>first page response</strong></p><pre class="crayon-plain-tag">&lt;?xml version="1.0"?&gt;
&lt;ListOrdersResponse xmlns="https://mws.amazonservices.com/
    Orders/2013-09-01"&gt;
    &lt;ListOrdersResult&gt;
        &lt;NextToken&gt;2YgYW55IxxxxxxxxxxxxVyZS4=&lt;/NextToken&gt;
        &lt;LastUpdatedBefore&gt;2017-02-25T18%3A10%3A21.687Z&lt;/LastUpdatedBefore&gt;
        &lt;Orders&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
        &lt;/Orders&gt;
    &lt;/ListOrdersResult&gt;
&lt;/ListOrdersResponse&gt;</pre><p>
Example of <strong>next page response</strong></p><pre class="crayon-plain-tag">&lt;?xml version="1.0"?&gt;
&lt;ListOrdersByNextTokenResponse xmlns="https://mws.amazonservices.com/
    Orders/2013-09-01"&gt;
    &lt;ListOrdersByNextTokenResult&gt;
        &lt;NextToken&gt;2YgYW55IxxxxxxxxxxxxVyZS4=&lt;/NextToken&gt;
        &lt;LastUpdatedBefore&gt;2017-02-25T18%3A10%3A21.687Z&lt;/LastUpdatedBefore&gt;
        &lt;Orders&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
            &lt;Order&gt; ....... &lt;/Order&gt;
        &lt;/Orders&gt;
    &lt;/ListOrdersResult&gt;
&lt;/ListOrdersResponse&gt;</pre><p>
</td>
</tr>
<tr style="height: 22px">
<td style="width: 14.5161%;height: 22px">NextUrlAttribute</td>
<td style="width: 85.4839%;height: 22px">This property defines which attributes indicate Token for next page. You can use this token in Body of next request (see NextUrlSuffix and EnablePageTokenForBody). You must set <strong>EnablePageTokenForBody=true</strong> to use Extracted token in Body.</td>
</tr>
<tr>
<td style="width: 14.5161%">StopIndicatorAttribute</td>
<td style="width: 85.4839%">Some APIs like  <a href="https://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestList.html">GetReportRequestList</a> stop pagination based on <strong>HasNext</strong> attribute value. (ListOrders doesnt need this property to be set). Use this property to extract HasNext from response by supplying correct Filter expression. You also need to set NextUrlEndIndicator property which defines static value which indicates the last page. Example properties as below.</p><pre class="crayon-plain-tag">NextUrlEndIndicator=false
StopIndicatorAttributeOrExpr= $.GetReportRequestList[$tag$]Response.GetReportRequestList[$tag$]Result.HasNext</pre><p>
</td>
</tr>
<tr>
<td style="width: 14.5161%">NextUrlSuffix</td>
<td style="width: 85.4839%">This is used to create a string for NextToken attribute for next page request. If you want to just append extracted token to Body then you dont have to set this but in our case, we have to use &amp;NextToken=EncodedValueOfExtractedToken so we have used <strong>&amp;NextToken=&lt;%nextlink_encoded%&gt;</strong> expression.</td>
</tr>
<tr>
<td style="width: 14.5161%">PagePlaceholders</td>
<td style="width: 85.4839%">This property contains [$tag$] values for first page and next pages. You can define tags for filter, body or header. Each pair must be pipe delimited. First value or pair is [$tag$]  for first request and second value of the pair is [$tag$] for any next request afterwards. Our first request use blank value for [$tag$].<br />
Example:  <strong>PagePlaceholders=&#8217;body=|ByNextToken;filter=|ByNextToken&#8217;</strong></td>
</tr>
<tr>
<td style="width: 14.5161%">HasDifferentNextPageInfo</td>
<td style="width: 85.4839%">Set to True &#8211; This enables use of [$tag$] inside body, filter, headers to use different values of first request and second onwards requests.</td>
</tr>
<tr>
<td style="width: 14.5161%">EnablePageTokenForBody</td>
<td style="width: 85.4839%">Set to True &#8211; This appends value extracted from <strong>NextUrlSuffix</strong> inside body (e.g. NextToken).</td>
</tr>
</tbody>
</table>
</div>
<h2>Amazon MWS API Pagination (For Old Version)</h2>
<p>So in previous section we saw how to achieve pagination in one step (for newer version of SSIS PowerPack). But there will be a case you cannot use latest SSIS PowerPack or you want to take complete control on each aspect of pagination. In such case use below method (Depreciated).  In newer version we added many new properties so you dont have to do Loop pattern like below.</p>
<h3>Sample SSIS Package</h3>
<p>If you want to see complete working package for pagination pattern then <a href="//zappysys.com/blog/wp-content/uploads/2016/11/SSIS_Amazon_MWS_API_With_Loop_Example.zip" target="_blank" rel="noopener">download from here</a>. Change AccessKey, SecretKey, SellerID and Path as needed to make this package work.</p>
<p>Here is the screenshot of example SSIS package for Amazon MWS.</p>
<div id="attachment_893" style="width: 730px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/read-amazon-mws-web-api-paginate-nexttoken-load-to-sql-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-893" class="wp-image-893 size-large" src="//zappysys.com/blog/wp-content/uploads/2016/10/read-amazon-mws-web-api-paginate-nexttoken-load-to-sql-server-1024x671.png" alt="SSIS Example Package - Read data from Amazon MWS Web service (API Call). Paginate API calls using NextToken" width="720" height="472" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/read-amazon-mws-web-api-paginate-nexttoken-load-to-sql-server-1024x671.png 1024w, https://zappysys.com/blog/wp-content/uploads/2016/10/read-amazon-mws-web-api-paginate-nexttoken-load-to-sql-server-300x196.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/10/read-amazon-mws-web-api-paginate-nexttoken-load-to-sql-server.png 1040w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-893" class="wp-caption-text">SSIS Example Package &#8211; Read data from Amazon MWS Web service (API Call). Paginate API calls using NextToken</p></div>
<h2>Load Amazon MWS API data into SQL Server using SSIS</h2>
<p>In this section we will see how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys XML Source connector</a> to read data from Amazon MWS Web Service 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-xml-source/" target="_blank" rel="noopener">ZS XML Source</a> from SSIS Toolbox</li>
<li>Configure XML Source as below
<div id="attachment_827" style="width: 704px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-xml-source-read-from-amazon-mws-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-827" class="size-full wp-image-827" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-xml-source-read-from-amazon-mws-api.png" alt="SSIS XML Source - Read data from Amazon MWS API (Amazon Marketplace Web service call)" width="694" height="683" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-xml-source-read-from-amazon-mws-api.png 694w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-xml-source-read-from-amazon-mws-api-300x295.png 300w" sizes="(max-width: 694px) 100vw, 694px" /></a><p id="caption-attachment-827" class="wp-caption-text">SSIS XML Source &#8211; Read data from Amazon MWS API (Amazon Marketplace Web service call)</p></div></li>
<li>Drag OLEDB destination from SSIS Toolbox.</li>
<li>Connect XML Source to OLEDB Destination and map input column to target table</li>
<li>Execute dataflow
<div id="attachment_828" style="width: 791px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-get-data-from-amazon-mws-web-service-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-828" class="size-full wp-image-828" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-get-data-from-amazon-mws-web-service-call.png" alt="Get data from Amazon MWS API - Save to File or SQL Server using SSIS" width="781" height="314" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-get-data-from-amazon-mws-web-service-call.png 781w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-get-data-from-amazon-mws-web-service-call-300x121.png 300w" sizes="(max-width: 781px) 100vw, 781px" /></a><p id="caption-attachment-828" class="wp-caption-text">Get data from Amazon MWS API &#8211; Save to File or SQL Server using SSIS</p></div></li>
</ol>
<h2>Working with Amazon MWS Feed API (e.g. Upload file)</h2>
<p>Amazon MWS Provides Feed APIs which has slight different requirements. Important requirement in Feed file upload is you have to supply Content MD5 Hash. If you use SSIS PowerPack then you don&#8217;t have to worry about that complexity because calculating MD5 Hash is automatically done.</p>
<h3>Upload Amazon MWS Feed File in TSV / CSV format (Tab separated)</h3>
<p>Here is the screenshot for how to upload Tab separated values in CSV file. You can specify body from Variable or Read from file. If you read from file then must check File Upload/Multi-Part option and start path with @ symbol as below.</p>
<div id="attachment_975" style="width: 965px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-amazon-mws-feed-api-submitfeed-upload-file-csv-tab-format.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-975" class="size-full wp-image-975" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-amazon-mws-feed-api-submitfeed-upload-file-csv-tab-format.png" alt="Call Amazon MWS Feed API - Upload CSV file format (Tab separated values - TSV) - XML" width="955" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-amazon-mws-feed-api-submitfeed-upload-file-csv-tab-format.png 955w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-call-amazon-mws-feed-api-submitfeed-upload-file-csv-tab-format-300x196.png 300w" sizes="(max-width: 955px) 100vw, 955px" /></a><p id="caption-attachment-975" class="wp-caption-text">Call Amazon MWS Feed API &#8211; Upload CSV file format (Tab separated values &#8211; TSV)</p></div>
<h3>Upload Amazon MWS Feed File in XML format</h3>
<p>To upload feed file in XML format use same settings as above except Content Type should be XML (text/xml) (Select in the dropdown)</p>
<h2>Calling Amazon Product Advertising API</h2>
<p>If you have need to call <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/GSG/Welcome.html" target="_blank" rel="noopener">Amazon Product Advertising API</a> then also you can use above techniques (Use MWS Provider on OAuth connection) to call Product Advertise API. Both API (MWS API and Product Advertise API) use same signature hashing algorithm so its possible to use MWS Provider for Hashing. You may have to change your API URL parameters as needed when you call Amazon Product Advertising API. Basically when you call any MWS or Product Advertising API using GET method then OAuth connection manager automatically appends Signature to URL at runtime.</p>
<h2>Import data from MWS Custom Reports (Inventory Report Example)</h2>
<p>Now lets look at how to extract data from <a href="https://docs.developer.amazonservices.com/en_UK/reports/Reports_ReportType.html" target="_blank" rel="noopener">Custom Report API</a> . Reading data from Custom Reports not single step process because report generation is Job style API. Which means you send report request and wait  until its done. Once Report ready you have to read in CSV format or XML. Some Reports only available in CSV format. <a href="https://docs.developer.amazonservices.com/en_UK/reports/Reports_Overview.html" target="_blank" rel="noopener">Check this post</a> to understand how complex it can be to get data. We will make it simple for you to understand this in 3 steps. Basically calling reports requires minimum 3 API calls (see below)</p>
<ol>
<li>Create a new report request &#8211; Cal <a href="https://docs.developer.amazonservices.com/en_UK/reports/Reports_RequestReport.html" target="_blank" rel="noopener">RequestReport</a> API . It returns <strong>ReportRequestId</strong> (You can use it in the next step)</li>
<li>Check Report Status see its done &#8211; Call <a href="https://docs.developer.amazonservices.com/en_UK/reports/Reports_GetReportRequestList.html" target="_blank" rel="noopener">GetReportRequestList</a> API (Pass <strong>ReportRequestId</strong> got in the previous step to get data for only one Report request we care). Keep checking Report Status every few seconds until you get <strong>_DONE_</strong> status in response.</li>
<li>Read Report Data &#8211; Call <a href="https://docs.developer.amazonservices.com/en_UK/reports/Reports_GetReport.html" target="_blank" rel="noopener">GetReport</a>. This API call returns CSV or XML data. So use correct component for this step. If CSV data is returned then we must use <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">CSV Source</a> rather than <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">XML Driver</a>.</li>
</ol>
<p>Now lets see how to read Amazon MWS custom report in SSIS. In this example, We will get Inventory by calling <strong>_GET_MERCHANT_LISTINGS_DATA_</strong> report type.</p>
<h3>Download Sample Package for MWS Report</h3>
<p>To make things simple we have created a demo package &#8211; ready to go.<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2016/10/Amazon_MWS_API_GetReport_2012.zip">Download SSIS 2012 Demo &#8211; Amazon_MWS_API_GetReport_2012</a>.</p>
<h3>Prepare demo package for first run</h3>
<p>Once you download and extract above sample package. Import to your existing SSIS Solution. Its SSIS 2012 format so it may upgrade to higher version if you using SSIS 2014, 2016 or 2017.</p>
<p>Once package is opened perform following steps in before you can execute the package.</p>
<ol>
<li>Enter MarketplaceId, SellerId in Variables. Double click OAuth Connection and enter your MWS Account Key and Secret.</li>
<li>Create c:\temp directory (This is where we will save final report file)</li>
<li>Run this package</li>
<li>Go to Execution log and Find ReportId (This you can hardcode in Variables for Design time Preview / Metadata changes etc)</li>
</ol>
<p>See below package screenshot</p>
<div id="attachment_7128" style="width: 794px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-report-csv-xml-format.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7128" class="size-full wp-image-7128" src="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-report-csv-xml-format.png" alt="Read data from Amazon MWS Report in SSIS (Get Inventory Listing Example)" width="784" height="752" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-report-csv-xml-format.png 784w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-report-csv-xml-format-300x288.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-report-csv-xml-format-768x737.png 768w" sizes="(max-width: 784px) 100vw, 784px" /></a><p id="caption-attachment-7128" class="wp-caption-text">Read data from Amazon MWS Report in SSIS (Get Inventory Listing Example)</p></div>
<h3>Steps Explained</h3>
<p>Now lets see each steps in depth. We broken whole process in 3 groups.</p>
<h4>Create Report Request (Step1)</h4>
<p>This is the first step how you initiate report request.  Use <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">REST API Task</a> to call this step. Here is raw request. Many items in body added at runtime (e.g. Signature, Timestamp).</p>
<ul>
<li>On Request tab see how we used SSIS Variables to get many values at runtime dynamically.</li>
<li>On Response Tab we have to extract RequestId and save into variable.</li>
</ul>
<pre class="crayon-plain-tag">POST 
https://mws.amazonservices.com/Reports/2009-01-01

AWSAccessKeyId=Axxxxxxxxx&amp;Action=RequestReport&amp;MarketplaceId=ATVPDKIKX0DER&amp;ReportType=_GET_MERCHANT_LISTINGS_DATA_&amp;SellerId=Axxxxxxxxx&amp;SignatureMethod=HmacSHA256&amp;SignatureVersion=2&amp;Timestamp=2019-06-05T21%3A23%3A31.090Z&amp;Signature=2AbGQQ4xxxxxxxxxxxxxxxxxxxxjJzox%2FU%3D</pre>
<div id="attachment_7129" style="width: 869px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-call-report-request.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7129" class="size-full wp-image-7129" src="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-call-report-request.png" alt="RequestReport Action - Generate Amazon MWS Custom Report" width="859" height="628" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-call-report-request.png 859w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-call-report-request-300x219.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-amazon-mws-call-report-request-768x561.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></a><p id="caption-attachment-7129" class="wp-caption-text">RequestReport Action &#8211; Generate Amazon MWS Custom Report</p></div>
<div id="attachment_7130" style="width: 681px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-rest-api-response-extract-xml-value-xpath-expression.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7130" class="size-full wp-image-7130" src="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-rest-api-response-extract-xml-value-xpath-expression.png" alt="Extract value from XML response using XPATH and save to Variable (Get RequestId Example)" width="671" height="389" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-rest-api-response-extract-xml-value-xpath-expression.png 671w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-rest-api-response-extract-xml-value-xpath-expression-300x174.png 300w" sizes="(max-width: 671px) 100vw, 671px" /></a><p id="caption-attachment-7130" class="wp-caption-text">Extract value from XML response using XPATH and save to Variable (Get RequestId Example)</p></div>
<p>Here is how to configure above task</p>
<ol>
<li></li>
</ol>
<h4>Wait until data is ready (Step2)</h4>
<p>Once we send RepotRequest and we have RequestId we can call step2 using REST API Task. In this Task we can use Status Check Feature. This is pretty handy feature because we dont have to implement Loop in SSIS. Basically we have to keep checking report until we get _DONE_ status in the response (ReportProcessingStatus node in XML)</p>
<p>Here is how to configure the task.</p>
<ol>
<li>Request Tab Configuration.<br />
<strong>URL:</strong> <pre class="crayon-plain-tag">https://mws.amazonservices.com/Reports/2009-01-01</pre>
<strong>Method:</strong> POST<br />
<strong>Body:</strong> <pre class="crayon-plain-tag">Action=GetReportRequestList&amp;ReportRequestIdList.Id.1={{User::ReportRequestId}}&amp;MarketplaceId={{User::MarketplaceId}}&amp;SellerId={{User::SellerId}}</pre></li>
<li>Response Setting Tab Configuration<br />
<strong>Response content type:</strong> Xml<br />
<strong>Filter Expression:</strong>  <pre class="crayon-plain-tag">//*[local-name() = 'ReportProcessingStatus']  </pre></li>
<li>Status Check Tab<br />
<strong>Check Enable Status</strong><br />
<strong>Success Value:</strong>  <pre class="crayon-plain-tag">_DONE_</pre>
Check Every <strong>5</strong> Seconds</li>
</ol>
<div id="attachment_7131" style="width: 678px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-rest-api-task-status-check-wait-until-ready-loop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7131" class="size-full wp-image-7131" src="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-rest-api-task-status-check-wait-until-ready-loop.png" alt="REST API Task - Status Check Feature (Wait until data is ready loop)" width="668" height="610" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-rest-api-task-status-check-wait-until-ready-loop.png 668w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-rest-api-task-status-check-wait-until-ready-loop-300x274.png 300w" sizes="(max-width: 668px) 100vw, 668px" /></a><p id="caption-attachment-7131" class="wp-caption-text">REST API Task &#8211; Status Check Feature (Wait until data is ready loop)</p></div>
<h4>GetReportId (Step3)</h4>
<p>Once above task finished we can call same request again but this time we have to configure slightly different way.</p>
<p>Here is how to configure the task.</p>
<ol>
<li>Request Tab Configuration.<br />
<strong>URL:</strong> <pre class="crayon-plain-tag">https://mws.amazonservices.com/Reports/2009-01-01</pre>
<strong>Method:</strong> POST<br />
<strong>Body:</strong> <pre class="crayon-plain-tag">Action=GetReportRequestList&amp;ReportRequestIdList.Id.1={{User::ReportRequestId}}&amp;MarketplaceId={{User::MarketplaceId}}&amp;SellerId={{User::SellerId}}</pre></li>
<li>Response Setting Tab Configuration<br />
<strong>Response content type:</strong> Xml<br />
<strong>Filter Expression:</strong>  <pre class="crayon-plain-tag">//*[local-name() = 'GeneratedReportId']  </pre>
<strong>Check Save to Variable: </strong>Save to <strong>User::ReportId</strong></li>
<li>Status Check Tab<br />
<strong>Make Enable Status is unchecked</strong></li>
</ol>
<h4>Get Report Data  (Step4,Step5 or Step6)</h4>
<p>Now we are ready to ready our report. There are two ways we can do in SSIS.</p>
<ul>
<li>First approach (step 4,5) is download the report and save to local disk and then in the next step we can use data flow (CSV Source) to parse the saved file.</li>
<li>Second approach (step6) is rather than saving to disk we can directly call API using CSV File source and parse content that way. Lets talk each approach briefly.</li>
</ul>
<h5>Step4,5 &#8211; Load Report From File</h5>
<p>If you wish to save Report on disk then you can use REST API Task and call request like below.</p>
<p>Here is how to configure the task to download the file.</p>
<ol>
<li>Request Tab Configuration.<br />
<strong>URL:</strong> <pre class="crayon-plain-tag">https://mws.amazonservices.com/Reports/2009-01-01</pre>
<strong>Method:</strong> POST<br />
<strong>Body:</strong> Action=GetReport&amp;ReportId={{User::ReportId}}&amp;MarketplaceId={{User::MarketplaceId}}&amp;SellerId={{User::SellerId}}</li>
<li>Response Setting Tab Configuration<br />
<strong>Response content type:</strong> Xml<br />
<strong>Filter Expression:</strong>  <pre class="crayon-plain-tag">//*[local-name() = 'GeneratedReportId']  </pre>
<strong>Check Save to Variable: </strong>Save to <strong>User::ReportId<br />
</strong></li>
<li>On Response Settings Tab : Set Response charset to <strong>Western European [Windows 1252]</strong>  (or directly set via Properties Grid to <strong>Windows-1252</strong> under ResponseCharset Property)<strong><br />
</strong></li>
<li>Status Check Tab<br />
<strong>Make Enable Status is unchecked</strong></li>
</ol>
<p>To read download CSV file use settings described in below section except URL change it with local file path.</p>
<h5>Step6 &#8211; Load report from URL</h5>
<p>If you wish to load directly from URL then use same setting as above but in CSV Source inside data flow.</p>
<p>Here is how to configure CSV Source.</p>
<ol>
<li>Request Tab Configuration.<br />
<strong>URL:</strong> <pre class="crayon-plain-tag">https://mws.amazonservices.com/Reports/2009-01-01</pre>
<strong>Method:</strong> POST<br />
<strong>Body:</strong> <pre class="crayon-plain-tag">Action=GetReport&amp;ReportId={{User::ReportId}}&amp;MarketplaceId={{User::MarketplaceId}}&amp;SellerId={{User::SellerId}} </pre></li>
<li>General Tab<br />
<strong>Column Delimiter:</strong> {TAB}</li>
<li>On Encoding Tab : Set to Western European [Windows 1252]  (or directly set via Properties Grid to <strong>Windows-1252</strong> under CharacterSet Property)</li>
</ol>
<h2>Conclusion</h2>
<p>Amazon Marketplace Web service (MWS) provides great way to automate many functionality for Marketplace Seller. Using ZappySys <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> you con 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-amazon-mws-api-using-ssis-marketplace-web-service/">How to call Amazon MWS API 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>How to import XML into SQL Server using SSIS</title>
		<link>https://zappysys.com/blog/ssis-import-xml-file-sql-server-parse-xml/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 30 Aug 2016 22:42:05 +0000</pubDate>
				<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis xml parser transform]]></category>
		<category><![CDATA[ssis xml source]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=755</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to import XML file into target such as SQL Server, CSV, Excel, Oracle. Converting or Importing XML requires flattening XML structure (i.e. hierarchy) sometimes we refer this process as de-normalization.  Parsing XML can be tricky depending on how many levels you have and from which level you need data. [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-import-xml-file-sql-server-parse-xml/">How to import XML into SQL Server using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2016/08/ssis-xml-parser-transform.png"><img loading="lazy" decoding="async" class="alignleft wp-image-2122" src="https://zappysys.com/blog/wp-content/uploads/2016/08/ssis-xml-parser-transform.png" alt="" width="90" height="90" /></a>In this post you will learn how to import XML file into target such as SQL Server, CSV, Excel, Oracle. Converting or Importing XML requires flattening XML structure (i.e. hierarchy) sometimes we refer this process as de-normalization.  Parsing XML can be tricky depending on how many levels you have and from which level you need data. If you want to <a href="//zappysys.com/blog/tutorial-create-xml-in-ssis-export-xml-file-output/" target="_blank" rel="noopener">export XML rather than Import then check this article</a>.</p>
<p>This article assumes you have installed <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><span style="color: #248cc8;">SSIS PowerPack</span></a> and watched introduction videos of <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener"><span style="color: #248cc8;">SSIS XML Source Connector</span></a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-parser-transform/" target="_blank" rel="noopener"><span style="color: #248cc8;">SSIS XML Parser Transform</span></a></p>
<h2>Import XML File using SSIS XML Source</h2>
<p>ZappySys <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener"><span style="color: #248cc8;">SSIS XML Source </span></a>is a very powerful component. It supports not only reading from file but also reading from Direct XML String or <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">REST API / SOAP Web Service.</a></p>
<h3>How ZappySys XML Source parse/output data</h3>
<p><a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener"><span style="color: #248cc8;">XML Source</span></a> created by ZappySys is very different than what Microsoft provides out the box because ZappySys component outputs one flat view of nested XML document (de-normalized) compared to many outputs what Microsoft XML Source produces which is hard to manage and join based on relation with parent node.</p>
<p>With ZappySys XML component you don&#8217;t have to worry about joins because by default parent columns included along with hierarchy you extracted (e.g. If you extract $.Customer.Orders[*].OrderDetails[*] then you get all columns listed under &lt;Order&gt; and &lt;Customer&gt; nodes)</p>
<div style="width: 716px" class="wp-caption alignnone"><img loading="lazy" decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-data-from-path-or-web-url-variable.png" alt="SSIS XML Source - Variable Mode - Call Web API or Read from File" width="706" height="461" /><p class="wp-caption-text">ZappySys XML Source (Read XML Files, Consume REST API, SOPA Web Service)</p></div>
<h3>Importing single or multiple XML Files</h3>
<p>To import single files specify full XML file path</p>
<p>Example:  c:\ssis\<strong>File_001.xml</strong></p>
<p>To import multiple files using XML source use wildcard pattern</p>
<p>Example:  c:\ssis\<strong>File_*.xml</strong></p>
<div style="width: 653px" class="wp-caption alignnone"><img loading="lazy" decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-read-from-multiple-files.png" alt="SSIS XML Source - Read data from XML files (Single or Multiple files) - Use wildcard pattern in path" width="643" height="230" /><p class="wp-caption-text">XML File Source &#8211; Specify File Path with wildcard pattern (Loop multiple files)</p></div>
<div style="width: 659px" class="wp-caption alignnone"><img loading="lazy" decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-read-multiple-files-wildcard-pattern.png" alt="SSIS XML Source - Read data from XML files (Single or Multiple files) - Use wildcard pattern in path" width="649" height="318" /><p class="wp-caption-text">Importing data from multiple XML files</p></div>
<p>&nbsp;</p>
<h3>Using variable to make path dynamic</h3>
<p>You can also use variable placeholders in your path to make it dynamic</p>
<p>Example:  c:\ssis\<strong>{{User::FileName}}</strong>.xml</p>
<h2>Importing data from XML Web Service or REST API</h2>
<p>XML Source supports consuming REST API data or calling XML SOAP Web services. This article doesn&#8217;t include this feature in depth. But refer to learn more about this feature.</p>
<div style="width: 714px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-data-from-web-url.png" alt="SSIS XML Source - Direct Mode - Call REST API web service or read from XML File" width="704" height="595" /><p class="wp-caption-text">SSIS XML Source &#8211; Direct Mode &#8211; Call REST API web service or read from XML File</p></div>
<p>&nbsp;</p>
<h2>Parse XML string and split into columns using XML Parser Transform</h2>
<div style="width: 831px" class="wp-caption alignnone"><img loading="lazy" decoding="async" title="SSIS XML Parser Transform - Parse XML Document, Convert XML to CSV or save to RDBMS (e.g. SQL Server, MySQL)" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-parser-transform/ssis-xml-parser-transform-convert-xml-to-csv.png" alt="SSIS XML Parser Transform - Parse XMl Document, Convert XML to CSV or save to RDBMS (e.g. SQL Server, MySQL)" width="821" height="643" /><p class="wp-caption-text">Parsing XML Data &#8211; XML String into Columns using SSIS XML Parser Transform</p></div>
<p>&nbsp;</p>
<h2>Other Settings (XML Source, XML Parser Transform)</h2>
<h3>Preview Data</h3>
<p>All access modes support preview data like below. Change your settings such as Filter expression, Source etc and click preview.</p>
<div style="width: 749px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-data-read-from-direct-string.png" alt="Read XML data in SSIS" width="739" height="586" /><p class="wp-caption-text">Preview XML Data</p></div>
<h3>Filtering data using expression</h3>
<p>You can filter XML data by specifying simple expressions (e.g. $.store.book[*]) to navigate various parts of XML where you can extract data (See above screenshot).</p>
<p>Things to remember for filter expressions</p>
<ul>
<li>Expression must start with $ (means root from where parsing will start)</li>
<li>Use dot (.) to separate Hierarchy and use brackets to indicate array []</li>
<li>Use * to indicate all records</li>
</ul>
<h3>Sample XML for examples</h3>
<pre class="crayon-plain-tag">&lt;?xml version="1.0"?&gt;
&lt;Root Ver="1"&gt;
  &lt;DocInfo&gt;
    &lt;Author&gt;Bob&lt;/Author&gt;
    &lt;Date&gt;2015-01-01&lt;/Date&gt;
    &lt;Location&gt;
      &lt;City&gt;Atlanta&lt;/City&gt;
      &lt;State&gt;GA&lt;/State&gt;
    &lt;/Location&gt;
  &lt;/DocInfo&gt;
  &lt;Customer CustId="1"&gt;
    &lt;Order OrderId="1000"&gt;
      &lt;OrderDate&gt;2005-02-01T10:00:09&lt;/OrderDate&gt;
      &lt;Item ProdId="101"&gt;
        &lt;ProdName&gt;Tea&lt;/ProdName&gt;
      &lt;/Item&gt;
      &lt;Item ProdId="102"&gt;
        &lt;ProdName&gt;Coffee&lt;/ProdName&gt;
      &lt;/Item&gt;
    &lt;/Order&gt;
    &lt;Order OrderId="1001"&gt;
      &lt;OrderDate&gt;2005-04-01T21:59:20&lt;/OrderDate&gt;
      &lt;Item ProdId="101"&gt;
        &lt;ProdName&gt;Tea&lt;/ProdName&gt;
      &lt;/Item&gt;
      &lt;Item&gt;
        &lt;ProdId&gt;201&lt;/ProdId&gt;
        &lt;ProdName&gt;Soda&lt;/ProdName&gt;
      &lt;/Item&gt;
    &lt;/Order&gt;
  &lt;/Customer&gt;
  &lt;Customer CustId="2"&gt;
    &lt;Order OrderId="2000"&gt;
      &lt;OrderDate&gt;2005-02-01T21:59:20&lt;/OrderDate&gt;
      &lt;Item ProdId="301"&gt;
        &lt;ProdName&gt;Apple&lt;/ProdName&gt;
      &lt;/Item&gt;
      &lt;Item ProdId="302"&gt;
        &lt;ProdName&gt;Orange&lt;/ProdName&gt;
      &lt;/Item&gt;
    &lt;/Order&gt;
    &lt;Order OrderId="2001"&gt;
      &lt;OrderDate&gt;2005-01-01T21:59:20&lt;/OrderDate&gt;
      &lt;Item ProdId="201"&gt;
        &lt;ProdName&gt;Soda&lt;/ProdName&gt;
      &lt;/Item&gt;
      &lt;Item ProdId="202"&gt;
        &lt;ProdName&gt;Milk&lt;/ProdName&gt;
      &lt;/Item&gt;
    &lt;/Order&gt;
  &lt;/Customer&gt;  
&lt;/Root&gt;</pre>
<h3>Example of filter expression</h3>
<div class="su-table su-table-alternate">
<table class="props">
<tbody>
<tr>
<th class="columnName">Filter</th>
<th class="columnDesc">Output</th>
</tr>
<tr>
<td>
<pre class="crayon-plain-tag">$</pre>
</td>
<td>Get all records<br />
<img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-output-example-1.png" alt="SSIS XML Source Adpater - XMLPath filter" /></td>
</tr>
<tr>
<td>$.Root.Customer[*]</td>
<td>Get all customers<br />
<img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-output-example-4.png" alt="SSIS XML Source Adpater - XMLPath filter" /></td>
</tr>
<tr>
<td>$.Root.Customer[*].Order[*]</td>
<td>Get all orders for all customers<br />
<img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-output-example-2.png" alt="SSIS XML Source Adpater - XMLPath filter" /></td>
</tr>
<tr>
<td>$.Root.Customer[*].Order[*](Include Parent Columns=True)</td>
<td>Get all orders for all customers (Include Parent Columns option checked)<br />
<img decoding="async" class="figureimage" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-output-example-3-with-parent-columns.png" alt="SSIS XML Source Adpater - XMLPath filter" /></td>
</tr>
<tr>
<td>$.Root.Customer[*].@CustId</td>
<td>Get only Customer Id for each customer record</td>
</tr>
<tr>
<td>$.Root.Customer[*].Order[:1]</td>
<td>Get first order for each customer</td>
</tr>
<tr>
<td>$.Root.Customer[*].Order[:3]</td>
<td>Get top 3 orders for each customer</td>
</tr>
<tr>
<td>$.Root.Customer[*].Order[:1]</td>
<td>Get last order of each customer</td>
</tr>
<tr>
<td>$.Root.Customer[*].Order[0,4]</td>
<td>Get orders starting from first row to fifth row (Zero based index). If you want 5th row to 10th row then use [4,9]</td>
</tr>
<tr>
<td>$.Root.Customer[*].Order[2]</td>
<td>Get 3rd order for each customer</td>
</tr>
</tbody>
</table>
</div>
<h3>Defining array elements</h3>
<p>Any hierarchy you extracting with array indicator can be added to array element name list (On Array handling Tab). This helps when you only have one row for node specified as array.</p>
<p>For example if your filter expression is $.Customer.Order[*].OrderItem[*] in this case you indicated that you can have one or more Order nodes under Customer and you may have one or more OrderItem nodes under Order node. If this is the case then set array handling as below</p>
<div id="attachment_763" style="width: 656px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/08/ssis-xml-array-handling.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-763" class="size-full wp-image-763" src="//zappysys.com/blog/wp-content/uploads/2016/08/ssis-xml-array-handling.png" alt="Handling Rows/Array Elements (Repeated XML Elements) " width="646" height="231" srcset="https://zappysys.com/blog/wp-content/uploads/2016/08/ssis-xml-array-handling.png 646w, https://zappysys.com/blog/wp-content/uploads/2016/08/ssis-xml-array-handling-300x107.png 300w" sizes="(max-width: 646px) 100vw, 646px" /></a><p id="caption-attachment-763" class="wp-caption-text">Handling Rows/Array Elements (Repeated XML Elements)</p></div>
<h3>Editing Column Metadata (Length and DataType)</h3>
<p>XML Source and XML Parser both detects Datatype/Length by scanning sample data (Default 300 rows) but sometimes this is not accurate and it may produce invalid metadata. If that&#8217;s the case you can easily change it in Columns tab. Once you edit Length or DataType make sure you <strong>check Lock column (Last column in grid).</strong> Once Lock is applied metadata refresh wont affect your changes. You can also add new column manually if its not detected (Lets say your XML is very large and many columns not found in first 300 rows scanned). To add new column type in the last grid row or click new icon in the grid toolbar.</p>
<div style="width: 660px" class="wp-caption alignnone"><img loading="lazy" decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-source/ssis-xml-source-select-output-columns.png" alt="SSIS XML Source - Configure Columns and DataType" width="650" height="499" /><p class="wp-caption-text">Edit XML File Source Column Metadata</p></div>
<h2>Conclusion</h2>
<p>In this post you have seen how to use  <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener"><span style="color: #248cc8;">SSIS XML Source Connector</span></a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-parser-transform/" target="_blank" rel="noopener"><span style="color: #248cc8;">SSIS XML Parser Transform</span></a> to extract data from nested XML documents without any coding.</p>
<p><strong>Related to:</strong> SSIS Import XML Files | SSIS Parse XML data | SSIS Extract from XML files | Read from XML Files</p>
<p>The post <a href="https://zappysys.com/blog/ssis-import-xml-file-sql-server-parse-xml/">How to import XML into SQL Server using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Calling REST API in SSIS with Basic Authentication / Userid-Password (BASE64 Authorization header)</title>
		<link>https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 27 Aug 2015 20:58:17 +0000</pubDate>
				<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis http connection]]></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=34</guid>

					<description><![CDATA[<p>Introduction In this blog post you will explain how to pass basic credentials (i.e. UserID/Password) along with your web request. You will also learn about setting up Authorization Header for HTTP Web Request in Base64 manually. To learn more about how to consume / call REST API in SSIS check this article. HTTP Authorization Header [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/">Calling REST API in SSIS with Basic Authentication / Userid-Password (BASE64 Authorization header)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this blog post you will explain how to pass basic credentials (i.e. UserID/Password) along with your web request. You will also learn about setting up Authorization Header for HTTP Web Request in Base64 manually. To learn more about <a href="//zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">how to consume / call REST API in SSIS check this article</a>.</p>
<h2>HTTP Authorization Header basics</h2>
<p>As per HTTP Standard you can pass credentials very simple way using basic Authorization header. Below is the sample of Basic Authorization header.</p>
<p>As you can see it consist of HeaderName=Authorization and Value=some <em>base64 encoded string</em><br />
<code>Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==</code><br />
As per standard Base64 encoded string is made up with two elements. <em>your_userid:your_password</em></p>
<blockquote><p><strong>NOTE:</strong> Base64 is encoding and not encryption method. So never hand over your encoded Authorization header string to anyone. Anyone can decode Base64 encoded string easily by using tools <a href="http://www.bing.com/search?q=base64+encode&amp;src=IE-TopResult&amp;FORM=IE11TR&amp;conversationid=" target="_blank" rel="noopener">like this</a></p></blockquote>
<h2>Passing Basic Credentials along with HTTP Web Request</h2>
<p>You can pass credentials (i.e. UserID/Password) in two different ways.</p>
<ol>
<li>Automatic approach &#8211; Using <a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">ZS-HTTP Connection Manager</a> (BASE64 Encoded Header automatically generated)</li>
<li>Manual approach &#8211; Supplying Authorization where UserID/Password encoded as Base64</li>
</ol>
<h3>Automatic approach &#8211; Using ZS-HTTP Connection Manager</h3>
<p>Now lets look at how to use automatic approach to pass Basic Authorization in following 3 different tasks/components</p>
<ol>
<li>Passing basic credentials in <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">SSIS REST API Task</a></li>
<li>Passing basic credentials in <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a></li>
<li>Passing basic credentials in <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a></li>
</ol>
<h4>Using SSIS REST API Task (Pass Basic credentials using Connection Manager)</h4>
<p>The simplest way to pass credentials is use HTTP Connection Manager. If you are using <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> then you can use <strong>Url from Connection</strong> Access Mode. And on connection manager specify UserId and password to pass Basic <strong>Authorization Header </strong></p>
<p>Advantages of this method are..<br />
1) Its very simple<br />
2) Credentials are encrypted in SSIS Package</p>
<blockquote><p><strong>NOTE:</strong> We recommend using <strong>https</strong>:// Urls whenever possible otherwise your web request can be decoded in plain text by any servers sitting between you and target and possibly they can get your password by decoding base64 header.</p></blockquote>
<div><img decoding="async" class="figureimage" title="SSIS REST API Task - Pass Base64 Encoded HTTP Authorization Header" src="https://zappysys.com/blog/wp-content/uploads/2015/08/how-to-set-base64-encoded-authorization-header-for-http-web-request-1.png" alt="SSIS REST API Task - Pass Base64 Encoded HTTP Authorization Header" /></div>
<div></div>
<div><strong>Analyze Base64 Encoded HTTP Authorization Header generated by HTTP Connection Manager</strong></div>
<div>You can analyze Webrequest in some 3rd party Free Debugging tools such as Fiddler (<a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Check this article</a>). As you see how its sending Authorization header in Base64 encoded string.</div>
<div></div>
<div><img decoding="async" class="figureimage" title="Base64 Encoded HTTP Basic Authorization Header View in Fiddler" src="https://zappysys.com/blog/wp-content/uploads/2015/08/how-to-set-base64-encoded-authorization-header-for-http-web-request-2.png" alt="Base64 Encoded HTTP Basic Authorization Header View in Fiddler" /><br />
Base64 Encoded HTTP Basic Authorization Header &#8211; View in Fiddler</div>
<h4>Using SSIS JSON/XML Source  (Pass Basic credentials using Connection Manager)</h4>
<p>You can use HTTP Connection manager in <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">XML Source</a> too. Only difference is you have to check Use Credentials checkbox and select HTTP connection manager from available connection managers dropdown.</p>
<ol>
<li>Select AccessMode as &#8220;File Path or Web URL&#8221;</li>
<li>Enter API URL</li>
<li>Check &#8220;Use Credentials&#8221; option</li>
<li>Click &#8220;New&#8221; next to Connection dropdown or select New &#8220;ZS-HTTP&#8221; connection from dropdown</li>
<li>Configure HTTP Connection as below (i.e. Enter URL, Select Basic Auth, Enter UserID, Password)</li>
<li>Clock OK on HTTP connection manager UI to save and now Test JSON or XML Source UI by clicking Preview (Assuming no other configuration needed)</li>
</ol>
<div id="attachment_1676" style="width: 972px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/08/ssis-json-source-rest-api-http-basic-authentication-pass-userid-password.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1676" class="size-full wp-image-1676" src="https://zappysys.com/blog/wp-content/uploads/2015/08/how-to-set-base64-encoded-authorization-header-for-http-web-request-3.png" alt="SSIS JSON Source - Passing Basic Credentials (Supply UserID / Password) using HTTP Connection" width="962" height="757" /></a><p id="caption-attachment-1676" class="wp-caption-text">SSIS JSON Source &#8211; Passing Basic Credentials (Supply UserID / Password) using HTTP Connection</p></div>
<h3>Manual approach &#8211; Supplying Authorization where UserID/Password encoded as Base64</h3>
<p>Our <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source</a>, <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">XML Source</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task </a> they all support passing BASE64 Encoded String for Authorization header (see below screenshot). Setting up userid and password in HTTP Connection Manger would do same trick as setting up it manually.</p>
<p>To encode any Header value in BASE64 format you simply have to add BASE64ENC format specifier after variable name.</p>
<p>Example: {{User::varUserAndPassword<strong>,BASE64ENC</strong>}}</p>
<p>&nbsp;</p>
<div><img decoding="async" class="figureimage" title="SSIS JSON Source Task - Pass Base64 Encoded HTTP Authorization Header" src="https://zappysys.com/blog/wp-content/uploads/2015/08/how-to-set-base64-encoded-authorization-header-for-http-web-request-4.png" alt="SSIS JSON Source Task - Pass Base64 Encoded HTTP Authorization Header" /><br />
SSIS JSON Source Task &#8211; Pass Base64 Encoded HTTP Authorization Header</div>
<div><img decoding="async" class="figureimage" title="Base64 Encoded HTTP Basic Authorization Header View in Fiddler" src="https://zappysys.com/blog/wp-content/uploads/2015/08/how-to-set-base64-encoded-authorization-header-for-http-web-request-5.png" alt="Base64 Encoded HTTP Basic Authorization Header View in Fiddler" /></div>
<h2>Reference</h2>
<p>Wikipedia Article &#8211; <a href="https://en.wikipedia.org/wiki/Basic_access_authentication" target="_blank" rel="noopener">HTTP Basic Authorization Header</a></p>
<h2>Download FREE SSIS Components</h2>
<p><a href="https://zappysys.com/products/ssis-powerpack/"><img decoding="async" src="//zappysys.com/wp-content/uploads/2016/10/slider-ssis-powerpack-1.png" /></a></p>
<p>The post <a href="https://zappysys.com/blog/how-to-set-base64-encoded-authorization-header-for-http-web-request/">Calling REST API in SSIS with Basic Authentication / Userid-Password (BASE64 Authorization header)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
