<?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>looping Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/looping/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/looping/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Thu, 19 Mar 2026 23:09:47 +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>looping Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/looping/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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 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 fetchpriority="high" 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>How to do REST API Pagination in SSIS / ODBC Drivers</title>
		<link>https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/</link>
					<comments>https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/#comments</comments>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 08 Apr 2016 15:37:55 +0000</pubDate>
				<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[api pagination]]></category>
		<category><![CDATA[json source]]></category>
		<category><![CDATA[looping]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[paging]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[xml source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=422</guid>

					<description><![CDATA[<p>Introduction In our previous blog, we saw how to call REST in SSIS including concepts of Authentication / Error Handling. Now in this post, we will cover API Pagination. You will learn concepts and patterns about REST API Pagination (for JSON / XML / SOAP or CSV API). We will describe methods and steps to implement REST API [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/">How to do REST API Pagination in SSIS / ODBC Drivers</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In our previous blog, we saw <a href="https://zappysys.com/blog/call-rest-api-using-ssis-web-service-task/">how to call REST in SSIS</a> including concepts of Authentication / Error Handling. Now in this post, <strong>we will cover API Pagination.</strong> You will learn concepts and patterns about REST API Pagination (for JSON / XML / SOAP or CSV API).</p>
<p>We will describe methods and steps to implement REST API Pagination in SSIS PowerPack or  <a href="https://zappysys.com/products/odbc-powerpack/">ODBC PowerPack API Drivers (for apps like Excel, Power BI, Informatica&#8230;)</a> without coding. Both Products share a similar user interface with minor differences. For example purpose, we will show screenshots from SSIS PowerPack UI but concepts should remain same. You will also learn some techniques about <strong>how to implement an infinite loop in SSIS</strong>. Sometimes your REST API requires you to loop through all pages until no more data found then you can use pattern described in this article (sample package attached at the end).</p>
<p>In this article, we will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Connector</a> to process data from RESTful web service. If you have to process XML (or SOAP) data from REST API then simply use <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML Source Connector for REST API, SOAP or File</a> rather than JSON Source.</p>
<h2>Debugging REST API Requests</h2>
<p>Before we look at various aspects of REST API Pagination, we highly recommend you install FREE Web Debugging Tool Fiddler. <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Look at this article</a> to understand how to debug REST API requests.</p>
<h2>Method-1: REST API Pagination via URL Parameter</h2>
<p>If you have paging requirement by specifying page number in URL then you can loop until no more pages found. Your REST API can indicate no more page found by any of the following ways.</p>
<p><strong>Example URL: </strong> http://myserver.com/v1/api/getcustomers/?<strong>page=1</strong></p>
<p>If no more data found for specified page number then</p>
<ol>
<li>server may return an empty response</li>
<li>server may return the response with specific error and response status code</li>
</ol>
<p><a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Connector</a> comes with flexible paging options to handle this scenario. See below screenshot how to configure this.</p>
<div id="attachment_10740" style="width: 777px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-1-JSON-source-Pagination-URL-parameter-mode.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10740" class="size-full wp-image-10740" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-1-JSON-source-Pagination-URL-parameter-mode.png" alt="Pagination Method 1 URL parameter mode" width="767" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-1-JSON-source-Pagination-URL-parameter-mode.png 767w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-1-JSON-source-Pagination-URL-parameter-mode-300x286.png 300w" sizes="(max-width: 767px) 100vw, 767px" /></a><p id="caption-attachment-10740" class="wp-caption-text">REST API Looping/Pagination via URL Page Number Parameter (Loop until last page detected)</p></div>
<p><strong>URL with offset and limit</strong></p>
<p>Sometimes you may have URLs with offset + limit parameters. as below. In this case, you can use the same technique as the above screenshot but just specify Page Num Indicator as <strong>offset</strong> and Increment by the same as your limit parameter (e.g. 1000 in this case). At runtime, your offset parameter will increment and generate URLs like below to fetch the next page.</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;">If you don&#8217;t specify the offset parameter in the initial URL then <strong>offset=1</strong> will be assumed as the default start. If your offset starts at 0 then refer to the next section for a workaround (i.e. Use URL Path Mode with StartAt variable = 0). Also if your increment for offset is other than the default page size then you must include the limit / pagesize parameter in the URL as below (e.g. limit=100 which is rows per page)</div></div>
<p><strong>Example URLs: </strong><br />
http://myserver.com/v1/api/getcustomers/?offset<strong>=1</strong>&amp;limit=1000<br />
http://myserver.com/v1/api/getcustomers/?offset=<strong>1001</strong>&amp;limit=1000<br />
http://myserver.com/v1/api/getcustomers/?offset=<strong>2001</strong>&amp;limit=1000</p>
<h2>Method-2: REST API Pagination via URL Path</h2>
<p>Sometimes your URL may contain a page or other identifier using path format.</p>
<p><strong>Example URLs: </strong><br />
http://myserver.com/v1/api/getcustomers/<strong>1/</strong><br />
http://myserver.com/v1/api/getcustomers/<strong>2</strong>/<br />
http://myserver.com/data/file<strong>1</strong>.json<br />
http://myserver.com/data/file<strong>2</strong>.json</p>
<p>If no more data is found for the specified page number then</p>
<ol>
<li>the server may return a 404 error (page not found)</li>
<li>server may return a response with a specific error and response status code</li>
</ol>
<p><a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Connector</a> comes with flexible paging options to handle this scenario. See the below screenshot of how to configure this.</p>
<div id="attachment_10741" style="width: 785px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-JSON-source-Pagination-URL-path-mode-Page-number-offset-passed-as-URL-path.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10741" class="size-full wp-image-10741" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-JSON-source-Pagination-URL-path-mode-Page-number-offset-passed-as-URL-path.png" alt="Pagination Method 2 " width="775" height="479" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-JSON-source-Pagination-URL-path-mode-Page-number-offset-passed-as-URL-path.png 775w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-JSON-source-Pagination-URL-path-mode-Page-number-offset-passed-as-URL-path-300x185.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-JSON-source-Pagination-URL-path-mode-Page-number-offset-passed-as-URL-path-768x475.png 768w" sizes="(max-width: 775px) 100vw, 775px" /></a><p id="caption-attachment-10741" class="wp-caption-text">REST API Looping/Pagination via URL Path (Loop until last page detected)</p></div>
<h3>URL with Skip Parameter (Offset starts at zero)</h3>
<p>Now let&#8217;s look at another common pattern just like the offset we discussed earlier but in the Skip pattern, it starts at zero rather than offset=1. In the previous mode, we didn&#8217;t have the option to supply the initial value to start the counter but if you use Path mode then you can start the counter at some custom value. See the below screen to show how we can setup pagination with the skip method with custom increment.</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;">If your increment for offset is other than the default page size then you must include page size parameter in the URL as below (e.g. pagesize=100 which is rows per page. Some APIs name this parameter in different way e.g. count=1000 or limit=100. Refer to the API documentation to know exact names)</div></div>
<p><strong>Example URLs</strong></p><pre class="crayon-plain-tag">http://mysite.com/api/getorders?skip=0&amp;pagesize=100
http://mysite.com/api/getorders?skip=100&amp;pagesize=100
http://mysite.com/api/getorders?skip=200&amp;pagesize=100
http://mysite.com/api/getorders?skip=300&amp;pagesize=100
....</pre><p>
<div id="attachment_10742" style="width: 1098px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-Pagination-URL-with-Skip-Parameter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10742" class="size-full wp-image-10742" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-Pagination-URL-with-Skip-Parameter.png" alt="Pagination method 2 URL with Skip Parameter" width="1088" height="481" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-Pagination-URL-with-Skip-Parameter.png 1088w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-Pagination-URL-with-Skip-Parameter-300x133.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-Pagination-URL-with-Skip-Parameter-768x340.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-2-Pagination-URL-with-Skip-Parameter-1024x453.png 1024w" sizes="(max-width: 1088px) 100vw, 1088px" /></a><p id="caption-attachment-10742" class="wp-caption-text">REST API Pagination with Custom Skip / Increment Settings (Offset Starts from 0)</p></div>
<p>&nbsp;</p>
<h2>Method-3 : REST API Pagination via Response Attribute (Next Link or Cursor)</h2>
<p>This method is not discussed in this article but <a href="https://zappysys.com/blog/odata-paging-rest-api-paging-using-ssis-json-source/" target="_blank" rel="noopener">click here to read more</a></p>
<p>There are mainly 3 ways you can get next link or cursor.</p>
<ol>
<li>Full Link (e.g. nextPage : &#8220;https://mysite.com/api/v1/1/?filter=AAAA&#8221; )</li>
<li>Partial Link  (e.g. nextPage : &#8220;/api/v1/getcustomer/1/?filter=AAAA&#8221; )</li>
<li>Cursor Continuation Token (e.g.   nextCursor : &#8220;xxxxAAAbbbbCccc112233==&#8221; )</li>
</ol>
<h3>Next Link Method (Partial or Full URL)</h3>
<p>Example response with next URL would be</p><pre class="crayon-plain-tag">{ 
  "value" : [....], 
  "odata.nextLink" : "http://abc.com/customers/2/" 
}</pre><p>
In this method you don&#8217;t specify page number in URL. If response include many records then you will get partial response along with indicator of next link.</p>
<p>For more information about this <em>REST API Pagination</em> please check below links. It explains in depth how to paginate REST API response with next page link found in response.</p>
<p><a title="Permalink to OData Paging using SSIS – REST API Paging Example" href="//zappysys.com/blog/odata-paging-rest-api-paging-using-ssis-json-source/" rel="bookmark">OData Paging using SSIS – REST API Paging Example</a></p>
<p><a title="Permalink to Read Twitter data in SSIS using REST API Task and JSON Source – OAuth2 Protocol" href="//zappysys.com/blog/read-twitter-data-in-ssis-using-rest-api-task-json-source-oauth2/#Handling_paging_of_large_REST_API_result_set_with_twitter_data_8211_loopingcursoring" rel="bookmark">Read Twitter data in SSIS using REST API Task and JSON Source – OAuth2 Protocol</a></p>
<div id="attachment_10743" style="width: 706px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-3-Pagination-via-Response-Attribute-Next-Link-or-Cursor.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10743" class="size-full wp-image-10743" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-3-Pagination-via-Response-Attribute-Next-Link-or-Cursor.png" alt="Method-3: Next Link Method (Partial or Full URL)" width="696" height="557" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-3-Pagination-via-Response-Attribute-Next-Link-or-Cursor.png 696w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-3-Pagination-via-Response-Attribute-Next-Link-or-Cursor-300x240.png 300w" sizes="(max-width: 696px) 100vw, 696px" /></a><p id="caption-attachment-10743" class="wp-caption-text">SSIS API Pagination – Next Link from Response Attribute</p></div>
<h3>Next Link &#8211; Detect the last page based on empty rows (Regular Expression)</h3>
<p>Now let&#8217;s look at a little bit different scenario where the Next Link is never empty even on the last page. This can cause an infinite loop if we configure it like the last section. So in such a case (see below example) when the last page still has the next link URL but the data row array is empty then use settings like the screenshot below.</p>
<p><strong>First Page Example</strong></p><pre class="crayon-plain-tag">{ 
  "value" : [....], 
  "odata.nextLink" : "http://abc.com/customers/2/" 
}</pre><p>
<strong>Last Page Example</strong></p><pre class="crayon-plain-tag">{ 
  "value" : [], 
  "odata.nextLink" : "http://abc.com/customers/NNNN/" 
}</pre><p>
<strong>Example: Last Page</strong></p>
<p>Basically, configure the following options</p>
<ul>
<li>Set <b>Stop indicator attribute</b> to the same node which contains data rows (without array brackets). E.g. <strong>$.items</strong></li>
<li>Set <b>Stop indicator value / Regular Expression </b>to something like <pre class="crayon-plain-tag">[]</pre>  assuming the last page has the same way. <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Check Fiddler Trace</a> for exact text on the last page.</li>
</ul>
<div id="attachment_10744" style="width: 678px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-3-Pagination-Detect-the-last-page-based-on-empty-rows.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10744" class="size-full wp-image-10744" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-3-Pagination-Detect-the-last-page-based-on-empty-rows.png" alt="Method-3 Detect the last page based on empty rows " width="668" height="399" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-3-Pagination-Detect-the-last-page-based-on-empty-rows.png 668w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-3-Pagination-Detect-the-last-page-based-on-empty-rows-300x179.png 300w" sizes="(max-width: 668px) 100vw, 668px" /></a><p id="caption-attachment-10744" class="wp-caption-text">Last Page with non empty next link and empty data array (Detect Last Page based on zero row count)</p></div>
<h3>Cursor Method</h3>
<p>Many API returns cursor rather than link. Cursor method usually used to support a large number of records. Cursor is opened at server side with initial query information you submit and if cursor has more records you may get next cursor indicator in your response. In cursor method you have to supply Suffix for Next URL so after First URL your next URL will contain extra attribute which will include pagination information.</p>
<p><strong>Suffix for next URL</strong></p>
<p>Suffix for next URL can include special placeholders. There are two placeholders allowed. If you wish to append Next URL value in raw text then use <strong>&lt;%nextlink%&gt;</strong> but if your API needs value in encoded format e.g. A%20B rather than A+B then you have to use <strong>&lt;%nextlink_encoded%&gt;</strong></p>
<p><strong>Example URLs for Cursor:</strong></p>
<p>Below is few sample URLs in the log when pagination occurs via Cursor method. As you see the first URL has Cursor=* means its first call, after first request server may send next cursor in the response body (see example)</p><pre class="crayon-plain-tag">{ 
&nbsp; data: [....], 
&nbsp; nextCursor: &quot;Aooo/MxxxxxxxxxxxtdA==&quot; 
}</pre><p>
First URL: http://api.crossref.org/members/311/works?filter=type:journal-article&amp;rows=100&amp;cursor=*<br />
Second URL: http://api.crossref.org/members/311/works?filter=type:journal-article&amp;rows=100&amp;cursor=Aooo/MxxxxxxxxxxxtdA==<br />
Third URL: http://api.crossref.org/members/311/works?filter=type:journal-article&amp;rows=100&amp;cursor=Booo/MxxxxxxxxxxxtdA==<br />
&#8230;..<br />
&#8230;..</p>
<h2>Method-4: Pass Page Number in Body Attribute</h2>
<p>Some API allows you to pass your PageSize and Page number inside Request Body (i.e. POST data) in that case you may configure your options like below (We used Google AdWords Api as an example)</p>
<div id="attachment_10745" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10745" class="size-full wp-image-10745" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-pagination.png" alt="Method-4 Pass Page Number in Body Attribute" width="828" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-pagination.png 828w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-pagination-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-pagination-768x682.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10745" class="wp-caption-text">Configure REST API Pagination – using Page Number via POST Body Method</p></div>
<div id="attachment_10746" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-Settings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10746" class="size-full wp-image-10746" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-Settings.png" alt="Method-4: Pass Page Number in Body Attribute example" width="828" height="735" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-Settings.png 828w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-Settings-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-4-Settings-768x682.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10746" class="wp-caption-text">REST API Pagination – Passing PageNumber inside POST Body (Example: Google AdWords SOAP API)</p></div>
<h2>Method-5: REST API Pagination via multiple URL parameters (e.g. Start and End)</h2>
<p>In the previous section, you saw how to pass page numbers via URL (Single Parameter: http://abc.com/?page=1). However, sometimes you have a pagination requirement where you have to specify multiple parameters that need increment. See below example URL.</p><pre class="crayon-plain-tag">http://abc.com/?startRow=1&amp;endRow=100
http://abc.com/?startRow=101&amp;endRow=200
http://abc.com/?startRow=201&amp;endRow=300
...</pre><p>
<div id="attachment_10747" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-5-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10747" class="size-full wp-image-10747" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-5-pagination.png" alt="Method-5: REST API Pagination via multiple URL parameters (e.g. Start and End)" width="828" height="478" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-5-pagination.png 828w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-5-pagination-300x173.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-5-pagination-768x443.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10747" class="wp-caption-text">Pagination via Multiple URL Parameters</p></div>
<h2>Method-6: REST API Pagination via Header (Next Link in Header)</h2>
<p>Another popular pagination method is paginate via Header. In this method, each API response includes special Header which indicates next link for your response. In header method there are two approaches. [1] Custom Method [2] RFC 5988 Method. Lets look at both.</p>
<h3>Next Link in Custom Header</h3>
<p>In this method you have to specify which response header contains next URL. When no more NEXT url found in response reader stops.</p>
<div id="attachment_10749" style="width: 650px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-REST-API-Pagination-via-Header.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10749" class="size-full wp-image-10749" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-REST-API-Pagination-via-Header.png" alt="Method 6 REST API Pagination via Headers" width="640" height="213" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-REST-API-Pagination-via-Header.png 640w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-REST-API-Pagination-via-Header-300x100.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-10749" class="wp-caption-text">Custom Header Pagination Method</p></div>
<h3>Next Link in Header as per RFC 5988</h3>
<p>In this method, HTTP response contains a special header (Link) which contains next link for our response. If no link found to read more data then reader stops. This method is described well here in <a href="https://tools.ietf.org/html/rfc5988" target="_blank" rel="noopener">RFC 5988</a>. Check this <a href="https://developer.github.com/v3/guides/traversing-with-pagination/" target="_blank" rel="noopener">GitHub API Example</a> to understand more on this pagination method.</p>
<div id="attachment_10751" style="width: 696px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Next-Link-in-Header-as-per-RFC-5988.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10751" class="size-full wp-image-10751" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Next-Link-in-Header-as-per-RFC-5988.png" alt="Method 6 Next Link in Header as per RFC 5988" width="686" height="144" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Next-Link-in-Header-as-per-RFC-5988.png 686w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Next-Link-in-Header-as-per-RFC-5988-300x63.png 300w" sizes="(max-width: 686px) 100vw, 686px" /></a><p id="caption-attachment-10751" class="wp-caption-text">Link Header Pagination Method (RFC 5988)</p></div>
<h2>Method-7: REST API Pagination using Cursor / Continuation Token from Response Header</h2>
<p>There will be a time when your API sends some sort of Continuation Token in Response Header and you have to use that token to call next request. Some API needs this token passed as query string in Next URL and in some API you have to pass as request header. We will cover both cases in the following section.</p>
<p>Your API might call these tokens as &#8220;Cursor&#8221; too so we will use these both terms in the following section (They both mean same thing).</p>
<p>There are few ways these APIs pass Cursor to the next request</p>
<ol>
<li>Pass Cursor via Request Header with <strong>same header name</strong></li>
<li>Pass Cursor via Request Header with <strong>different header name (introduced in v4.2.3)</strong></li>
<li>Pass multiple Response Headers via Request Headers (Azure DocumentDB style usecase)</li>
<li>Pass Cursor via URL Query String Parameter (<strong>introduced in v3.0 or later</strong>)</li>
</ol>
<p>Lets see all approaches.</p>
<h3>Pass Token via Request Header (Same header name)</h3>
<p>Consider the API pagination use case in which you get some sort of continuation token in the response header and you take it and pass in the next request via request header (same header name).</p>
<p>Example:</p>
<p><strong>First Request / Response:</strong></p><pre class="crayon-plain-tag">------- Request ------
GET https://abc.com/api/getdata

------- Response ------
x-token: Nxdfabcd11111

{ some response data }</pre><p>
<strong>Second Request / Response:</strong></p><pre class="crayon-plain-tag">------- Request ------
GET https://abc.com/api/getdata
x-token: Nxdfabcd11111

------- Response ------
x-token: Nxdfabcd22222

{ some response data }</pre><p>
&#8230;&#8230;</p>
<p>&#8230;&#8230;</p>
<p><strong>Last Request / Response:</strong></p><pre class="crayon-plain-tag">------- Request ------
GET https://abc.com/api/getdata
x-token: Nxdfabcd22222

------- Response ------

{ some response data }</pre><p>
For above pagination pattern  that just enter the response header name in <strong>Page Num Indicator</strong> field as below</p>
<div id="attachment_10752" style="width: 697px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Pass-Token-via-Request-Header.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10752" class="size-full wp-image-10752" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Pass-Token-via-Request-Header.png" alt="Method 7 Pass Token via Request Header" width="687" height="126" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Pass-Token-via-Request-Header.png 687w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Pass-Token-via-Request-Header-300x55.png 300w" sizes="(max-width: 687px) 100vw, 687px" /></a><p id="caption-attachment-10752" class="wp-caption-text">Pagination using response header continuation token – Pass as Request Header</p></div>
<p>All possible formats for Page Num Indicator is below</p>
<p>x-page-token<br />
x-token1, x-token2<br />
RequestUrlQueryName=ResponseHeaderName<br />
header::RequestHeaderName=ResponseHeaderName<br />
RequestUrlQueryName=ResponseHeaderName(regular-expression)</p>
<h3>Pass Token via Request Header (Different header name)</h3>
<p>Consider the API pagination use case just like previous one but only different is request header name is not same as response header name. For example rather than x-token in request we need to call it x-next-token.</p>
<p>Example:</p>
<p><strong>First Request / Response:</strong></p><pre class="crayon-plain-tag">------- Request ------
GET https://abc.com/api/getdata

------- Response ------
x-token: Nxdfabcd11111

{ some response data }</pre><p>
<strong>Second Request / Response:</strong></p><pre class="crayon-plain-tag">------- Request ------
GET https://abc.com/api/getdata
x-next-token: Nxdfabcd11111

------- Response ------
x-token: Nxdfabcd22222

{ some response data }</pre><p>
&#8230;&#8230;</p>
<p>&#8230;&#8230;</p>
<p><strong>Last Request / Response:</strong></p><pre class="crayon-plain-tag">------- Request ------
GET https://abc.com/api/getdata
x-next-token: Nxdfabcd22222

------- Response ------

{ some response data }</pre><p>
For above pagination pattern  that just enter the response header name in <strong>Page Num Indicator</strong> field as below</p>
<div id="attachment_10753" style="width: 702px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Pass-Token-via-Request-Header.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10753" class="size-full wp-image-10753" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Pass-Token-via-Request-Header.png" alt="Method 7 Pass Token via Request Header " width="692" height="197" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Pass-Token-via-Request-Header.png 692w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Pass-Token-via-Request-Header-300x85.png 300w" sizes="(max-width: 692px) 100vw, 692px" /></a><p id="caption-attachment-10753" class="wp-caption-text">Pagination using response header continuation token – Pass as Request Header (Different name)</p></div>
<h3>Pass multiple Response Headers via Request Headers (Azure DocumentDB style usecase)</h3>
<p>Some API like <a href="https://docs.microsoft.com/en-us/rest/api/cosmos-db/list-documents" target="_blank" rel="noopener">Azure Cosmos DB</a> uses Continuation Token via Header approach. In that case you can enter single header name or multiple headers like below (For multiple headers use comma)</p>
<div id="attachment_10754" style="width: 687px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Pass-multiple-Response-Headers-via-Request-Headers-Azure-DocumentDB-style-usecase.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10754" class="size-full wp-image-10754" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Pass-multiple-Response-Headers-via-Request-Headers-Azure-DocumentDB-style-usecase.png" alt="Method 7 Pass multiple Response Headers via Request Headers" width="677" height="207" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Pass-multiple-Response-Headers-via-Request-Headers-Azure-DocumentDB-style-usecase.png 677w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Pass-multiple-Response-Headers-via-Request-Headers-Azure-DocumentDB-style-usecase-300x92.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-10754" class="wp-caption-text">REST API Pagination using Continuation Token via Header (Azure CosmosDB / DocumentDB API Example )</p></div>
<p>You can use use tools <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">like Fiddler</a> to see paginated requests as below.</p>
<p><strong>First Request</strong></p>
<div id="attachment_10755" style="width: 953px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10755" class="size-full wp-image-10755" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-1.png" alt="Method 7 fiddler example 1" width="943" height="777" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-1.png 943w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-1-300x247.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-1-768x633.png 768w" sizes="(max-width: 943px) 100vw, 943px" /></a><p id="caption-attachment-10755" class="wp-caption-text">View Paginated Requests in Fiddler (Azure CosmosDB API Example)</p></div>
<p><strong>Second Request</strong></p>
<div id="attachment_10756" style="width: 1044px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10756" class="size-full wp-image-10756" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-2.png" alt="Method 7 fiddler reuqest 2 " width="1034" height="785" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-2.png 1034w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-2-300x228.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-2-768x583.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-Fiddler-2-1024x777.png 1024w" sizes="(max-width: 1034px) 100vw, 1034px" /></a><p id="caption-attachment-10756" class="wp-caption-text">Pass Next Page Token via Header (View Paginated Requests in Fiddler – Azure CosmosDB API Example)</p></div>
<h3>Pass Token via URL Parameter (Query String)</h3>
<p>In the new version we added a feature where you can actually read Continuation Token (i.e. Cursor) from Response Header and then pass to next request in the URL rather than Request Header. Here is the <a href="https://api.rosnet.com/#tag/Checks" target="_blank" rel="noopener">example API</a> which uses such method.</p>
<p><strong>First Request</strong></p><pre class="crayon-plain-tag">--------- Request ---------
GET
http://test.com/api/getdata

--------- Response ---------
X-RESPONSE-TOKEN : Pg2xxxxxxxxxxxxxxxxx

{ data : [ 1,2,3.... 10 ] }</pre><p>
<strong>Second Request </strong></p><pre class="crayon-plain-tag">--------- Request ---------
GET
http://test.com/api/getdata?cursor=Pg2xxxxxxxxxxxxxxxxx

--------- Response ---------
X-RESPONSE-TOKEN : Pg3xxxxxxxxxxxxxxxxx

{ data : [ 11,12,13.... 20 ] }</pre><p>
Here is how to configure above pagination pattern</p>
<div id="attachment_10759" style="width: 706px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Pass-Token-via-URL-Parameter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10759" class="size-full wp-image-10759" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Pass-Token-via-URL-Parameter.png" alt="Method 7 Pass Token via URL Parameter (Query String)" width="696" height="148" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Pass-Token-via-URL-Parameter.png 696w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-6-Pass-Token-via-URL-Parameter-300x64.png 300w" sizes="(max-width: 696px) 100vw, 696px" /></a><p id="caption-attachment-10759" class="wp-caption-text">Pass Response Header value to URL (Cursor)</p></div>
<h3>Pass Token via URL Parameter (Query String) &#8211; with custom Regular expression (Usecase: Salesforce BULK query API)</h3>
<p>Now consider previous scenario but with slightly different requirement. By default previous pagination pattern stops when specified response header is missing or response header value is blank. However is some cases header value contains custom string to indicate last page. For example x-token: NULL. In such case we need to use <strong>Page Num Indicator</strong> like below (must use v4.2.3 or higher in SSIS PowerPack / 1.5.2 or higher in ODBC PowerPack)</p><pre class="crayon-plain-tag">nextUrlParameterName=responseHeadername(Some_Regular_Expression)</pre><p>
For example to stop pagination in below case you have to enter Page Num Indicator as below. It says stop pagination when  &#8220;NULL&#8221; word is detected</p><pre class="crayon-plain-tag">cursor=X-RESPONSE-TOKEN(^((?!NULL\b).)*$)</pre><p>
&nbsp;</p>
<p><strong>First Request</strong></p><pre class="crayon-plain-tag">--------- Request ---------
GET
http://test.com/api/getdata

--------- Response ---------
X-RESPONSE-TOKEN : Pg2xxxxxxxxxxxxxxxxx

{ data : [ 1,2,3.... 10 ] }</pre><p>
<strong>Second Request </strong></p><pre class="crayon-plain-tag">--------- Request ---------
GET
http://test.com/api/getdata?cursor=Pg2xxxxxxxxxxxxxxxxx

--------- Response ---------
X-RESPONSE-TOKEN : Pg3xxxxxxxxxxxxxxxxx

{ data : [ 11,12,13.... 20 ] }</pre><p>
&#8230;&#8230;</p>
<p>&#8230;&#8230;</p>
<p><strong>Last Request </strong></p><pre class="crayon-plain-tag">--------- Request ---------
GET
http://test.com/api/getdata?cursor=Pg3xxxxxxxxxxxxxxxxx

--------- Response ---------
X-RESPONSE-TOKEN : NULL

{ data : [ 21,22,23.... 30 ] }</pre><p>
Here is how to configure above pagination pattern</p>
<div id="attachment_10761" style="width: 706px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-with-custom-Regular-expression.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10761" class="size-full wp-image-10761" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-with-custom-Regular-expression.png" alt="Method 7 with custom Regular expression" width="696" height="156" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-with-custom-Regular-expression.png 696w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-7-with-custom-Regular-expression-300x67.png 300w" sizes="(max-width: 696px) 100vw, 696px" /></a><p id="caption-attachment-10761" class="wp-caption-text">Pass Response Header value to URL (Cursor)</p></div>
<h2>Method-8: Pass Pagination Token in Request Body</h2>
<p>In previous section (Method-4: Pass Page Number in Body Attribute ) we saw how to pass simple numeric page counter in Body. This is fine for some API but if your API has base64 style text token then counter based method doesn&#8217;t work. Also if you have requirement to hide page attribute node in first request and send page counter node in second request body (Changing Request Body Pattern for First vs Next)  then check next two sections.</p>
<p>Next two sections covers two API Pagination patterns to fetch 100 rows (1000 in each page) . Both requires to send token in Body but second section is more complex need (Different Body Attributes in first vs next requests )</p>
<h3>Passing Page Token in Body (Blank Token in first request allowed)</h3>
<p>Lets look at simple pattern where first request has blank token in Body but all other requests until we find last page we keep sending non-empty token. This approach works as long as API Provider doesn&#8217;t mind having Blank Token in first request. If you get error then check next section to handle more complex way.</p>
<p>Here is the example of API which needs token in body</p>
<p><strong>First API call</strong></p><pre class="crayon-plain-tag">--------- Request ---------
POST http://test.com/api/getdata

{ searchFor: "Account", continueToken:"" }

--------- Response ---------
{recordsFound: 5000, data: ["Acct1", "Acct2"..., "Acct1000"], nextToken:"AxBxCx112233001==" }</pre><p>
<strong>Second API call</strong></p><pre class="crayon-plain-tag">--------- Request ---------
POST http://test.com/api/getdata

{ searchFor: "Account", continueToken:"AxBxCx112233001==" }

--------- Response ---------
{data: ["Acct1001", "Acct1002"..., "Acct2000"], nextToken:"AxBxCx112233002==" }</pre><p>
&#8230;.. many more calls &#8230;</p>
<p>&#8230;. many more calls &#8230;.</p>
<p><strong>Last API call (no more nextToken in response so STOP pagination)</strong></p><pre class="crayon-plain-tag">--------- Request ---------
POST http://test.com/api/getdata

{ searchFor: "Account", continueToken:"AxBxCx112233009==" }

--------- Response ---------
{data: ["Acct9001", "Acct9002"..., "Acct10000"] }</pre><p>
So if you have such pattern then you can set few properties</p>
<p>For such issue you can use Changing few properties like below. Use Property Grid if you cant find on UI</p>
<ul>
<li>Set EnablePageTokenForBody  = <pre class="crayon-plain-tag">True</pre></li>
<li>Set PagePlaceholders = <pre class="crayon-plain-tag">header=|;filter=|;</pre></li>
<li>Set HttpRequestData = <pre class="crayon-plain-tag">{ searchFor: "Account", continueToken:"[$pagetoken$]" }</pre></li>
</ul>
<div id="attachment_10762" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10762" class="size-full wp-image-10762" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-1.png" alt="Method 8 Pass Passing Page Token in Body 1" width="828" height="488" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-1.png 828w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-1-300x177.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-1-768x453.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10762" class="wp-caption-text">Setting Body with [$pagetoken$] to implement dynamic pagination</p></div>
<div id="attachment_10763" style="width: 838px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10763" class="size-full wp-image-10763" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-2.png" alt="Method 8 advanced pagination tab" width="828" height="437" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-2.png 828w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-2-300x158.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-2-768x405.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Pass-Passing-Page-Token-in-Body-2-720x380.png 720w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-10763" class="wp-caption-text">Setting Page Placeholders in Advanced Pagination tab.</p></div>
<h3>Passing Page Token in Body (Blank Token in first request)</h3>
<p>Now let&#8217;s look at more complex pattern. Here our first request body is different than other requests.</p>
<p><strong>First API call</strong></p><pre class="crayon-plain-tag">--------- Request ---------
POST http://test.com/api/getdata

{ searchFor: "Account" }

--------- Response ---------
{recordsFound: 5000, data: ["Acct1", "Acct2"..., "Acct1000"], nextToken:"AxBxCx112233001==" }</pre><p>
<strong>Second API call</strong></p><pre class="crayon-plain-tag">--------- Request ---------
POST http://test.com/api/getdataNext

{ continueToken:"AxBxCx112233001==" }

--------- Response ---------
{data: ["Acct1001", "Acct1002"..., "Acct2000"], nextToken:"AxBxCx112233002==" }</pre><p>
&#8230;.. many more calls &#8230;</p>
<p>&#8230;. many more calls &#8230;.</p>
<p><strong>Last API call (no more nextToken)</strong></p><pre class="crayon-plain-tag">--------- Request ---------
POST http://test.com/api/getdataNext

{ continueToken:"AxBxCx112233009==" }

--------- Response ---------
{data: ["Acct9001", "Acct9002"..., "Acct10000"] }</pre><p>
So notice few things</p>
<ul>
<li>First Request Body / URL is different than second / third and Nth API call</li>
<li>For first request we do not have token attribute but after first request we do have token attribute</li>
</ul>
<p>We have <a href="https://zappysys.com/blog/call-amazon-mws-api-using-ssis-marketplace-web-service/" target="_blank" rel="noopener">this article</a> and <a href="https://zappysys.com/blog/read-data-netsuite-ssis-simpletalk-soap-api/" target="_blank" rel="noopener">this article</a> which describes similar pattern.</p>
<p>Now lets look at how to solve both problems</p>
<h3>Passing PageToken or Counter in Next API Call Body</h3>
<p>For such issue you can use Changing few properties like below. Use Property Grid if you cant find on UI</p>
<ul>
<li>Set EnablePageTokenForBody  = <pre class="crayon-plain-tag">True</pre></li>
<li>Set PagePlaceholders = <pre class="crayon-plain-tag">header=|;filter=|;</pre></li>
<li>Set HttpRequestData = <pre class="crayon-plain-tag">[$tag$]</pre></li>
<li>Set HasDifferentNextPageInfo = <pre class="crayon-plain-tag">True</pre></li>
<li>Set FirstPageBodyPart = <pre class="crayon-plain-tag">{ searchFor: "Account"}</pre></li>
<li>Set NextPageBodyPart = <pre class="crayon-plain-tag">{ token:"[$pagetoken$]" }</pre></li>
</ul>
<p>So notice how we defined Body in two different properies as template. And in HttpRequestData we used <pre class="crayon-plain-tag">[$tag$]</pre>
<h2>Output Page Number as column</h2>
<p>Sometimes you have use case where you want to Start Page Number from the last page loaded successfully. By default, you will see one additional column __FileName in the output. This column contains PageNumber  from URL for each row. You can save this into database so when next time you run your SSIS you can start at MAX(PageNumber) + 1.</p>
<p>Outputting PageNumber option is not visible by default so Use Property Grid and look for <strong>OutputFileName</strong> property (Default=true)</p>
<h2>Last Page Detection</h2>
<p>Every API may have different way of telling you that you reached last page or no more data found so you should stop looping. SSIS PowerPack comes with many options so you can implement desired logic for last page detection.</p>
<p>Following approaches supported by last page detection. Below options are not applicable if you are using Method#3 (Response contains Next Link / Cursor)</p>
<ol>
<li>Detect the last page by row count</li>
<li>Detect the last page by response status code</li>
<li>Detect the last page by error message (substring search)</li>
<li>Detect the last page by response size</li>
<li>Detect the last page based on response value or regular expression pattern</li>
</ol>
<p>Now lets look at each setting. You should choose correct one based on your API behavior</p>
<h3>Detect the last page by row count</h3>
<p>If your API returns blank document or blank Array (if its JSON) then you can use this method to detect the last page. So when no content found in Response document it will stop pagination.</p>
<p>See below example of JSON API .. It shows sample first page and Sample last page (Assuming you entered Filter as $.Records[*] to extract data from Records array.</p>
<p><strong>First Page</strong></p><pre class="crayon-plain-tag">{&nbsp;
&nbsp; Records : [ {...}, {...}, {...} .........&nbsp;]
}</pre><p>
<strong>Last Page</strong></p><pre class="crayon-plain-tag">{&nbsp;
&nbsp; Records : [&nbsp;&nbsp;]
}</pre><p>
<div id="attachment_10769" style="width: 654px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-row-count.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10769" class="size-full wp-image-10769" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-row-count.png" alt="Method 8 Detect the last page by row count" width="644" height="222" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-row-count.png 644w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-row-count-300x103.png 300w" sizes="(max-width: 644px) 100vw, 644px" /></a><p id="caption-attachment-10769" class="wp-caption-text">SSIS API Pagination – Detect the last page by row count (Blank document or array)</p></div>
<h3>Detect the last page by response status code</h3>
<p>Sometimes you get error with status code when the last page is reached (Most common is 404). So rather than failure, you can treat that status code as last page indicator using this option (see below).</p>
<div id="attachment_10766" style="width: 644px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-response-status-code.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10766" class="size-full wp-image-10766" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-response-status-code.png" alt="Method 8 Detect the last page by response status code" width="634" height="245" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-response-status-code.png 634w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-response-status-code-300x116.png 300w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-10766" class="wp-caption-text">SSIS API Pagination – Detect last page by response status code</p></div>
<h3>Detect the last page by the error message</h3>
<p>If you cant use above two methods and want to detect the last page based on a certain error string in the response then use below approach.</p>
<div id="attachment_10767" style="width: 647px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-the-error-message.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10767" class="size-full wp-image-10767" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-the-error-message.png" alt="Method 8 Detect the last page by the error message" width="637" height="249" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-the-error-message.png 637w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-the-error-message-300x117.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></a><p id="caption-attachment-10767" class="wp-caption-text">SSIS API Pagination – Detect the last page by error/response string search</p></div>
<h3>Detect the last page by response size</h3>
<p>Sometimes you can detect the last page by response size. For example, your response contains &#8220;&#8211;&#8221; only if no more data is found then you cannot use any of the above approaches and you have to detect based on response size (e.g. less than 3 bytes). See below</p>
<div id="attachment_10768" style="width: 654px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-response-size-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10768" class="size-full wp-image-10768" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-response-size-1.png" alt="Method 8 Detect the last page by response size" width="644" height="243" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-response-size-1.png 644w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-by-response-size-1-300x113.png 300w" sizes="(max-width: 644px) 100vw, 644px" /></a><p id="caption-attachment-10768" class="wp-caption-text">SSIS API Pagination – Detect last page by response size</p></div>
<h3>Detect the last page based on the response attribute value</h3>
<p>There will be a time when you want to detect the last page based on some indicator value from your response. In that case, you can use the following settings to detect the last page.</p>
<ul>
<li>Select Paging mode =Response Attribute Mode</li>
<li>Select Next Link Attribute (Example: <strong>$.next_page</strong> )</li>
<li>Select Stop Indicator Attribute (Example: <strong>$.hasMorePages</strong> )</li>
<li>Enter a value for Stop Indicator (Example: <strong>false</strong> )</li>
</ul>
<p>If you don&#8217;t want to use Hardcoded value for stop indicator and want to use expression then see next section.</p>
<h3>Detect the last page based on regular expression pattern</h3>
<p>There will be a time when you want to detect the last page based on some indicator value from your response. In that case, you can use the following settings to detect the last page.</p>
<ul>
<li>Select Paging mode =Response Attribute Mode</li>
<li>Select Next Link Attribute (Example: <strong>$.next_page</strong> )</li>
<li>Select Stop Indicator Attribute (Example: <strong>$.count</strong> )</li>
<li>Enter regex pattern (regular expression) for Stop Indicator (Example: <strong>regex=^\d{1,3}$</strong> ). Stop when count attribute is less than 1000 in other word less than 4 digits.</li>
</ul>
<p>Here is an example from <a href="https://zappysys.com/blog/read-zendesk-data-in-ssis-call-rest-api/" target="_blank" rel="noopener">Zendesk API</a> (Stop pagination when count attribute from the response is less than 1000)</p>
<div id="attachment_10770" style="width: 687px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-based-on-regular-expression-pattern.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10770" class="size-full wp-image-10770" src="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-based-on-regular-expression-pattern.png" alt="Method 8 Detect the last page based on regular expression pattern" width="677" height="418" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-based-on-regular-expression-pattern.png 677w, https://zappysys.com/blog/wp-content/uploads/2016/04/Method-8-Detect-the-last-page-based-on-regular-expression-pattern-300x185.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-10770" class="wp-caption-text">Pagination for Zendesk Incremental API – Next Link and Last Page detection using Stop Indicator Regular Expression</p></div>
<div class="content_block" id="custom_post_widget-9862"><h2>Handling API Rate Limit - Retry on too many API requests</h2>
<p>Many API restricts you from calling too many API calls too soon (just to save their servers from being overwhelmed) - <a href="https://shopify.dev/api/usage/rate-limits" target="_blank" rel="noopener">Example</a>. Let's think this way if you fetching a million rows via paginated response and the very last page fails then you won't be happy because now you have to fetch everything again. To solve this ZappySys provides retry options on HTTP / OAuth and REST API connection managers.</p>

<p>Generally, when you exceed the rate limit, the server sends you <strong>error code 429</strong> but it can be something else too or multiple codes are returned. In the below example, we use 503. Check your API documentation to know the exact code you should retry.</p>

<p>To set the retry options go to connection settings (e.g. HTTP / OAuth / REST connection). The below example is for OAuth connection.</p>

<p>To retry on multiple codes use Pipe as a delimiter. Example: <strong>429|503</strong></p>


<div class="wp-caption alignnone">
 <a href="https://zappysys.com/blog/wp-content/uploads/2018/09/http-retry-settings-oauth-connection.png">
   <img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/09/http-retry-settings-oauth-connection.png" alt="Retry Settings for API Rate Limit Exceeded Error (Status code 429)" />
 </a>
<p class="wp-caption-text">Retry Settings for API Rate Limit Exceeded Error (Status code 429 or other)</p>
</div></div>
<h2>Performance Tips</h2>
<p>You can improve performance of your API calls by doing a few changes (again not every API may support this)</p>
<ul>
<li>Use the maximum page size possible (e.g. if you doing pagination you can set max possible page size &#8211; refer to your API documentation whats the default size and what is the max page size you can supply)<br />
e.g.  /myapi?pagesize=100  (parameter name can be something else like limit=100)</li>
</ul>
<p>&nbsp;</p>
<h2>SSIS Infinite Loop</h2>
<p>So now you know how to paginate automatically in <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Connector</a> but what if you want to use <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">REST API Task</a> for pagination? Some custom scenarios like web scraping require you to download all HTML pages until no more results found? In that case, you most likely need infinite looping pattern (Loop until the last page detected). To loop through pages until the last page is reached you can perform the following logic.</p>
<p>The last page can be detected based on any of the following ways<br />
1. Check Response StatusCode<br />
2. Check Error Message<br />
3. Check Response Size (If less than X bytes then consider as the last page)</p>
<p>REST API Task support #1 and #2 scenarios. If you want to check bytes then use the expression in Expression Task or Script Task<br />
(e.g. @exitloop = LEN(@responseData) &lt;= 3 )</p>
<p><b>URL for Rest API Task (On Request Settings Tab)</b><br />
When you configure REST API Task enter URL as below so its dynamic. You can use PageCounter variable anywhere in the URL.</p><pre class="crayon-plain-tag">//zappysys.com/downloads/files/test/cust-{{User::pagecounter}}.json</pre><p>
<div id="attachment_10771" style="width: 755px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Infinite-Loop-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10771" class="size-full wp-image-10771" src="https://zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Infinite-Loop-1.png" alt="SSIS Infinite Loop part 1 " width="745" height="957" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Infinite-Loop-1.png 745w, https://zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Infinite-Loop-1-234x300.png 234w" sizes="(max-width: 745px) 100vw, 745px" /></a><p id="caption-attachment-10771" class="wp-caption-text">SSIS REST API Looping – Pass Page number in URL, SSIS Infinite Loop</p></div>
<div id="attachment_10772" style="width: 729px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Infinite-Loop-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10772" class="size-full wp-image-10772" src="https://zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Infinite-Loop-2.png" alt="SSIS Infinite Loop part 2" width="719" height="504" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Infinite-Loop-2.png 719w, https://zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Infinite-Loop-2-300x210.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></a><p id="caption-attachment-10772" class="wp-caption-text">Configure For Loop Task for Infinite Looping (Loop until last page found)</p></div>
<h2>Download Sample SSIS Package</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2016/04/SSIS-Loop-Rest-API-2012.dtsx.zip">SSIS-Loop-Rest-API-2012.dtsx (Zip file)</a></p>
<h2>Video Tutorial &#8211; Reading data from API in SSIS</h2>
<p>In case you missed our previous article about <a href="https://zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">calling REST API is SSIS</a> then check below video.</p>
<a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FaO8cVRyCBWw%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>It can be time consuming and steep learning curve to write C#/JAVA code to handle your rest api integration but using some Tasks and Connectors listed below can help you to solve big headache and provide clean drag and drop REST API integration in SSIS for virtually any REST API Source (e.g. Twitter, Facebook, Salesforce, office 365). <a href="//zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> and try it out by yourself.</p>
<h2 class="su-box-title">SSIS Components for REST API/JSON/XML/SOAP</h2>
<div class="su-box-content su-clearfix">
<table>
<tbody>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/SSIS-Json-Source-Adapter.png" alt="Custom SSIS Components - JSON Source (File and REST API Connector)" width="32" /></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener"><span style="color: #248cc8;">JSON Source Connector (File, REST API)</span></a></td>
</tr>
<tr>
<td width="36"><span style="color: #248cc8;"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-export-json-file-task.png" alt="Custom SSIS Tasks - Export JSON File Task" width="32" /></span></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener"><span style="color: #248cc8;">Export JSON File Task</span></a></td>
</tr>
<tr>
<td width="36"><span style="color: #248cc8;"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-json-parser-task.png" alt="Custom SSIS Tasks - JSON Parser Task" width="32" /></span></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-task-free/" target="_blank" rel="noopener"><span style="color: #248cc8;">JSON Parser Task</span></a></td>
</tr>
<tr>
<td width="36"><span style="color: #248cc8;"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-xml-source.png" alt="Custom SSIS Tasks - XML Source Connector (File, SOAP, REST API)" width="32" /></span></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener"><span style="color: #248cc8;">XML Source Connector (File, SOAP, REST API)</span></a></td>
</tr>
</tbody>
</table>
</div>
<p>The post <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/">How to do REST API Pagination in SSIS / ODBC Drivers</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Get list of files in SSIS for Looping</title>
		<link>https://zappysys.com/blog/get-list-of-files-and-folders-in-ssis-for-looping/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 15 Feb 2016 23:35:43 +0000</pubDate>
				<category><![CDATA[SSIS Advanced File System Task]]></category>
		<category><![CDATA[looping]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=344</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to use Advanced File System Task to get list of files and folders into variable. Advanced File System Task is significantly better than native SSIS File System Task How to get list of files in SSIS Most simplest way to get list of files in SSIS is [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-list-of-files-and-folders-in-ssis-for-looping/">Get list of files in SSIS for Looping</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this post you will learn how to use <a href="/products/ssis-powerpack/ssis-file-system-task-advanced/">Advanced File System Task</a> to get list of files and folders into variable. <a href="/products/ssis-powerpack/ssis-file-system-task-advanced/">Advanced File System Task</a> is significantly better than native <a href="https://msdn.microsoft.com/en-us/library/ms140185.aspx" target="_blank" rel="noopener">SSIS File System Task</a></p>
<h2>How to get list of files in SSIS</h2>
<p>Most simplest way to get list of files in SSIS is use wildcard pattern as below screenshot. You can also use Scan Recursive option to include files inside child folders. For advanced filtering options use <strong>Filter and Sorting Tab</strong></p>
<ol>
<li>Download and install <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here</a></li>
<li>From toolbox of SSIS designer drag <a href="/products/ssis-powerpack/ssis-file-system-task-advanced/">ZS Advanced File System Task</a></li>
<li>Double click Advanced File System task to configure it</li>
<li>Select Action as [Get file list as ADO.net DataTable]</li>
<li>Now select files you want to get using wildcard pattern (e.g. c:\ssis\file*.txt)</li>
<li>In the result variable select variable or create new variable with Object datatype. This variable will host file list in the form of ADO.net DataTable</li>
</ol>
<div id="attachment_347" style="width: 586px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-get-file-list-as-recordset-for-looping.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-347" class="size-full wp-image-347" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-get-file-list-as-recordset-for-looping.png" alt="SSIS Advanced File System Task - get file list as ADO.net Recordset into variable" width="576" height="485" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-get-file-list-as-recordset-for-looping.png 576w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-get-file-list-as-recordset-for-looping-300x253.png 300w" sizes="(max-width: 576px) 100vw, 576px" /></a><p id="caption-attachment-347" class="wp-caption-text">SSIS Advanced File System Task &#8211; get file list as ADO.net Recordset into variable</p></div>
<div id="attachment_346" style="width: 635px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-346" class="size-full wp-image-346" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset.png" alt="Loop through files in SSIS using ForEach Loop Task (use ADO.net Recordset variable)" width="625" height="563" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset.png 625w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-300x270.png 300w" sizes="(max-width: 625px) 100vw, 625px" /></a><p id="caption-attachment-346" class="wp-caption-text">Loop through files in SSIS using ForEach Loop Task (use ADO.net Recordset variable)</p></div>
<div id="attachment_345" style="width: 582px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-variable-mapping.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-345" class="size-full wp-image-345" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-variable-mapping.png" alt="Variable Mappings for ForEach Loop Task - Loop through files in a folder using SSIS" width="572" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-variable-mapping.png 572w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-variable-mapping-300x143.png 300w" sizes="(max-width: 572px) 100vw, 572px" /></a><p id="caption-attachment-345" class="wp-caption-text">Variable Mappings for ForEach Loop Task &#8211; Loop through files in a folder using SSIS</p></div>
<h3>Get files modified in last N days</h3>
<p>To get files modified in last N days you can use Advanced File System Task.</p>
<ol>
<li>Download and install <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here</a></li>
<li>From toolbox of SSIS designer drag <a href="/products/ssis-powerpack/ssis-file-system-task-advanced/">ZS Advanced File System Task</a></li>
<li>Double click Advanced File System task to configure it</li>
<li>Select Action as [Get file list as ADO.net DataTable]</li>
<li>Now select files you want to get using wildcard pattern (e.g. c:\ssis\file*.txt)</li>
<li>Go to <strong>Filter and Sorting</strong> tab. In the Where Field enter expression <strong>LastEditInDays &lt; 5</strong> This will give you list of files modified in last 5 days. Here are some more examples.<br />
<pre class="crayon-plain-tag">//////////////////////////////
Examples:
//////////////////////////////
AgeInDays &lt; 5  //Get files created in last 5 days
LastEditInDays &gt; 3 //Get files modified before 3 days
AgeInDays &gt; 10 AND LastEditInDays &lt; 3  //Get files created before 10 days and modified in last 3 days
Size &lt; 1024  //Get files where File size is less than 1024 bytes
CreationDate BETWEEN #2015-01-01# AND #2015-01-01#   
Name IN ('File1.txt', 'Download.msi')
FullPath LIKE 'c:\temp\da*')
Extension IN ('.txt','.csv')
LastModifiedDate &gt; #2013-01-01T16:00:00#
IsReadOnly = True
/////////////////////////////////////////
//Supported Columns for expression:
/////////////////////////////////////////
Name, FullPath, Extension, FolderPath, AgeInDays, LastEditInDays, Size, CreationDate, CreationDateUtc, LastModifiedDate, LastModifiedDateUtc, IsReadOnly</pre>
<div id="attachment_354" style="width: 700px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-get-files-modified-created-in-last-n-days.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-354" class="size-full wp-image-354" src="//zappysys.com/blog/wp-content/uploads/2016/02/ssis-get-files-modified-created-in-last-n-days.png" alt="SSIS Advanced File System Task - Get files modified in last N days" width="690" height="551" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-get-files-modified-created-in-last-n-days.png 690w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-get-files-modified-created-in-last-n-days-300x240.png 300w" sizes="(max-width: 690px) 100vw, 690px" /></a><p id="caption-attachment-354" class="wp-caption-text">SSIS Advanced File System Task &#8211; Get files modified in last N days</p></div></li>
</ol>
<h3>Get files with specific size</h3>
<p>To get files with specific size you can use <strong>Where Expression</strong> on Size attribute (Size is in Bytes)</p>
<ol>
<li>Download and install <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here</a></li>
<li>From toolbox of SSIS designer drag <a href="/products/ssis-powerpack/ssis-file-system-task-advanced/">ZS Advanced File System Task</a></li>
<li>Double click Advanced File System task to configure it</li>
<li>Select Action as [Get file list as ADO.net DataTable]</li>
<li>Now select files you want to get using wildcard pattern (e.g. c:\ssis\file*.txt)</li>
<li>Go to <strong>Filter and Sorting</strong> tab. In the Where Field enter expression <strong>Size &lt; 1024</strong> This will give you list of files which are less than 1024 bytes (e.g 1KB).<br />
<pre class="crayon-plain-tag">Size &lt; 1024</pre>
</li>
</ol>
<h3>Get files with Include/Exclude pattern (Use Regular Expression)</h3>
<p>Sometimes you have need to list files with specific name patterns which is hard to get using simple wildcard then use Advanced Regular Expression option. For this use wildcard in Path (e.g. c:\ssis\*.*) and then in the <strong>Filter and Sorting</strong> tab use Include / Exclude Regular Expressions (e.g. RegX) for file name pattern.</p>
<p>For Example if you want to include all files containing *MMDD.* pattern but not *.zip file or *.gz then use below expressions</p><pre class="crayon-plain-tag">Include ==&amp;gt;  ^w+_\d\d\d\d.\w+$   
Exclude ==&amp;gt;  \.zip|\.gz</pre><p>
<h2>How to get list of folders in SSIS (list directories)</h2>
<p>Coming soon</p>
<h2>Loop through files or folders in SSIS using ForEachLoop Task</h2>
<p>Coming soon</p>
<h2>Read Recordset and load into database (e.g. SQL Server Table)</h2>
<p>Coming soon</p>
<h2>Conclusion</h2>
<p>Microsoft native file system task has very limited features and many scenarios require you to write C# / VB.net Script. But using <a href="/products/ssis-powerpack/ssis-file-system-task-advanced/">ZS Advanced File System Task</a> you can eliminate need for scripting and use simple drag and drop approach. To use this task <a href="/products/ssis-powerpack/">Download SSIS PowerPack</a></p>
<p>The post <a href="https://zappysys.com/blog/get-list-of-files-and-folders-in-ssis-for-looping/">Get list of files in SSIS for Looping</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read Twitter data in SSIS using REST API Call</title>
		<link>https://zappysys.com/blog/read-twitter-data-in-ssis-using-rest-api-task-json-source-oauth2/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 22 Oct 2015 16:09:00 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[json source]]></category>
		<category><![CDATA[looping]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[OAuthApp]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=93</guid>

					<description><![CDATA[<p>Introduction In this article you will how to Read Twitter data in SSIS using SSIS JSON Source and SSIS REST API Web Service Task. You will also learn about latest OAuth 2.0 Protocol to simplify REST API access. Twitter REST API Authentication In order to fetch any data from twitter using OAuth REST API calls [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-twitter-data-in-ssis-using-rest-api-task-json-source-oauth2/">How to read Twitter data in SSIS using REST 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="//zappysys.com/blog/wp-content/uploads/2015/10/twitter-api-integration.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1660" src="//zappysys.com/blog/wp-content/uploads/2015/10/twitter-api-integration.png" alt="" width="180" height="146" /></a>In this article you will <em>how to Read Twitter data in SSIS</em> using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Web Service Task</a>. You will also learn about latest OAuth 2.0 Protocol to simplify REST API access.</p>
<h2>Twitter REST API Authentication</h2>
<p>In order to fetch any data from twitter using OAuth REST API calls you have to obtain two Keys (Consumer Key [Like UserID] and Consumer Secret [Like Password]). There are mainly two methods to read data from Twitter. Using <strong>Application-user authentication</strong> and <strong>Application Only authentication</strong>. Use correct method depending what type of information you want to pull from twitter. Most common method is <strong>Application-user authentication</strong> . If you want to read more about other methods then <a href="https://developer.twitter.com/en/docs/basics/authentication/overview" target="_blank" rel="noopener">click here</a></p>
<h2>Method 1 &#8211; Read Twitter data in SSIS using Application-user authentication</h2>
<p>In this method you will need twitter user account to connect Twitter API. Once first time authorization is done you don&#8217;t have to re-authenticate. Certain type of API calls only allowed by this method (such as POST new tweet using API). For any API call in Twitter very first step is create OAuth App (i.e. Register new App in Twitter developer portal).</p>
<h3>Using Default OAuth App Created by ZappySys</h3>
<p>To make your life easy ZappySys provides default App for certain OAuth providers (e.g. Google, Twitter). If you decide to create your own app for whatever reason then check next section on how to register twitter OAuth Application. See below screenshot how to use Twitter OAuth connection using Default App. Once you click Generate Token it will prompt you to login using Twitter account and then you can grant permission.</p>
<p><strong>Step-By-Step</strong></p>
<ol>
<li>Download and Install <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack FREE Trial</a> from <a href="//zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">this link</a></li>
<li>Create new SSIS Project and add new package.</li>
<li>Open Package. Go to control flow. Drag and drop Data Flow task from SSIS Toolbox
<div id="attachment_8028" style="width: 470px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8028" class="size-full wp-image-8028" src="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" alt="" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a><p id="caption-attachment-8028" class="wp-caption-text">Dragging and dropping Data Flow Task into Control Flow</p></div></li>
<li>Go to Data flow designer.Drag and drop ZS JSON Source Component and double on it to configure it.
<div id="attachment_3766" style="width: 604px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-source-for-getting-basic-profile-from-linkedin.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3766" class="size-full wp-image-3766" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-source-for-getting-basic-profile-from-linkedin.png" alt="Drag and Drop JSON Source Component" width="594" height="268" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-source-for-getting-basic-profile-from-linkedin.png 594w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-json-source-for-getting-basic-profile-from-linkedin-300x135.png 300w" sizes="(max-width: 594px) 100vw, 594px" /></a><p id="caption-attachment-3766" class="wp-caption-text">Drag and Drop JSON Source Component</p></div></li>
<li>Enter any twitter API URL you want to call such as below<br />
<pre class="crayon-plain-tag">https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=zappysys&amp;count=4</pre>
</li>
<li>Now check use credentials option</li>
<li>Select new ZS-OAuth connection from dropdown</li>
<li>When new connection dialogbox pops up select Twitter from providers dropdown. Select Default App option for now.</li>
<li>Click Generate Token. It may ask you to login using your Twitter account credentials. If prompted click Approve.</li>
<li>If twitter OAuth grant approved then you will see Access Token and Access Token Secret both populated</li>
<li>Click Test Connection and if it works then click OK to close connection</li>
<li>On JSON Source you can now click Preview to see data from Twitter</li>
<li>You can optionally specify Filter expression [Click Select Filter button] to select result from specific JSON Node. For example if you want to select all Hashtags used inside each Tweet then select Filter like <strong>$.entities.hashtags[*]</strong></li>
<li>Click OK to close the UI</li>
<li>Drag ZS Trash Destination from Toolbox (Or you can use OLEDB Destination if you want to load inside SQL Server)</li>
<li>Connect JSON Source to ZS Trash Destination</li>
<li>Execute SSIS package</li>
</ol>
<div id="attachment_652" style="width: 710px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/fetch-twitter-data-rest-api-call-ssis-oauth-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-652" class="wp-image-652" src="//zappysys.com/blog/wp-content/uploads/2015/10/fetch-twitter-data-rest-api-call-ssis-oauth-connection.png" alt="Call Twitter REST API in SSIS - using OAuth Connection (Default App)" width="700" height="592" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/fetch-twitter-data-rest-api-call-ssis-oauth-connection.png 867w, https://zappysys.com/blog/wp-content/uploads/2015/10/fetch-twitter-data-rest-api-call-ssis-oauth-connection-300x254.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-652" class="wp-caption-text">Call Twitter REST API in SSIS &#8211; using OAuth Connection (Default App)</p></div>
<h3>Using Custom OAuth App Created by you</h3>
<p>For some reason if you dont want to use Default Twitter App then you can register Custom App. It requires few extra steps listed in next section but it wont take more than few minutes. In Custom App option you have to specify ClientId and Client Secret (in above screenshot). Once you click Generate Token it will prompt you to login using Twitter account and then you can grant permission.</p>
<h3>Register/Create OAuth Application for twitter API Access</h3>
<p>Now lets look at how to register OAuth Application for Twitter API access.</p>
<p>Goto <a href="https://apps.twitter.com/app/new" target="_blank" rel="noopener">https://apps.twitter.com/app/new</a> and create new app by providing necessary information. Don&#8217;t get confused by calling it App, its just way in twitter to create multiple API Access Keys so you can grant different level of access to different users. Once app is created you will be taken to page where your Consumer Key and Secret Key will be listed.</p>
<div id="attachment_103" style="width: 502px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/create-twitter-app-access-new-consumer-key-secreat-key.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-103" class="size-full wp-image-103" src="//zappysys.com/blog/wp-content/uploads/2015/10/create-twitter-app-access-new-consumer-key-secreat-key.png" alt="Create Twitter Application - REST API Access for Developer" width="492" height="643" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/create-twitter-app-access-new-consumer-key-secreat-key.png 492w, https://zappysys.com/blog/wp-content/uploads/2015/10/create-twitter-app-access-new-consumer-key-secreat-key-230x300.png 230w" sizes="(max-width: 492px) 100vw, 492px" /></a><p id="caption-attachment-103" class="wp-caption-text">Create Twitter Application &#8211; REST API Access for Developer</p></div>
<h3>Obtaining Consumer Key and Consumer Secret from Twitter</h3>
<p>Once app is created you can go to <b>Keys and Access Tokens</b> tab. Here you will find Consumer Key and Consumer Secret.<br />
Consumer Key can be Public but Consumer Secret must not be shared (think it like a password).</p>
<div id="attachment_102" style="width: 661px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/twitter-api-consumer-key-and-access-key.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-102" class="size-full wp-image-102" src="//zappysys.com/blog/wp-content/uploads/2015/10/twitter-api-consumer-key-and-access-key.png" alt="Obtain Twitter API Consumer Key and Consumer Secret - REST API Access for Developer" width="651" height="465" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/twitter-api-consumer-key-and-access-key.png 651w, https://zappysys.com/blog/wp-content/uploads/2015/10/twitter-api-consumer-key-and-access-key-300x214.png 300w" sizes="(max-width: 651px) 100vw, 651px" /></a><p id="caption-attachment-102" class="wp-caption-text">Obtain Twitter API Consumer Key and Consumer Secret &#8211; REST API Access for Developer</p></div>
<h2>Method 2 &#8211; Read Twitter data in SSIS &#8211; Application-only authentication</h2>
<p>For some reason if you don&#8217;t want to use Twitter user account to access data (e.g. Giving access to consultant so he can access you company Twitter Account via API). In this scenario you have to use Application Only method. In this method you don&#8217;t authorize application using Login form.</p>
<p>Here is our basic flow to access twitter data.</p>
<ol>
<li>Get Bearer Access Token by calling https://api.twitter.com/oauth2/token service (Use POST method and Pass BASE64 encoded ConsumerKey and Consumer Secret)</li>
<li>Call any twitter service by passing Bearer AccessToken we retrieved in previous step.<strong>NOTE:</strong> Any access to twitter service is over HTTPS so automatically your tokens passed along request is encrypted before sending over wire unless someone know how to hack SSL 🙂</li>
</ol>
<h3>Application Only Authentication using REST API task &#8211; Get Access Token</h3>
<p>Once we create SSIS Package &#8211; First step to access any twitter data will be get Access Token. As you can see from below screenshot we have called https://api.twitter.com/oauth2/token service URL with POST method. Notice how we have supplied POST data and 2 headers. Authorization header contains BASE64 encoded value of <strong>YourConsumerKey:YourConsumerSecret</strong></p>
<div id="attachment_107" style="width: 841px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/ssis-twitter-rest-api-call-get-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-107" class="size-full wp-image-107" src="//zappysys.com/blog/wp-content/uploads/2015/10/ssis-twitter-rest-api-call-get-token.png" alt="SSIS Twitter REST API Get Token" width="831" height="465" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-twitter-rest-api-call-get-token.png 831w, https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-twitter-rest-api-call-get-token-300x168.png 300w" sizes="(max-width: 831px) 100vw, 831px" /></a><p id="caption-attachment-107" class="wp-caption-text">SSIS Twitter REST API Get Token</p></div>
<h3>Fetch data from Twitter using JSON Source &#8211; Deformalize nested JSON</h3>
<p>Once we have Authentication Token we are ready <b>pull twitter data</b> using JSON Source. Check below screenshot how we have supplied Token in Authorization Header. JSON Source can make your JSON look like normal table (It also de-normalize nested JSON into flat dataset. If you want to extract subset of JSON then simply specify JSON Path expression e.g. $.data.users[*]
<div id="attachment_108" style="width: 852px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/read-twitter-data-in-ssis-json-source-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-108" class="size-full wp-image-108" src="//zappysys.com/blog/wp-content/uploads/2015/10/read-twitter-data-in-ssis-json-source-rest-api.png" alt="Read JSON response of Twitter REST API in SSIS" width="842" height="520" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/read-twitter-data-in-ssis-json-source-rest-api.png 842w, https://zappysys.com/blog/wp-content/uploads/2015/10/read-twitter-data-in-ssis-json-source-rest-api-300x185.png 300w" sizes="(max-width: 842px) 100vw, 842px" /></a><p id="caption-attachment-108" class="wp-caption-text">Read JSON response of Twitter REST API in SSIS</p></div>
<h3>Load Twitter JSON data to SQL Server</h3>
<p>You can easily connect your <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source</a> to OLEDB Destination if you want to load Twitter Data to some RDBMS such as SQL Server, MySQL.</p>
<h2>Handling paging of large REST API result set with twitter data &#8211; looping/cursoring</h2>
<p>Most of REST API limit total data sent in single response. So if you wish to get all records then you have to loop through multiple results. Twitter provides looping mechanism using Cursor<a href="https://dev.twitter.com/overview/api/cursoring" target="_blank" rel="noopener">Click here to read more</a></p>
<p>In our case <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source</a> Supports Paging very well so we are covered. To loop through multiple result sets of twitter data simply configure following 3 properties. See below screenshot.</p>
<div id="attachment_100" style="width: 514px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/loop-through-twitter-rest-api-result-cursor-paging.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-100" class="size-full wp-image-100" src="//zappysys.com/blog/wp-content/uploads/2015/10/loop-through-twitter-rest-api-result-cursor-paging.png" alt="Twitter REST API - Paging Example -Loop through resultset using cursor" width="504" height="440" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/loop-through-twitter-rest-api-result-cursor-paging.png 504w, https://zappysys.com/blog/wp-content/uploads/2015/10/loop-through-twitter-rest-api-result-cursor-paging-300x262.png 300w" sizes="(max-width: 504px) 100vw, 504px" /></a><p id="caption-attachment-100" class="wp-caption-text">Twitter REST API &#8211; Paging Example -Loop through resultset using cursor</p></div>
<h2>Word of caution about too many requests</h2>
<p>Twitter does not allow you request too much data too quickly so be careful how many requests you make :). Check their official page on twitter Rate Limit for REST API. You can add delay after each request if you doing pagination. Go to <strong>Throttling tab</strong> of JSON/XML Source. You can change setting there based on API restriction. For example if API allows only 30 requests per minute then adding 2 seconds delay will make sure you wont exceed 30 requests in 1 minute.</p>
<p>To learn more about <a href="https://dev.twitter.com/rest/public/rate-limits" target="_blank" rel="noopener">rate limit of Twitter API check this table</a></p>
<h2>Handling Twitter API Date Format (Parse Twitter Date/Time)</h2>
<p>Twitter returns date in the following format e.g. Fri May 03 15:22:09 +0000 2013 to parse this to correct date/time datatype you can use Date/Time Handling Tab of JSON/XML Source.</p>
<p>Change Custom Date Format as below and preview Twitter data.</p>
<div id="attachment_693" style="width: 821px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/parse-twitter-date-time-format.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-693" class="size-full wp-image-693" src="//zappysys.com/blog/wp-content/uploads/2015/10/parse-twitter-date-time-format.png" alt="Parsing Twitter API date/time format" width="811" height="249" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/parse-twitter-date-time-format.png 811w, https://zappysys.com/blog/wp-content/uploads/2015/10/parse-twitter-date-time-format-300x92.png 300w" sizes="(max-width: 811px) 100vw, 811px" /></a><p id="caption-attachment-693" class="wp-caption-text">Parsing Twitter API date/time format</p></div>
<h2>Download related files</h2>
<p>Below is sample SSIS package<br />
<a href="//zappysys.com/blog/wp-content/uploads/2015/11/TwitterFetchDemo_2012.zip">Twitter Demo SSIS 2012</a></p>
<h2>Conclusion</h2>
<p>So you have now seen how easy it is to access twitter data with OAuth 2.0 using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Web Service Task</a>. We have also seen how to loop through large resultset using inbuilt Paging support of JSON Source.</p>
<p>The post <a href="https://zappysys.com/blog/read-twitter-data-in-ssis-using-rest-api-task-json-source-oauth2/">How to read Twitter data in SSIS using REST API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
