<?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>pagination Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/pagination/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/pagination/</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>pagination Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/pagination/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Read/Write ManageEngine ServiceDesk Data in SSIS (Zoho API)</title>
		<link>https://zappysys.com/blog/read-write-manageengine-servicedesk-data-ssis-zoho-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 28 Apr 2022 18:38:33 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[manageengine]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[servicedesk]]></category>
		<category><![CDATA[zoho]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=9624</guid>

					<description><![CDATA[<p>Introduction In this post, you will learn how to read / write ManageEngine ServiceDesk data in SSIS (Drag and drop approach without any coding).  We will use SSIS JSON/ REST API Source to extract data from Servicedesk API and use SSIS Web API Destination to write data to Zoho. We will look at step-by-step instructions to read ServiceDesk  data [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-write-manageengine-servicedesk-data-ssis-zoho-api/">Read/Write ManageEngine ServiceDesk Data in SSIS (Zoho API)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/zoho-managedengine-service-desk-plus-connector/">API Connector for Zoho / ManageEngine ServiceDesk Pro OnDemand (Cloud Version)</a> which makes it much simpler to <strong>Read/Write ServiceDesk Data in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).</p>
</div></div>
<p>In this post, you will learn how to read / write ManageEngine ServiceDesk data in SSIS (Drag and drop approach without any coding).  We will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON/ REST API Source</a> to extract data from Servicedesk API and use <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">SSIS Web API Destination</a> to write data to Zoho.</p>
<p>We will look at step-by-step instructions to read ServiceDesk  data (e.g. Request, Problems, Contacts) and load into SQL Server Database Table.</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Authentication ServiceDesk REST API in SSIS (Use OAuth 2.0)</h2>
<p>Very first step to call ServiceDesk API is you need to register OAuth App in Zoho Portal. Don&#8217;t get confused if you see Zoho Portal for ServiceDesk a Product from ManageEngine is in fact Zoho subsidiary (in other words Zoho is the parent company). ServiceDesk has On-Premises version too but this article is only about Cloud version.</p>
<h3>Register Zoho OAuth App and get ClientID/ Secret (*** MUST READ ***)</h3>
<p><a href="https://zappysys.com/blog/register-oauth-app-zoho-api/" target="_blank" rel="noopener">Check this article</a> to register your OAuth App and obtain Client ID  /Client Secret</p>
<h3>Create ServiceDesk API Connection in SSIS</h3>
<p>Once you create Zoho OAuth App now its time to call some Zoho API. Let&#8217;s create the OAuth Connection first. In the next section we will see how to load data in SQL Server.</p>
<ol>
<li>Right click on Connection Panel and choose Choose &#8220;New Connection..&#8221;. Select <strong>ZS-OAUTH</strong> type
<div id="attachment_1569" style="width: 687px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png"><img decoding="async" aria-describedby="caption-attachment-1569" class="size-full wp-image-1569" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png" alt="Create new SSIS OAuth API Connection Manager" width="677" height="220" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection-300x97.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-1569" class="wp-caption-text">Create new SSIS OAuth API Connection Manager</p></div></li>
<li>Configure your OAuth connection General Tab as below</li>
<li>OAuth Provider: <strong>Custom</strong></li>
<li>OAuth Version: <strong>OAuth2</strong></li>
<li><strong>Client Id</strong> , <strong>Client Secret </strong></li>
<li>Enter One Scope Per Line (For more info on scope <a href="https://www.manageengine.com/products/service-desk/sdpod-v3-api/getting-started/oauth-2.0.html#scopes" target="_blank" rel="noopener">read here</a>) . For write you can change READ to WRITE or use ALL as per the help link.<br />
<pre class="crayon-plain-tag">SDPOnDemand.requests.READ</pre>
</li>
<li>Auth URL : <strong>https://accounts.zoho.com/oauth/v2/auth</strong></li>
<li>Token URL:  <strong><strong>https://accounts.zoho.com/oauth/v2/token</strong></strong><a href="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-configure-oauth-token-url-scopes.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-9617" src="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-configure-oauth-token-url-scopes.png" alt="" width="577" height="328" srcset="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-configure-oauth-token-url-scopes.png 577w, https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-configure-oauth-token-url-scopes-300x171.png 300w" sizes="(max-width: 577px) 100vw, 577px" /></a></li>
<li>Configure Advanced tab as below</li>
<li>Enter Callback URL : <strong>https://zappysys.com/oauth</strong></li>
<li>Enter Extra Attribute for /Auth : <strong>access_type=offline&amp;prompt=consent</strong><br />
This is needed to obtain refresh_token (if you ommit this then only access_token returned which cannot be renewed once expired after 1hr)</p>
<div class="mceTemp"></div>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-oauth-redirect-callback-url.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-9618" src="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-oauth-redirect-callback-url.png" alt="" width="551" height="320" srcset="https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-oauth-redirect-callback-url.png 551w, https://zappysys.com/blog/wp-content/uploads/2022/04/zoho-api-oauth-redirect-callback-url-300x174.png 300w" sizes="(max-width: 551px) 100vw, 551px" /></a></li>
<li>Now go back to general tab and <strong>Click Generate Token</strong>. Close the Popup and use Full browser instead if you see prompt.</li>
<li>Click OK to save the connection UI</li>
</ol>
<h2>Read data from ServiceDesk API in SSIS JSON Source</h2>
<p>In this section we will learn how to read data from ServiceDesk using SSIS JSON Source. We will use OAuth connection created in earlier section.</p>
<p>Now lets look at step by step example of reading ManageEngine ServiceDesk data using SSIS (e.g. Requests).</p>
<p>ManageEngine provides JSON API for read action so we will Use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source</a> for this purpose.</p>
<h3>Configure JSON Source</h3>
<p>So below steps shows example of reading from ManageEngine Requests API</p>
<ol>
<li>Open SSIS Package</li>
<li>Drag data flow task from Control flow SSIS Toolbox
<div style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="Drag data flow from SSIS Toolbox" width="460" height="155" /><p class="wp-caption-text">Drag data flow from SSIS Toolbox</p></div></li>
<li>Go to data flow and drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> from SSIS Toolbox
<div style="width: 551px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="Drag and drop SSIS JSON Source (REST API or File)" width="541" height="144" /><p class="wp-caption-text">Drag and drop SSIS JSON Source (REST API or File)</p></div></li>
<li>Double click JSON Source to configure. Enter URL as below. You can supply few more parameters. <a href="https://www.zoho.com/crm/developer/docs/api/get-records.html" target="_blank" rel="noopener">Click Here to get full list of parameters and usage</a>. In below example we are reading records from Leads Module but you can replace Leads to something else (e.g. Accounts). Refer to above help link for available Modules.<br />
<pre class="crayon-plain-tag">https://sdpondemand.manageengine.com/api/v3/requests</pre>
</li>
<li>Check Use Credentials. Select OAuth connection manager we created in the previous section.</li>
<li>Add the Accept header in HTTP Headers.<br />
<pre class="crayon-plain-tag">Accept: application/vnd.manageengine.sdp.v3+json</pre>
</li>
<li>Under filter options tab, enter <strong>Array Filter</strong> as  <pre class="crayon-plain-tag">$.requests[*]</pre></li>
<li>Now click Preview to see your data</li>
<li>Click OK to save UI. In the next section, we will see how to setup pagination and incremental extract of Servicedesk records. After that we will see how to load data into SQL Server Table.</li>
</ol>
<div id="attachment_9626" style="width: 961px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-data-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9626" class="size-full wp-image-9626" src="https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-data-api.png" alt="Read ManageEngine ServiceDesk Plus data in SSIS (Cloud Version) - Zoho API" width="951" height="909" srcset="https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-data-api.png 951w, https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-data-api-300x287.png 300w, https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-data-api-768x734.png 768w" sizes="(max-width: 951px) 100vw, 951px" /></a><p id="caption-attachment-9626" class="wp-caption-text">Read ManageEngine ServiceDesk Plus data in SSIS (Cloud Version) &#8211; Zoho API</p></div>
<h3>ServiceDesk API Pagination (Read all Requests)</h3>
<p>Just like most API ServiceDesk also uses pagination. See below to learn how to configure pagination in JSON Source for ServiceDesk API.</p>
<ol>
<li>Double click JSON Source</li>
<li>Change URL to include two things (Page size (how many rows per page and start row). Note &lt;%page%&gt; must match with <strong>Page Num Indicator </strong>you going enter in the next screen<br />
<pre class="crayon-plain-tag">https://sdpondemand.manageengine.com/api/v3/requests?input_data={"list_info":{"row_count":100,"start_index":&lt;%page%&gt;}}</pre>
</li>
<li>Go to <strong>Pagination</strong> Tab and select <strong>URL Path Mode</strong></li>
<li>For <strong>Page Num Indicator</strong> : Enter <pre class="crayon-plain-tag">&lt;%page%&gt;</pre></li>
<li>For <strong>Increment By</strong> : Enter <pre class="crayon-plain-tag">100</pre></li>
<li>Page Start Number select New variable call it StartIndex and start default value <strong>1</strong></li>
</ol>
<p>Once you configure this way now your API will return all records until last page is detected. For more information on pagination <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">check this article</a></p>
<div id="attachment_9628" style="width: 1043px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-api-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9628" class="size-full wp-image-9628" src="https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-api-pagination.png" alt="How to paginate ManageEngine ServiceDesk API" width="1033" height="1006" srcset="https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-api-pagination.png 1033w, https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-api-pagination-300x292.png 300w, https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-api-pagination-768x748.png 768w, https://zappysys.com/blog/wp-content/uploads/2022/04/ssis-read-manageengine-servicedesk-api-pagination-1024x997.png 1024w" sizes="(max-width: 1033px) 100vw, 1033px" /></a><p id="caption-attachment-9628" class="wp-caption-text">How to paginate ManageEngine ServiceDesk API</p></div>
<h3>Loading ServiceDesk data into SQL Server Table / Other Target</h3>
<div class="content_block" id="custom_post_widget-5617"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination</strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.</p>
<h3>Step 1: Add Upsert Destination to Data Flow</h3>
<ol>
<li>Drag and drop the <strong>Upsert Destination</strong> component from the SSIS Toolbox.</li>
<li>Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png" /></a>
<p class="wp-caption-text">SSIS - Data Flow - Drang and Drop Upsert Destination Component</p>
</div>
<h3>Step 2: Configure Target Connection</h3>
<ol>
<li>Double-click the <strong>Upsert Destination</strong> component to open the configuration window.</li>
<li>Under <strong>Connection</strong>, select an existing target connection or click <strong>NEW</strong> to create a new connection.
<ul>
<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.</li>
</ul>
</li>
</ol>
<h3>Step 3: Select or Create Target Table</h3>
<ol>
<li>In the <strong>Target Table</strong> dropdown, select the table where you want to load data.</li>
<li>Optionally, click <strong>NEW</strong> to create a new table based on the source columns.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png" /></a>
<p class="wp-caption-text">Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS</p>
</div>
<h3>Step 4: Map Columns</h3>
<ol>
<li>Go to the <strong>Mappings</strong> tab.</li>
<li>Click <strong>Auto Map</strong> to map source columns to target columns by name.</li>
<li>Ensure you <strong>check the Primary key column(s)</strong> that will determine whether a record is inserted or updated.</li>
<li>You can manually adjust the mappings if necessary.</li>
</ol>
 <div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination - Columns Mappings</p>
</div>
<h3>Step 5: Save Settings</h3>
<ul>
<li>Click <strong>OK</strong> to save the Upsert Destination configuration.</li>
</ul>
<h3>Step 6: Optional: Add Logging or Analysis</h3>
<ul>
<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.</li>
</ul>
<h3>Step 7: Execute the Package</h3>
<ul>
<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.</li>
</ul>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination Execution</p>
</div></div>
<h3>Write data to ServiceDesk using OAuth 2.0</h3>
<p>If you like to load data from any source (i.e. SQL Server) to Zoho CRM then you can use <a href="https://www.zoho.com/crm/developer/docs/api/insert-records.html" target="_blank" rel="noopener">Records API (POST)</a>. Use a combination of the following Transforms  / Components. Later in this article we have some more examples (Older API) which may give you one more ways to load data into Zoho (Use of Template Transform).</p>
<p>Basically you have to build POST Body using JSON Generator Transform or Template Transform and then use that data in Web API Destination to call POST API request to push data to ServiceDesk. Basically screnshot below is just an example using some other Zoho API but you get the idea.</p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr class="su-even">
<td width="36"><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png?w=32&amp;ssl=1" alt="Custom SSIS Tasks - Call REST API Webservice (GET, POST, DELETE etc)" width="32" height="32" /></td>
<td><u><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></u></td>
</tr>
<tr>
<td width="36" height="36"><img loading="lazy" decoding="async" class="alignnone" src="https://zappysys.com/images/SSIS-PowerPack/ssis-json-generator-transform.png" alt="JSON Generator Transform" width="32" height="32" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a></td>
</tr>
<tr class="su-even">
<td width="36"><img loading="lazy" decoding="async" class="alignnone" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-parser-transform/ssis-json-parser-transform.png" alt="XML Parser Transform" width="32" height="32" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></td>
</tr>
</tbody>
</table>
</div>
<div id="attachment_8312" style="width: 678px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-json-generator-single-dataset-zoho-write.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8312" class="size-full wp-image-8312" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-json-generator-single-dataset-zoho-write.png" alt="Create JSON for POST request (Single dataset pattern)" width="668" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-json-generator-single-dataset-zoho-write.png 668w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-json-generator-single-dataset-zoho-write-275x300.png 275w" sizes="(max-width: 668px) 100vw, 668px" /></a><p id="caption-attachment-8312" class="wp-caption-text">Create JSON for POST request (Single dataset pattern)</p></div>
<p>&nbsp;</p>
<div id="attachment_8313" style="width: 757px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-write-data-bulk-insert-leads-accounts.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8313" class="size-full wp-image-8313" src="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-write-data-bulk-insert-leads-accounts.png" alt="Insert data to Zoho Table using SSIS (Lead, Account Modules) - Bulk Load using POST API call" width="747" height="630" srcset="https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-write-data-bulk-insert-leads-accounts.png 747w, https://zappysys.com/blog/wp-content/uploads/2018/02/ssis-zoho-write-data-bulk-insert-leads-accounts-300x253.png 300w" sizes="(max-width: 747px) 100vw, 747px" /></a><p id="caption-attachment-8313" class="wp-caption-text">Insert data to Zoho Table using SSIS (Lead, Account Modules) &#8211; Bulk Load using POST API call</p></div>
<h2>Write data to ServiceDesk using SSIS (Import SQL Server Table to ServiceDesk)</h2>
<p>Now you know how to read data from Zoho CRM using JSON API Source next step is to load data to Zoho CRM. For writing data we will use following three components</p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr class="su-even">
<td width="36"><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png?w=32&amp;ssl=1" alt="Custom SSIS Tasks - Call REST API Webservice (GET, POST, DELETE etc)" width="32" height="32" /></td>
<td><u><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></u></td>
</tr>
<tr>
<td width="36" height="36"></td>
<td>Template Transform</td>
</tr>
<tr class="su-even">
<td width="36"><img loading="lazy" decoding="async" class="alignnone" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/xml-parser-transform/ssis-xml-parser-transform.png" alt="XML Parser Transform" width="32" height="32" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-parser-transform/" target="_blank" rel="noopener">XML Parser Transform</a></td>
</tr>
</tbody>
</table>
</div>
<div class="mceTemp"></div>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<div class="content_block" id="custom_post_widget-2021"><h2>Things have gone bad: Error handling &amp; debugging</h2>
<p style="text-align: justify;">Incidentally, bad things can happen<i>. </i>A remote server may go offline or your server may go out of memory. In any case, you may want to know when that happens and take actions accordingly. For that purpose, you have to redirect bad rows to some other destination. For this example, we will take and use <em>Web API Destination</em>, but basically, you can use any SSIS component:</p>

<h3>Handling errors</h3>
<ol style="margin-left: 0;">
 	<li>Add a <em>Derived Column</em> above <em>Web API Destination</em> with expression <strong>"(DT_WSTR,4000)ZS_JSON_OUT"</strong> and name it <strong>"JsonAsString"</strong>. This will let you see what JSON you are actually passing.</li>
 	<li>Then add a database or file destination or use another <em>Trash Destination</em> for debugging purposes and redirect the bad rows (<span style="color: #d66565;">red arrow</span>) from <em><em>Web API Destination </em></em>into it<em><em>. </em></em>Don't forget to set <span class="lang:default decode:true crayon-inline">Redirect row</span> option for both, <em>Error</em> and <em>Truncation</em> columns:<em><em>
</em></em>
<div class="wp-caption">

<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1487 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" alt="Redirect bad rows from &lt;em&gt;Web API Destination&lt;/em&gt; to &lt;em&gt;Trash Destination&lt;/em&gt; when load from SQL Server to Elasticsearch is failing. Add derived column JsonAsString to be able to read JSON you are using." width="739" height="267" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png 739w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows-300x108.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></a>
<p class="wp-caption-text">Redirected failed requests from <em>Web API Destination</em> to a desired destination when loading from SQL Server to REST API Service is failing. Derived Column <em>JsonAsString</em> added to be able to read JSON which was passed to Elasticsearch</p>

</div></li>
 	<li>Finally, add a <a href="https://technet.microsoft.com/en-us/library/ms140318%28v=sql.90%29.aspx?f=255&amp;MSPPError=-2147217396" target="_blank" rel="noopener"><em>Data Viewer</em></a> for the red path, if you want to debug the flow. You will be able to see URL, JSON and the error message for each record. You may want to copy-paste <em>ErrorMessage</em> to <em>Notepad </em>if you want it to be more readable:
<div class="wp-caption">

<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1494 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" alt="Use Data Viewer to view HTTP requests that failed to be fulfilled in Elasticsearch" width="752" height="280" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png 752w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-300x112.png 300w" sizes="(max-width: 752px) 100vw, 752px" /></a>
<p class="wp-caption-text">Use Data Viewer to view HTTP requests that failed to be fulfilled.</p>

</div></li>
</ol>
<div class="su-note" style="border-color: #e5dea5; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;">
<div class="su-note-inner su-clearfix" style="background-color: #fff7b7; border-color: #fffdf1; color: #333333; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;"><strong>NOTE</strong>: You can read more about redirecting rows in <a href="//zappysys.com/blog/ssis-error-handling-in-data-flow-redirect-bad-rows/" target="_blank" rel="noopener">SSIS Error Handling (Redirect bad rows)</a> article.</div>
</div>
<h3>Debugging HTTP requests</h3>
<p style="text-align: justify;">A common thing you have to do when working with HTTP requests is to debug those requests; e.g. to check what headers, body or URL was passed. <span id="Debug_Web_API_call_using_Fiddler"></span>To test how things look behind the scenes we strongly suggest to use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a> - a popular web debugging tool.</p>
<p style="text-align: justify;">Inside it, you can double-click the URL entry (Right side) to see Request and Response Panels. The top panel is Request (URL, Headers, Body) and Bottom Panel is Response. For https:// (secure URL) make sure you enable HTTPS option in Fiddler (Tools &gt; Options &gt; HTTPS &gt; Check Decrypt https request):</p>

<div id="attachment_2344" class="wp-caption alignnone">

<a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-2344 size-full" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png" alt="Debugging Web API call using Fiddler in SSIS" width="1287" height="564" data-attachment-id="2344" data-permalink="https://zappysys.com/blog/pass-authorization-header-redirected-location/ssis-rest-api-call-debug-via-fiddler/#main" data-orig-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=1287%2C564&amp;ssl=1" data-orig-size="1287,564" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-rest-api-call-debug-via-fiddler" data-image-description="&lt;p&gt;Debugging Web API call using Fiddler in SSIS&lt;/p&gt; " data-medium-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=300%2C131&amp;ssl=1" data-large-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=720%2C316&amp;ssl=1" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png 1287w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-300x131.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-768x337.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-1024x449.png 1024w" sizes="(max-width: 1287px) 100vw, 1287px" /></a>
<p class="wp-caption-text">Debugging Web API call using Fiddler in SSIS</p>

</div></div>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>Manageengine  Servicedesk API provides a great way to automate data read/write operations. However, to call Service API  you have to use SDK / coding approach (e.g. C#, Java, Python, Ruby). Luckily ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> provides a great way to integrate any Servicedesk API call via a  simple drag and drop approach without coding. Try  <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> for free and call virtually any REST API in a few clicks.</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/read-write-manageengine-servicedesk-data-ssis-zoho-api/">Read/Write ManageEngine ServiceDesk Data in SSIS (Zoho API)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to query salesforce data using Bulk API in SSIS</title>
		<link>https://zappysys.com/blog/query-salesforce-data-using-bulk-api-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 20 Jan 2022 19:07:09 +0000</pubDate>
				<category><![CDATA[SSIS CSV Source]]></category>
		<category><![CDATA[SSIS Salesforce API Task]]></category>
		<category><![CDATA[SSIS Salesforce Connection]]></category>
		<category><![CDATA[bulk api]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[Regular Expression]]></category>
		<category><![CDATA[salesforce]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=9507</guid>

					<description><![CDATA[<p>Introduction In our previous post, we saw how to read Salesforce data using SSIS Salesforce Source (Which uses SOAP API under the hood). This may be slow if you have millions of rows because Salesforce Source paginates every 2000 rows, so it&#8217;s not a good option to read millions of rows to iterate on a [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/query-salesforce-data-using-bulk-api-ssis/">How to query salesforce data using Bulk API in SSIS</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 post, we saw how to <a href="https://zappysys.com/blog/export-data-from-salesforce-to-sql-server-using-ssis/" target="_blank" rel="noopener">read Salesforce</a> data using SSIS Salesforce Source (Which uses SOAP API under the hood). This may be slow if you have millions of rows because Salesforce Source paginates every 2000 rows, so it&#8217;s not a good option to read millions of rows to iterate on a large Salesforce dataset (Table or Query). To increase the read speed, you can use BULK API. This article explains how to read salesforce data using BULK API and increase read speed.</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>NEW Version (v5.5+)</h2>
<p>In the new version (v5.5), we have added an option to query in Bulk Mode. This means if you have millions of Salesforce object rows to read, no worries; it may be very fast in the new version. Previously, it used to take a long time because it read in batches of 2000 rows in each request. With the Bulk API, the batch size is really large.</p>
<p>Here is how to set Salesforce Bulk API Mode in SELECT query (Read operation).</p>
<ol>
<li>Install new version of SSIS PowerPack. Make sure it is v5.5 or higher.</li>
<li>Open existing Salesforce Source UI</li>
<li>Make sure you <strong>check [Use Bulk API]</strong> option like below. if you do not see this option then most likely you are using older version.<br />
-OR-<br />
Just add <strong>#bulkmode</strong> prefix in the SQL query like below, it will use Bulk API</p>
<div id="attachment_11114" style="width: 687px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-bulk-api-option-soql-select-query.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11114" class="size-full wp-image-11114" src="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-bulk-api-option-soql-select-query.png" alt="" width="677" height="585" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-bulk-api-option-soql-select-query.png 677w, https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-bulk-api-option-soql-select-query-300x259.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-11114" class="wp-caption-text">Bulk API mode for SSIS Salesforce Source (Read Large amount of data using SOQL Query)</p></div></li>
</ol>
<h2>OLD Version</h2>
<p>If you are using an older version of SSIS Power Pack (v5.4.0 or older), you can follow the steps mentioned in the following section.</p>
<p>We will see how to query using Salesforce Bulk API in SSIS. It involves three simple steps like the one below.</p>
<ol>
<li>Call BULK API &#8211; Submit SOQL Query and receive a JobId back (Use <a href="https://zappysys.com/products/ssis-powerpack/ssis-salesforce-api-task/">SSIS Salesforce API Task</a>)<br />
<pre class="crayon-plain-tag">https://{your-instance}.salesforce.com/services/data/v50.0/jobs/query</pre>
</li>
<li>Keep checking Job Status Until Status is <strong>JobComplete</strong> (Use <a href="https://zappysys.com/products/ssis-powerpack/ssis-salesforce-api-task/">SSIS Salesforce API Task</a>)<br />
<pre class="crayon-plain-tag">https://{your-instance}.salesforce.com/services/data/v50.0/jobs/query/{{User::JobId}}</pre>
</li>
<li>Read Query Result  (Use <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">SSIS CSV Source</a>)<br />
<pre class="crayon-plain-tag">https://{your-instance}.salesforce.com/services/data/v50.0/jobs/query/{{User::JobId}}/results</pre>
</li>
</ol>
<div id="attachment_9515" style="width: 671px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-query-bulk-api-read-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9515" class="size-full wp-image-9515" src="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-query-bulk-api-read-data.png" alt="Query Salesforce Data using Bulk API in SSIS (read using SOQL query in Bulk mode / large dataset)" width="661" height="330" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-query-bulk-api-read-data.png 661w, https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-query-bulk-api-read-data-300x150.png 300w" sizes="(max-width: 661px) 100vw, 661px" /></a><p id="caption-attachment-9515" class="wp-caption-text">Query Salesforce Data using Bulk API in SSIS (read using SOQL query in Bulk mode / large dataset)</p></div>
<p>Now, let&#8217;s look at everything in detail.</p>
<h3>Obtain Salesforce Credentials</h3>
<p>The first step to call Salesforce API is to obtain credentials (security token or OAuth ClientId /Secret)</p>
<p>Method#1 &#8211; Check <a href="https://zappysys.com/blog/export-data-from-salesforce-to-sql-server-using-ssis/#Get_Salesforce_Security_Token">this article</a> to use <strong>UserId/ Password / SecretToken</strong><br />
Method#2 &#8211; Check <a href="https://zappysys.com/blog/register-salesforce-app-obtain-client-id-secret-oauth-api-call/">this article</a> to use the <strong>OAuth</strong> Connection Option</p>
<h3>Create Salesforce Connection</h3>
<p>Once we have Salesforce Credentials, we can create a new Salesforce Connection (You can do this from Task UI or the below way)</p>
<ol>
<li>Open Visual Studio ( Assuming you already have SSIS installed along with <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">ZappySys PowerPack</a> )</li>
<li>Create a New SSIS Package Project.</li>
<li>Right-click on the Connection Manager panel and click on New Connection.<br />
<img decoding="async" class="figureimage" title="SSIS Create New Connection" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/ssis-new-connection.png" alt="SSIS Create New Connection" /></li>
<li>Select <strong>ZS-SALESFORCE</strong> Connection Manager from the Connection Managers list and Click on the Add Button.<br />
<img decoding="async" class="figureimage" title="SSIS Salesforce Connection Manager - ADD" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/salesforce-connection/ssis-salesforce-api-task-connection-1.png" alt="SSIS Salesforce Connection Manager - ADD" /></li>
<li>Now in Connection Manager UI, Enter your SalesForce Credentials (OAuth Client Id/. Secret &#8211;or&#8212; User Name, Password and Security Token), and leave all other properties as it is.<br />
<img decoding="async" class="figureimage" title="SSIS Salesforce Connection Manager UI " src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/salesforce-connection/ssis-salesforce-connection-manager-ui.png" alt="SSIS Salesforce Connection Manager UI " /></li>
</ol>
<h3>Call Create Job &#8211; Retrieve / Save JobId</h3>
<p>Once the connection is created, we can create our first step. Basically, we will call this API to <a href="https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/query_create_job.htm" target="_blank" rel="noopener">create Job</a> (Bulk Read)</p>
<ol>
<li>Here, in Visual Studio, drag and drop the ZS Salesforce API Task on the design surface.<img decoding="async" class="figureimage" title="SSIS Salesforce API Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/salesforce-api-task/ssis-salesforce-api-task-drag.png" alt="SSIS Salesforce API Task - Drag and Drop" /></li>
<li>Double click the Task and configure Request Settings Tab like below<br />
&#8211; Select Salesforce Connection (Created in the previous section)<br />
&#8211; Check <strong>Use direct URL</strong><br />
&#8211; Enter URL like below (Replace <strong>{your-instance}</strong> with your own instance (i.e. na9) . For more information on how to find out my<br />
salesforce instance id <a href="https://help.salesforce.com/s/articleView?id=000322728&amp;type=1">check this article</a><br />
<pre class="crayon-plain-tag">https://{your-instance}.salesforce.com/services/data/v50.0/jobs/query</pre>
&#8211; Request Method <strong>POST</strong><br />
&#8211; Enter Body like below (You can use your own <a href="https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm" target="_blank" rel="noopener">SOQL query</a>). Keep in mind SQOL must be <a href="https://www.freeformatter.com/json-escape.html" target="_blank" rel="noopener">encoded for JSON format</a>. This means the entire SQL must be in one line (replace new lines with \r\n , quotes with \&#8221; and tabs with \t)<br />
For example, to execute SELECT Id, Name FROM Accounts, you can write something like the one below in BODY.<br />
<pre class="crayon-plain-tag">{
  "operation": "query",
  "query": "SELECT Id, Name\r\nFROM Account"
}</pre>
The above is for below (with a new line)<br />
<pre class="crayon-plain-tag">SELECT Id, Name
FROM Account</pre>
<div id="attachment_9516" style="width: 690px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-call-salesforce-bulk-api-query-soql-sql.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9516" class="size-full wp-image-9516" src="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-call-salesforce-bulk-api-query-soql-sql.png" alt="Create Job - Call Bulk API to Read / Query using SOQL" width="680" height="547" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-call-salesforce-bulk-api-query-soql-sql.png 680w, https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-call-salesforce-bulk-api-query-soql-sql-300x241.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></a><p id="caption-attachment-9516" class="wp-caption-text">Create Job &#8211; Call Bulk API to Read / Query using SOQL</p></div></li>
<li>Now Click Test Request (Copy the <strong>JobId</strong> which we will use in the Variable for Designtime Testing)</li>
<li>On the Response Tab, configure it like the below.<br />
&#8211; Select Response content Type = Json<br />
&#8211; Enter <strong>$.id</strong> as the expression<br />
&#8211; Check Save response option<br />
&#8211; Select Save to Variable and click New to create a variable. Name it <strong>JobId</strong> and enter a sample <strong>JobId</strong> value (copied from the previous step)</p>
<div id="attachment_9517" style="width: 459px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-call-salesforce-bulk-api-extract-jobid-from-result.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9517" class="size-full wp-image-9517" src="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-call-salesforce-bulk-api-extract-jobid-from-result.png" alt="Extract Salesforce JobId save to SSIS Variable" width="449" height="236" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-call-salesforce-bulk-api-extract-jobid-from-result.png 449w, https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-call-salesforce-bulk-api-extract-jobid-from-result-300x158.png 300w" sizes="(max-width: 449px) 100vw, 449px" /></a><p id="caption-attachment-9517" class="wp-caption-text">Extract Salesforce JobId save to SSIS Variable</p></div></li>
</ol>
<h3>Do Status Check &#8211; Look for JobComplete</h3>
<p>Once we create a job and store JobId in the variable we have to keep <a href="https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/query_get_one_job.htm" target="_blank" rel="noopener">checking Job status</a> every X seconds. Don&#8217;t worry you don&#8217;t have to use Loop or timer control for that. ZappySys made it so simple to check such thing without Loop /Timer.</p>
<ol>
<li>Drag and drop the ZS Salesforce API Task in the design surface.<img decoding="async" class="figureimage" title="SSIS Salesforce API Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/salesforce-api-task/ssis-salesforce-api-task-drag.png" alt="SSIS Salesforce API Task - Drag and Drop" /></li>
<li>Double click and configure like below. URL will be different this time. Use variable as below and replace your instance ID<br />
<pre class="crayon-plain-tag">https://{your-instance}.salesforce.com/services/data/v50.0/jobs/query/{{User::JobId}}</pre>
<div id="attachment_9518" style="width: 720px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-api-job-status-check.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9518" class="size-full wp-image-9518" src="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-api-job-status-check.png" alt="Check Salesforce Job Status Periodically (Without Loop + Timer Controls) " width="710" height="566" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-api-job-status-check.png 710w, https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-api-job-status-check-300x239.png 300w" sizes="(max-width: 710px) 100vw, 710px" /></a><p id="caption-attachment-9518" class="wp-caption-text">Check Salesforce Job Status Periodically (Without Loop + Timer Controls)</p></div></li>
<li>Now go to the Status Check Tab and configure it, as shown below. It will keep looking for the words below in the response to decide whether it is a Success or Failure. If those words are not found, they will be checked every 5 seconds (Maximum 1200 secs).<br />
&#8211; Check Enable Status Check option<br />
&#8211; For Success Value &#8211; Enter <strong>JobComplete</strong><br />
-Check Fail task option<br />
&#8211; Enter <strong>Cancel|Failed|Abort</strong> in the text box</p>
<div id="attachment_9519" style="width: 709px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-api-job-status-check-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9519" class="size-full wp-image-9519" src="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-api-job-status-check-2.png" alt="Configure Job Status Check Loop using Salesforce API Task" width="699" height="640" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-api-job-status-check-2.png 699w, https://zappysys.com/blog/wp-content/uploads/2022/01/ssis-salesforce-api-job-status-check-2-300x275.png 300w" sizes="(max-width: 699px) 100vw, 699px" /></a><p id="caption-attachment-9519" class="wp-caption-text">Configure Job Status Check Loop using Salesforce API Task</p></div></li>
</ol>
<h2></h2>
<h3>Read data (Compressed CSV Format)</h3>
<p>Last step is <a href="https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/query_get_job_results.htm" target="_blank" rel="noopener">read the result</a> from completed Salesforce Job. Its in CSV format so we will use Advanced <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">SSIS CSV Source</a> which supports API connection to Salesforce. For that, we will use the same Salesforce API Task used before.</p>
<ol>
<li>Drag and Drop SSIS Data Flow Task from SSIS Toolbox.<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Double click on the DataFlow task to see DataFlow designer surface.</li>
<li>Here, In Visual Studio, drag and drop the ZS CSV Source (Web API or File) in the design panel<br />
<img decoding="async" class="figureimage" title="SSIS CSV Source (Web API or File) - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/csv-source/ssis-csv-file-source-drag.png" alt="SSIS CSV Source (Web API or File) - Drag and Drop" /></li>
<li>Double click on ZS CSV Source (Web API or File) Configure it like below.<br />
&#8211; Enter URL to read result like this (You can supply OPTIONAL maxRecords parameters to control how much data comes in a single response)<br />
<pre class="crayon-plain-tag">https://{your-instance}.salesforce.com/services/data/v50.0/jobs/query/{{User::JobId}}/results
--OR--
https://{your-instance}.salesforce.com/services/data/v50.0/jobs/query/{{User::JobId}}/results?maxRecords=50000</pre>
&#8211; Check Use Credentials and select Salesforce Connection<br />
&#8211; Click Preview (assuming JobId variable has a valid completed JobId)</p>
<div id="attachment_9520" style="width: 689px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/read-salesforce-data-bulk-api-csv-result.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9520" class="size-full wp-image-9520" src="https://zappysys.com/blog/wp-content/uploads/2022/01/read-salesforce-data-bulk-api-csv-result.png" alt="Read Salesforce Bulk API Job Result - Using SSIS CSV / API Source" width="679" height="663" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/read-salesforce-data-bulk-api-csv-result.png 679w, https://zappysys.com/blog/wp-content/uploads/2022/01/read-salesforce-data-bulk-api-csv-result-300x293.png 300w" sizes="(max-width: 679px) 100vw, 679px" /></a><p id="caption-attachment-9520" class="wp-caption-text">Read Salesforce Bulk API Job Result &#8211; Using SSIS CSV / API Source</p></div></li>
<li>Now, set up Pagination as below to read all records using an automated loop. You will need <strong>VERSION Released after Jun 20, 2022</strong> to use Regular Expression feature in Header Value extractionBy default, Salesforce doesn&#8217;t send all records in response so we <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/#Method-7_REST_APIPagination_using_Cursor_Continuation_Token_from_Response_Header" target="_blank" rel="noopener">need to setup pagination</a>. In below example we are reading <strong>Sforce-Locator</strong> attribute from Response and sending it to the next URL as <strong>locator=&lt;continue-token&gt;</strong> value<br />
&#8211; Choose <strong>Response Header Contains Continue Token </strong><br />
&#8211; Enter below expression in <strong>Page Num Indicator</strong><br />
<pre class="crayon-plain-tag">locator=Sforce-Locator(^((?!null\b).)*$)</pre>
Basically, the above expression will keep looping until we find <strong>Sforce-Locator : null</strong> in the response header.</p>
<div id="attachment_9723" style="width: 872px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-bulk-query-api-pagination-read-csv-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9723" class="size-full wp-image-9723" src="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-bulk-query-api-pagination-read-csv-data.png" alt="Pagination for Salesforce Bulk Query API (Get Header Value from Sforce-Locator)" width="862" height="523" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-bulk-query-api-pagination-read-csv-data.png 862w, https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-bulk-query-api-pagination-read-csv-data-300x182.png 300w, https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-bulk-query-api-pagination-read-csv-data-768x466.png 768w" sizes="(max-width: 862px) 100vw, 862px" /></a><p id="caption-attachment-9723" class="wp-caption-text">Pagination for Salesforce Bulk Query API (Get Header Value from Sforce-Locator)</p></div></li>
<li>Click OK to save and now run entire package like below.</li>
</ol>
<div id="attachment_9515" style="width: 671px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-query-bulk-api-read-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9515" class="size-full wp-image-9515" src="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-query-bulk-api-read-data.png" alt="Query Salesforce Data using Bulk API in SSIS (read using SOQL query in Bulk mode / large dataset)" width="661" height="330" srcset="https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-query-bulk-api-read-data.png 661w, https://zappysys.com/blog/wp-content/uploads/2022/01/salesforce-query-bulk-api-read-data-300x150.png 300w" sizes="(max-width: 661px) 100vw, 661px" /></a><p id="caption-attachment-9515" class="wp-caption-text">Query Salesforce Data using Bulk API in SSIS (read using SOQL query in Bulk mode / large dataset)</p></div>
<h2>Conclusion</h2>
<p>In this article we saw how to use various ZappySys Components / Task to achieve complex Salesforce API calls to read Query data using Bulk API. Download <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> and try yourself and also explore 70+ other tasks /components not discussed in this article.</p>
<p>The post <a href="https://zappysys.com/blog/query-salesforce-data-using-bulk-api-ssis/">How to query salesforce data using Bulk API in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS Magento data Read / Write using REST API Call</title>
		<link>https://zappysys.com/blog/ssis-magento-data-read-write-using-rest-api-call/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 01 Nov 2018 16:43:04 +0000</pubDate>
				<category><![CDATA[HTTP Connection]]></category>
		<category><![CDATA[REST API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Connection Manager]]></category>
		<category><![CDATA[SSIS CSV Source]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=5267</guid>

					<description><![CDATA[<p>Introduction In this post we will lean SSIS Magento data read / write operations. Magento is a very popular eCommerce platform and they offer JSON based REST API and XML based SOAP API. You can use either API based on your need to automate common integration needs. We recommend using REST API (JSON API) if possible [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-magento-data-read-write-using-rest-api-call/">SSIS Magento data Read / Write 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="https://zappysys.com/blog/wp-content/uploads/2018/11/magento-logo.png"><img loading="lazy" decoding="async" class="wp-image-6392 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/11/magento-logo.png" alt="" width="124" height="112" /></a>In this post we will lean SSIS Magento data read / write operations. Magento is a very popular eCommerce platform and they offer <strong>JSON based REST API</strong> and <strong>XML based SOAP API</strong>. You can use either API based on your need to automate common integration needs.</p>
<p>We recommend using REST API (JSON API) if possible because they are simpler and faster. We will focus only on JSON API in this article but we do have blog post on <a href="https://zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">how to call SOAP API</a>.</p>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>About Calling Magento REST API</h2>
<p>If you are new to Magento API we highly recommend to get familiar with <a href="https://devdocs.magento.com/guides/v2.3/rest/tutorials/index.html" target="_blank" rel="noopener">Magento REST API here</a>. Magento REST API  offers two ways to authenticate.</p>
<ol>
<li><a href="https://devdocs.magento.com/guides/v2.1/get-started/authentication/gs-authentication-token.html" target="_blank" rel="noopener">Token based Authentication</a></li>
<li><a href="https://devdocs.magento.com/guides/v2.1/get-started/authentication/gs-authentication-oauth.html" target="_blank" rel="noopener">OAuth Based Authentication (OAuth 1.0a)</a></li>
</ol>
<p>In this article we will look at only Token based approach. In token based approach we have to get new token using admin / customer account information.</p>
<p>We will cover later how to access admin or customer level API later in this article (See HTTP connection configuration).</p>
<h2>Configure Connection / Call Magento REST API in SSIS</h2>
<p>Now lets look at very simple example how to use Token based method to call Magento REST API in SSIS. We will first configure HTTP connection and then call REST API.</p>
<p>Let&#8217;s get started.</p>
<ol>
<li>First, open SSIS Package after installing <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a></li>
<li>Drag <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS Toolbox on Control Flow Designer. Let&#8217;s rename task to <strong>Get Magento Categories</strong></li>
<li>Enter REST API URL you like to call. For example we can use below URL. Replace **<strong>your-magento-host**</strong> with your own name.<br />
<pre class="crayon-plain-tag">http://**your-magento-host**/index.php/rest/V1/categories</pre>
</li>
<li>Select <strong>Url from Connection</strong> mode</li>
<li>From Connection Dropdown select <strong>new ZS-HTTP</strong> connection
<div id="attachment_5269" style="width: 477px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-connection-rest-api-task.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5269" class="size-full wp-image-5269" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-connection-rest-api-task.png" alt="Create new connection for SSIS REST API Task" width="467" height="267" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-connection-rest-api-task.png 467w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-connection-rest-api-task-300x172.png 300w" sizes="(max-width: 467px) 100vw, 467px" /></a><p id="caption-attachment-5269" class="wp-caption-text">Create new connection for SSIS REST API Task</p></div></li>
<li>Configure General Tab of HTTP Connection like below<br />
URL can be anything for now because we will use override option in next step (On REST API Task).</li>
<li>Select Credentials Type as <a href="https://zappysys.com/blog/call-soap-rest-api-using-dynamic-token-ssis/">Dynamic Token</a>.</li>
<li>Enter Userid / password
<div id="attachment_5268" style="width: 730px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5268" class="size-full wp-image-5268" src="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method.png" alt="Configure Magento REST API Connect for Token based Authentication" width="720" height="483" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method.png 720w, https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method-300x201.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-rest-api-call-token-method-272x182.png 272w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-5268" class="wp-caption-text">Configure Magento REST API Connect for Token based Authentication</p></div></li>
<li>Now goto Dynamic Token Tab (Or click <strong>Configure</strong> Link) and configure like below.</li>
<li>Enter Token URL for API Login URL field.<br />
<strong>NOTE</strong>: If you are a customer and want to access your own account (e.g. view your orders) then replace <strong>/admin</strong> with <strong>/customer</strong>  in URL)<br />
Replace <strong>**my-host**</strong> with your host name.<br />
<pre class="crayon-plain-tag">http://***my-host***/index.php/rest/V1/integration/admin/token</pre>
</li>
<li>Change Method to POST.</li>
<li>Enter Body as below (Placeholders are automatically replaced when /token endpoint is called.<br />
<pre class="crayon-plain-tag">{&quot;username&quot;:&quot;[$userid$]&quot;, &quot;password&quot;:&quot;[$password$]&quot;}</pre>
</li>
<li>Select Content Type as Application/Json
<div id="attachment_5270" style="width: 849px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5270" class="size-full wp-image-5270" src="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract.png" alt="Configure Magento Token Request" width="839" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract.png 839w, https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract-300x216.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/configure-magento-dynamic-token-extract-768x552.png 768w" sizes="(max-width: 839px) 100vw, 839px" /></a><p id="caption-attachment-5270" class="wp-caption-text">Configure Magento Token Request</p></div></li>
<li>Now click Dynamic Token &#8211; Response Tab and configure like below.<br />
Select <strong>Regex</strong> and enter Expression as below. This will remove double quotes around token in response.<br />
<pre class="crayon-plain-tag">&quot;(.*)&quot;{{0,1}}</pre>
<div id="attachment_5272" style="width: 541px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/regex-remove-double-quotes-around-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5272" class="size-full wp-image-5272" src="https://zappysys.com/blog/wp-content/uploads/2018/11/regex-remove-double-quotes-around-value.png" alt="Extract Token from response - Remove double quotes around value using Regular Expression" width="531" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/regex-remove-double-quotes-around-value.png 531w, https://zappysys.com/blog/wp-content/uploads/2018/11/regex-remove-double-quotes-around-value-300x218.png 300w" sizes="(max-width: 531px) 100vw, 531px" /></a><p id="caption-attachment-5272" class="wp-caption-text">Extract Token from response &#8211; Remove double quotes around value using Regular Expression</p></div></li>
<li>Click OK to save connection</li>
<li>Now on REST API Task check <strong>Use Direct URL</strong> Option</li>
<li>Click Test Request to confirm its working
<div id="attachment_5273" style="width: 752px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-call-magento-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5273" class="size-full wp-image-5273" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-call-magento-rest-api.png" alt="Call Magento REST API using SSIS REST API Task" width="742" height="701" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-call-magento-rest-api.png 742w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-call-magento-rest-api-300x283.png 300w" sizes="(max-width: 742px) 100vw, 742px" /></a><p id="caption-attachment-5273" class="wp-caption-text">Call Magento REST API using SSIS REST API Task</p></div></li>
</ol>
<p>&nbsp;</p>
<h2>Read data from Magento and Load into SQL Server</h2>
<p>Now lets look at how to read Magento data and load into SQL Server. Assume that you like to read all products.</p>
<h3>Configure JSON Source (Read Magento REST API)</h3>
<ol>
<li>Drag Data flow and double click to edit:
<div id="attachment_8028" style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8028" class="size-full wp-image-8028" src="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" alt="" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /><p id="caption-attachment-8028" class="wp-caption-text">Dragging and dropping Data Flow Task into Control Flow</p></div></li>
<li>Drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> on data flow and double click to edit</li>
<li>Configure JSON Source like below if you like to get product list for example
<ol>
<li>Enter URL as below (change http to https if your host support secure channel).<br />
<pre class="crayon-plain-tag">http://***yourhost***/index.php/rest/V1/products?searchCriteria[pageSize]=1000
--- to extract only specific fields do below way --
http://***yourhost***/index.php/rest/V1/products?searchCriteria[pageSize]=1000&amp;fields=items[sku,name]</pre>
</li>
<li>Check Use Credentials. Use same HTTP connection we created in previous section</li>
<li>In the Filter enter <strong>$.items[*]</strong> or click Select Filter to Browse and select items node.</li>
<li>Click Preview to confirm</li>
</ol>
</li>
<li>Here is how your setup will look like after configuration.
<div id="attachment_6525" style="width: 871px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6525" class="size-full wp-image-6525" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api.png" alt="SSIS JSON Source Configuration - Read data from Magento REST API" width="861" height="517" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api.png 861w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api-300x180.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-read-data-rest-api-768x461.png 768w" sizes="(max-width: 861px) 100vw, 861px" /></a><p id="caption-attachment-6525" class="wp-caption-text">SSIS JSON Source Configuration &#8211; Read data from Magento REST API</p></div></li>
<li>If you expecting more than 1000 rows then you have to set up pagination. Now go to <strong>pagination tab</strong> and configure as below (Below options are only available <a href="https://zappysys.com/blog/ssis-powerpack-v2-9-1/" target="_blank" rel="noopener">in v2.9.1 or higher</a>). If you have older version then check next section for workaround.
<ol>
<li>Pagination Mode =<strong>URL Parameter Mode</strong></li>
<li>Page Num Indicator = <strong>searchCriteria[currentPage]</strong></li>
<li>Max Rows Expression = <strong>$.total_count</strong></li>
<li>Page Data Expression = <strong>$.items[*]</strong></li>
</ol>
</li>
<li>Here is how your Magento REST API Pagination Setup will look like.
<div id="attachment_6526" style="width: 578px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/rest-api-pagination-by-max-row-count.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6526" class="size-full wp-image-6526" src="https://zappysys.com/blog/wp-content/uploads/2018/11/rest-api-pagination-by-max-row-count.png" alt="REST API Pagination using Max Row count Mode" width="568" height="376" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/rest-api-pagination-by-max-row-count.png 568w, https://zappysys.com/blog/wp-content/uploads/2018/11/rest-api-pagination-by-max-row-count-300x199.png 300w" sizes="(max-width: 568px) 100vw, 568px" /></a><p id="caption-attachment-6526" class="wp-caption-text">REST API Pagination using Max Row count Mode</p></div></li>
<li>Click OK to save JSON Source. In next section we will see how to load data into Target like SQL Server.</li>
</ol>
<h3>Configure OLEDB Destination (Load into SQL Server)</h3>
<ol>
<li>Drag OLEDB Destination.</li>
<li>Select / Create Connection</li>
<li>Select or create NEW target Table (Click NEW button)</li>
<li>Click Mapping Tab to map source columns to target table</li>
<li>Click OK to save</li>
<li>Execute Package</li>
</ol>
<div class="content_block" id="custom_post_widget-5617"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination</strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.</p>
<h3>Step 1: Add Upsert Destination to Data Flow</h3>
<ol>
<li>Drag and drop the <strong>Upsert Destination</strong> component from the SSIS Toolbox.</li>
<li>Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png" /></a>
<p class="wp-caption-text">SSIS - Data Flow - Drang and Drop Upsert Destination Component</p>
</div>
<h3>Step 2: Configure Target Connection</h3>
<ol>
<li>Double-click the <strong>Upsert Destination</strong> component to open the configuration window.</li>
<li>Under <strong>Connection</strong>, select an existing target connection or click <strong>NEW</strong> to create a new connection.
<ul>
<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.</li>
</ul>
</li>
</ol>
<h3>Step 3: Select or Create Target Table</h3>
<ol>
<li>In the <strong>Target Table</strong> dropdown, select the table where you want to load data.</li>
<li>Optionally, click <strong>NEW</strong> to create a new table based on the source columns.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png" /></a>
<p class="wp-caption-text">Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS</p>
</div>
<h3>Step 4: Map Columns</h3>
<ol>
<li>Go to the <strong>Mappings</strong> tab.</li>
<li>Click <strong>Auto Map</strong> to map source columns to target columns by name.</li>
<li>Ensure you <strong>check the Primary key column(s)</strong> that will determine whether a record is inserted or updated.</li>
<li>You can manually adjust the mappings if necessary.</li>
</ol>
 <div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination - Columns Mappings</p>
</div>
<h3>Step 5: Save Settings</h3>
<ul>
<li>Click <strong>OK</strong> to save the Upsert Destination configuration.</li>
</ul>
<h3>Step 6: Optional: Add Logging or Analysis</h3>
<ul>
<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.</li>
</ul>
<h3>Step 7: Execute the Package</h3>
<ul>
<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.</li>
</ul>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination Execution</p>
</div></div>
<h2>Configure Magento Pagination (For Old Version)</h2>
<p>In previous section we configured pagination using newer version (v2.9.1 or higher). But what if you have older version and you dont see that feature. Use below steps for workaround.</p>
<p>Now let&#8217;s look at another common scenario when you real lots of data. Let&#8217;s say you have 5000 products but API call we saw earlier returns max 1000 rows. In that case we have to keep reading next page until all rows are returned. ZappySys provides many settings to configure various REST APIs out there, unfortunately there is no standard around pagination methods. Since Magento API has <a href="https://github.com/magento/magento2/issues/8099" target="_blank" rel="noopener">some bug in API pagination</a> we have to do following hack. Magento keep sending same data of last page if you try to access page which doesn&#8217;t exists. Here is how to overcome that bug.</p>
<h3>Configure REST API task to get total row count</h3>
<p>First step to configure magento pagination is get total rows returned in our request which you like to paginate (in our case <strong>/products</strong>).</p>
<ol>
<li>Go to Control Flow designer</li>
<li>Drag <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS Toolbox</li>
<li>Let&#8217;s rename task to <strong>Get Magento Product Count</strong></li>
<li>Double click it and configure like below (Change HTTP to HTTPS if needed)<br />
<pre class="crayon-plain-tag">http://***yourhost***/index.php/rest/V1/products?searchCriteria[pageSize]=10</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-get-magento-result-count-for-pagination.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6387" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-get-magento-result-count-for-pagination.png" alt="" width="734" height="497" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-get-magento-result-count-for-pagination.png 734w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-get-magento-result-count-for-pagination-300x203.png 300w" sizes="(max-width: 734px) 100vw, 734px" /></a></li>
<li>Go to Response Tab and configure like below. Enter expression as $.total_count<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-rest-api-task-save-variable.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6388" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-rest-api-task-save-variable.png" alt="" width="672" height="297" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-rest-api-task-save-variable.png 672w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-rest-api-task-save-variable-300x133.png 300w" sizes="(max-width: 672px) 100vw, 672px" /></a></li>
<li>Click OK to save</li>
</ol>
<p>&nbsp;</p>
<h3>Define Expression for JSON Source &#8211; MaxRows Property</h3>
<p>Now next step is to define expression on MaxRows property of JSON Rows so we stop once all rows consumed from Paginated response. If you don&#8217;t do this it will keep paginating forever 🙁</p>
<ol>
<li>On Control Flow designer <strong>select Data Flow</strong> which contains JSON Source for Magento</li>
<li>Right click and go to Properties of that data flow</li>
<li>Find Expression and click Button to add new expression</li>
<li>On Expression dialogbox select [Your JSON Source].[MaxRows] and for expression enter variable name which holds total count (e.g. <strong>@[User::MaxRows]</strong> )<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-dataflow-expression-json-source-maxrows.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6391" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-dataflow-expression-json-source-maxrows.png" alt="" width="666" height="328" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-dataflow-expression-json-source-maxrows.png 666w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-dataflow-expression-json-source-maxrows-300x148.png 300w" sizes="(max-width: 666px) 100vw, 666px" /></a></li>
<li>Click OK to Save</li>
</ol>
<h3>Configure JSON Source for Magento Pagination</h3>
<p>Now last thing we have to do is go to JSON Source and configure few things for pagination.</p>
<ol>
<li>Go to data flow and double click JSON Source</li>
<li>Click on <strong>Pagination tab</strong> and select Pagination by <strong>URL Parameter Mode</strong></li>
<li>Enter Page name as below<br />
<pre class="crayon-plain-tag">searchCriteria[currentPage]</pre>
</li>
<li>Click OK to save UI</li>
<li>Now <strong>run entire page to test</strong> (NOTE: Do not execute just data flow because if you do that way, it will not extract total row count)<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6394" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination.png" alt="" width="784" height="548" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination.png 784w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination-300x210.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-read-magento-data-rest-api-pagination-768x537.png 768w" sizes="(max-width: 784px) 100vw, 784px" /></a></li>
</ol>
<h2>Write data to Magento using SSIS Web API destination</h2>
<p>Now let&#8217;s look at example to load data into Magento. In below example we will create few sample products.</p>
<ol>
<li>Create new data flow and go to data flow designer</li>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-file-source-flat-file-web-api/" target="_blank" rel="noopener">ZS CSV Source</a> from SSIS toolbox. You can use any Data source but for simple demo we will use it.</li>
<li>Double click CSV source and select Direct Value mode from dropdown. Enter following sample data (Lets create 12 sample products.)<br />
<pre class="crayon-plain-tag">SKU,ProductName
PROD-1,Product 1
PROD-2,Product 2
PROD-3,Product 3
PROD-4,Product 4
PROD-5,Product 5
PROD-6,Product 6
PROD-7,Product 7
PROD-8,Product 8
PROD-9,Product 9
PROD-10,Product 10
PROD-11,Product 11
PROD-12,Product 12</pre>
</li>
<li>Now click OK to save UI</li>
<li>Now drag <strong>ZS Template Transform</strong> from toolbox.</li>
<li>Connect CSV Source to Template Transform</li>
<li>Enter following sample text to build request for new product. Refer to <a href="https://devdocs.magento.com/guides/v2.3/rest/tutorials/configurable-product/create-simple-products.html">Magento API help file / tutorial</a> to learn more.<br />
<pre class="crayon-plain-tag">{
  "product": {
    "sku": "&lt;%SKU%&gt;",
    "name": "&lt;%ProductName%&gt;",
    "attribute_set_id": 4,
    "price": 25,
    "status": 1,
    "visibility": 1
   }
}</pre>
</li>
<li>Notice that when you click <strong>Insert Variable</strong> &gt; <strong>Columns</strong> &gt; select desired upstream column placeholder. You can also encode special characters in your data (e.g. new lines) using function like &lt;%MyColumn,JSONENCODE%&gt;<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-create-new-product-api-request-template-transform.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6389" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-create-new-product-api-request-template-transform.png" alt="" width="729" height="493" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-create-new-product-api-request-template-transform.png 729w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-magento-create-new-product-api-request-template-transform-300x203.png 300w" sizes="(max-width: 729px) 100vw, 729px" /></a></li>
<li>Click OK and save UI</li>
<li>Now drag ZS Web API Destination from SSIS Toolbox. Configure like below.Enter URL same as before (used to read product), change Method to <strong>POST</strong>, change content type to Application/JSON.<a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-6390" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api.png" alt="" width="778" height="660" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api.png 778w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api-300x254.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/ssis-create-new-product-records-magento-call-rest-api-768x652.png 768w" sizes="(max-width: 778px) 100vw, 778px" /></a></li>
<li>Now run entire flow (You can watch your API <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">requests in Fiddler</a> for debugging)</li>
</ol>
<h2>Debug Magento Web Requests using Fiddler</h2>
<p>Click on below article to learn how to debug web requests</p>
<blockquote class="wp-embedded-content" data-secret="dKZ26bWM7i"><p><a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/">How to use Fiddler to analyze HTTP Web Requests</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" src="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/embed/#?secret=dKZ26bWM7i" data-secret="dKZ26bWM7i" width="600" height="338" title="&#8220;How to use Fiddler to analyze HTTP Web Requests&#8221; &#8212; ZappySys Blog" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>&nbsp;</p>
<h2>Magento Integration in Other Apps (e.g. Power BI / Informatica / SQL Server)</h2>
<p>You can use techniques listed on this page with <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ODBC Drivers</a> too for integration in other tools like Power BI, SQL Server code, Informatica etc.</p>
<h2>Conclusion</h2>
<p>In this post we saw how easy it is to perform Magento Integration in SSIS without doing any programming. In few steps you can read or write data in Magento using <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> REST API components. Download FREE Trial and explore many other scenarios.</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/ssis-magento-data-read-write-using-rest-api-call/">SSIS Magento data Read / Write using REST API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Read Azure DevOps data in SSIS (VSTS / TFS Online) – Call REST API / Load to SQL Server</title>
		<link>https://zappysys.com/blog/read-vsts-data-ssis-call-rest-api-load-sql-server/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 18 Aug 2018 09:47:14 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[azure devops]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[odata]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[TFS Online]]></category>
		<category><![CDATA[visual studio team service]]></category>
		<category><![CDATA[vsts]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=4643</guid>

					<description><![CDATA[<p>Introduction In this blog, we will learn How to read data from Azure DevOps in SSIS and load into SQL Server Table. Azure DevOps was formally known as TFS Online / VSTS. In this article we will learn, how to read Issues (Work Items) using Azure DevOps API (i.e. VSTS API). In last few years Microsoft has [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-vsts-data-ssis-call-rest-api-load-sql-server/">Read Azure DevOps data in SSIS (VSTS / TFS Online) – Call REST API / Load to SQL Server</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-logo-150x150-1.png"><img loading="lazy" decoding="async" class="alignleft wp-image-4646 " src="https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-logo-150x150-1-150x150.png" alt="Visual Studio Team Service Logo" width="91" height="91" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-logo-150x150-1-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-logo-150x150-1.png 300w" sizes="(max-width: 91px) 100vw, 91px" /></a></p>
<p>In this blog, we will learn <strong>How to read data from Azure DevOps in SSIS and load into SQL Server Table.</strong> Azure DevOps was formally known as TFS Online / VSTS.</p>
<p>In this article we will learn, how to read Issues (Work Items) using Azure DevOps API (i.e. VSTS API). In last few years Microsoft has changed marketing names few times for TFS Service. For example everything started with  Visual Source Safe (VSS) &gt; TFS &gt; TFS Online &gt; Visual Studio Online &gt; VSTS (Visual Studio Team Services)) and finally now its called <strong>Azure DevOps</strong>. In this article we might use terms like VSTS or TFS  Online or <strong>Azure DevOps</strong> but not to get confused its all about <strong>Calling Azure Dev Ops API.</strong></p>
<p>In this article we will try to cover few topics such as.</p>
<ul>
<li>Register an OAuth App to call REST API for <strong>Azure DevOps API (i.e. VSTS / TFS Online)</strong></li>
<li>Read all Issues (Work Items) data from VSTS with SSIS and finally</li>
<li>Create new Issue/Bug in Visual Studio Team Service Project WorkItems.</li>
<li>Authenticate and Call Azure DevOps <strong>using PAT</strong> (Personal Access Tokens) rather than OAuth 2.0</li>
</ul>
<p>We will go through the steps to read Issues data from Visual Studio Team Service and Load into SQL Server using  <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source.</a></p>
<p>In nutshell, this post will focus on how to call VSTS API using SSIS.</p>
<p>So let&#8217;s get started.</p>
<h2><span id="Requirements">Prerequisite<br />
</span></h2>
<ol>
<li>First, you will need to have SSIS installed</li>
<li>Secondly, make sure to have SSDT</li>
<li>Finally, do not forget to install ZappySys <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a></li>
</ol>
<h2><span id="Conclusion">Call Azure DevOps API Using PAT (Personal Access Token)</span></h2>
<p>There are two ways to call Azure DevOps API. You can use <a href="https://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth">OAuth 2.0</a> or use <a href="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate" target="_blank" rel="noopener">PAT (i.e. Personal Access Token)</a> In the next section we will see how to use OAuth 2.0 if you like more secure way to authenticate (OAuth 2.0 requires more steps).</p>
<p>Microsoft offers Static API Token (referred as PAT &#8211; Personal Access Token) which you can use like a password (it remains valid for 1 year before you have regenerate).</p>
<p>So let&#8217;s get started.</p>
<h3>Create PAT (Personal Access Token)</h3>
<ol>
<li>Visit to <pre class="crayon-plain-tag">https://dev.azure.com/YOUR_COMPANY_NAME/_usersSettings/tokens</pre> . Create Personal Access Token (i.e. PAT ) by clicking User Settings icon &gt; Personal Access Token (see below)  (<a href="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&amp;tabs=preview-page" target="_blank" rel="noopener">detailed steps listed here</a> )
<div id="attachment_9224" style="width: 801px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-create-pat-personal-access-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9224" class="size-full wp-image-9224" src="https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-create-pat-personal-access-token.png" alt="Call Azure DevOps API (formally known as VSTS / TFS Online) - Create Personal Access Token (i.e. PAT)" width="791" height="559" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-create-pat-personal-access-token.png 791w, https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-create-pat-personal-access-token-300x212.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-create-pat-personal-access-token-768x543.png 768w" sizes="(max-width: 791px) 100vw, 791px" /></a><p id="caption-attachment-9224" class="wp-caption-text">Call Azure DevOps API (formally known as VSTS / TFS Online) &#8211; Create Personal Access Token (i.e. PAT)</p></div></li>
<li>On Token Configuration Screen change Expiration to maximum (i.e. one year from today)</li>
<li>Now select permission &#8211; We will call Analytics API below (but you can also check Work Items section if you need to call some other API for read / write purpose)
<div id="attachment_9225" style="width: 1201px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-api-create-pat-personal-access-token-set-permission.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9225" class="wp-image-9225 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-api-create-pat-personal-access-token-set-permission.png" alt="Change Permission / Expiration Date for Azure DevOps PAT (Personal Access Token) - Read / Write Work Items, Call Analytics API Example" width="1191" height="837" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-api-create-pat-personal-access-token-set-permission.png 1191w, https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-api-create-pat-personal-access-token-set-permission-300x211.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-api-create-pat-personal-access-token-set-permission-768x540.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/azure-devops-api-create-pat-personal-access-token-set-permission-1024x720.png 1024w" sizes="(max-width: 1191px) 100vw, 1191px" /></a><p id="caption-attachment-9225" class="wp-caption-text">Change Permission / Expiration Date for Azure DevOps PAT (Personal Access Token) &#8211; Read / Write Work Items, Call Analytics API Example</p></div></li>
</ol>
<h3>Call Azure DevOps OData API in SSIS &#8211; Read WorkItems  Example (Analytics API Service)</h3>
<p>Now lets configure JSON Source to read WorkItems by calling  Azure DevOps Analytics API (in Previous few sections we call different set of APIs). <a href="https://docs.microsoft.com/en-us/azure/devops/report/extend-analytics/wit-analytics?view=azure-devops">Check this link</a> for more information on AzureDevOps Analytics API (its OData format).</p>
<p>For demo purpose we are calling WorkItems entity but you can read from many other entities like (Read Areas, Iterations, Projects, Teams, Tags etc). <a href="https://docs.microsoft.com/en-us/azure/devops/report/extend-analytics/data-model-analytics-service?view=azure-devops">Check this link</a> to see which Entity (i.e. Table) you can query for specific OData API version.</p>
<p>So let&#8217;s get started</p>
<ol>
<li>Go to SSIS designer and drag Data Flow Task on the Designer Surface<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Then double click Data Flow and from toolbox drag ZS JSON Source<br />
<img decoding="async" class="figureimage" title="SSIS JSON Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="SSIS JSON Source - Drag and Drop" /></li>
<li>Double click JSON Source to configure like below
<ol>
<li>First change Data Format to <strong>OData</strong> (Analytics API we will call in this section is OData format)</li>
<li>Enter URL to Query data like below. Change <strong>YOUR_COMPANY_NAME</strong> with your own name. Below API URL will call Analytics will<br />
<pre class="crayon-plain-tag">https://analytics.dev.azure.com/YOUR_COMPANY_NAME/Odbc/_odata/v3.0/WorkItems?$select=WorkItemId,Title,WorkItemType,State,CreatedDate&amp;$orderby=CreatedDate desc&amp;$top=11</pre>
</li>
<li>Check Use Credentials and Select new <strong>ZS-HTTP</strong> connection (instead of OAUTH)</li>
</ol>
</li>
<li>On HTTP Connection UI Configure below
<ol>
<li>Enter Some URL &#8211; This will be ignored anyways (e.g. https://dev.azure.com )</li>
<li>Change Credentials Type to Basic (User ID / Password)</li>
<li>Enter some random word in User ID -i.e. fakeusername (this is ignored anyways but needs some non-empty value for older version of SSIS PowerPack else validation fails)</li>
<li>Enter PAT (i.e. Personal Access Token) obtained in the previous section</li>
</ol>
</li>
<li>Click OK to Save Connection UI and go back to JSON Source</li>
<li>On JSON Source, Enter or Select <strong>Array Filter</strong> as <pre class="crayon-plain-tag">$.value[*]</pre></li>
<li>Click Preview data see its working using HTTP connection method</li>
</ol>
<div id="attachment_9226" style="width: 1071px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/generate-azure-devops-pat-token-call-odata-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9226" class="size-full wp-image-9226" src="https://zappysys.com/blog/wp-content/uploads/2018/08/generate-azure-devops-pat-token-call-odata-rest-api.png" alt="Configure JSON Source - Call Azure DevOps Api using PAT (Personal Access Token)" width="1061" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/generate-azure-devops-pat-token-call-odata-rest-api.png 1061w, https://zappysys.com/blog/wp-content/uploads/2018/08/generate-azure-devops-pat-token-call-odata-rest-api-300x207.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/generate-azure-devops-pat-token-call-odata-rest-api-768x531.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/generate-azure-devops-pat-token-call-odata-rest-api-1024x707.png 1024w" sizes="(max-width: 1061px) 100vw, 1061px" /></a><p id="caption-attachment-9226" class="wp-caption-text">Configure JSON Source &#8211; Call Azure DevOps Api using PAT (Personal Access Token)</p></div>
<p>&nbsp;</p>
<h2>Calling Azure DevOps API in SSIS using OAuth 2.0</h2>
<p>Now in this section we will see how to use more secure but little harder approach to authenticate. We will use OAuth 2.0 this time rather than static token (PAT) which we used in previous section.</p>
<p>In order to start, we will show several examples. ZappySys includes an <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source</a> that will help you to call VSTS API, read various data from VSTS with SSIS, create a new issue on VSTS with SSIS and do many more actions using REST API. To learn more about VSTS API <a href="https://docs.microsoft.com/en-us/rest/api/vsts" rel="noopener">check this help file</a>.</p>
<h3>Create VSTS App (for OAuth 2.0 API Call)</h3>
<p>To access VSTS data using REST API call you need to create a VSTS app. Follow the mentioned steps below to register VSTS OAuth App:</p>
<ol>
<li>you can directly login to the <a href="https://app.vssps.visualstudio.com/profile/view">Visual Studio Team Service &#8211; TFS Online site</a> with your credentials, and redirect to the <a href="https://app.vsaex.visualstudio.com/app/register">Visual Studio Team Service App Registration</a> for creating an app.</li>
<li>you can open <a href="https://app.vssps.visualstudio.com/profile/view">MyApps Page</a>.
<div id="attachment_10065" style="width: 1233px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-Create-new-OAuth-Apps.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10065" class="wp-image-10065 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-Create-new-OAuth-Apps.png" alt="Visual-Studio-Team-Services-Create-new-OAuth-Apps" width="1223" height="759" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-Create-new-OAuth-Apps.png 1223w, https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-Create-new-OAuth-Apps-300x186.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-Create-new-OAuth-Apps-768x477.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-Create-new-OAuth-Apps-1024x635.png 1024w, https://zappysys.com/blog/wp-content/uploads/2018/08/Visual-Studio-Team-Services-Create-new-OAuth-Apps-436x272.png 436w" sizes="(max-width: 1223px) 100vw, 1223px" /></a><p id="caption-attachment-10065" class="wp-caption-text">Visual Studio Team Service: My Apps</p></div>
<p>Visual Studio Team Service: My Apps[/caption]</li>
<li>Click on Create new application link, and you will be redirected to the <a href="https://app.vsaex.visualstudio.com/app/register">Visual Studio Team Service App Registration</a> Page.</li>
<li>Make sure you enter Authorization call base URL. We suggest to below call back URL if you are unsure. We will use exact same URL on OAuth connection UI (Advanced Tab)</p><pre class="crayon-plain-tag">https://zappysys.com/oauth</pre><p>
</li>
<li>
<div id="attachment_4649" style="width: 962px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4649" class="wp-image-4649 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration.png" alt="Visual Studio Team Service: New OAuth App Registration" width="952" height="760" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration.png 952w, https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration-300x239.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration-768x613.png 768w" sizes="(max-width: 952px) 100vw, 952px" /></a><p id="caption-attachment-4649" class="wp-caption-text">Visual Studio Team Service: New OAuth App Registration</p></div></li>
<li>Select the Authorization scopes as per your requirements, and click on Create Application button.<br />
For example to read Work Items or Create new Issues programmatically you can check following scope (i.e. OAuth permission).<strong>Check &#8211; Work items (full)  </strong>(i.e. vso.work_full scope)<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: The scopes selected on your registered application (below screenshot) must match the scopes entered in the ZappySys OAuth connection scopes field (see below). If they do not match exactly, an InvalidScope error can be produced.</div></div>
<strong><br />
</strong></p>
<div id="attachment_4651" style="width: 1130px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration-Select-Scopes.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4651" class="wp-image-4651 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration-Select-Scopes.png" alt="Visual Studio Team Service: Select Authorization Scopes" width="1120" height="761" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration-Select-Scopes.png 1120w, https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration-Select-Scopes-300x204.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration-Select-Scopes-768x522.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-New-OAuth-App-Registration-Select-Scopes-1024x696.png 1024w" sizes="(max-width: 1120px) 100vw, 1120px" /></a><p id="caption-attachment-4651" class="wp-caption-text">Visual Studio Team Service: Select Authorization Scopes</p></div></li>
<li>Once you are done with the Creation of an App certainly, you can edit the Application If you want to change Redirect URL or something.</li>
<li>furthermore, Go to MyApps Page and you have your App&#8217;s Lists there with App&#8217;s App ID as Client ID and App Secret as Client Secret.
<div id="attachment_10067" style="width: 1177px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-OAuth-App-Credentials-1.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10067" class="wp-image-10067 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-OAuth-App-Credentials-1.png" alt="VSTS-OAuth-App-Credentials" width="1167" height="495" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-OAuth-App-Credentials-1.png 1167w, https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-OAuth-App-Credentials-1-300x127.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-OAuth-App-Credentials-1-768x326.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/VSTS-OAuth-App-Credentials-1-1024x434.png 1024w" sizes="(max-width: 1167px) 100vw, 1167px" /></a><p id="caption-attachment-10067" class="wp-caption-text">Visual Studio Team Service: Your Apps with App’s Credentials</p></div></li>
</ol>
<p>finally, we are ready with an App. Let´s start with an example. In this example, we will show how to retrieve all Issues data from Visual Studio Team Service &#8211; TFS Online and create a new Issue in Visual Studio Team Service &#8211; TFS Online Work Items List under your Project with SSIS.</p>
<h3>Load VSTS data to SQL Server using SSIS JSON Source</h3>
<p>Now once you registered OAuth app in the Visual Studio Team Service &#8211; TFS Online website we can move to SSIS Part.</p>
<h4>Configure OAuth Connection Manager</h4>
<ol>
<li>Right click on Connection Managers Panel to Create New OAuth Connection, and Context Menu will appear, Select New Connection from the Context Menu.
<div id="attachment_4723" style="width: 687px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-select-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4723" class="size-full wp-image-4723" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-select-connection.png" alt="Connection Manager Panel: Select Connection" width="677" height="348" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-select-connection.png 677w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-select-connection-300x154.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-4723" class="wp-caption-text">Connection Manager Panel: Select Connection</p></div></li>
<li>Select ZS-OAUTH Connection Manager from the Connection Managers list.
<div id="attachment_4724" style="width: 681px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4724" class="wp-image-4724 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png" alt="SSIS Connection Mangers List: Select O-AUTH Connection Manager" width="671" height="549" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png 671w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager-300x245.png 300w" sizes="(max-width: 671px) 100vw, 671px" /></a><p id="caption-attachment-4724" class="wp-caption-text">SSIS Connection Mangers List: Select O-AUTH Connection Manager</p></div></li>
<li>Configure the new OAuth Connection for <strong>VSTS(Visual Studio Team Service &#8211; TFS Online)</strong> as below.</li>
<li>First lets enter Call back URL (Same URL you entered when you created App earlier)<a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-Advanced-Tab.png"><img loading="lazy" decoding="async" class="size-full wp-image-4696" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-Advanced-Tab.png" alt="SSIS OAuth Connection Manager: Advanced Tab Configurations" width="771" height="697" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-Advanced-Tab.png 771w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-Advanced-Tab-300x271.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-Advanced-Tab-768x694.png 768w" sizes="(max-width: 771px) 100vw, 771px" /></a>SSIS OAuth Connection Manager: Advanced Tab Configurations</li>
<li>For VSTS API you need to set the Refresh Token File Path as below because VSTS API Token&#8217;s Refresh Token keeps changing.<a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-OAuth2-Grant-Options-Tab.png"><img loading="lazy" decoding="async" class="size-full wp-image-4697" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-OAuth2-Grant-Options-Tab.png" alt="SSIS OAuth Connection Manager: OAuth2 Grant Options Tab Configurations" width="771" height="697" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-OAuth2-Grant-Options-Tab.png 771w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-OAuth2-Grant-Options-Tab-300x271.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-OAuth2-Grant-Options-Tab-768x694.png 768w" sizes="(max-width: 771px) 100vw, 771px" /></a></li>
<li>Then configure the App on the General tab like below (i.e. OAuth Provider, Client ID, Client Secret, Scopes, etc.)<br />
Scope must be valid one <a href="https://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&amp;bc=%2Fazure%2Fdevops%2Forganizations%2Fbreadcrumb%2Ftoc.json&amp;view=azure-devops#scopes" target="_blank" rel="noopener">from this list</a> (only those scope allowed which are checked during app creation). For example during app creation you check Work items (full) then you can enter <strong>vso.work_full</strong> in scope.<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: The scopes selected on your registered application must match the scopes entered in the scopes field (below screenshot). If they do not match exactly, an InvalidScope error can be produced.</div></div><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-General-Tab.png"><img loading="lazy" decoding="async" class="size-full wp-image-4695" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-General-Tab.png" alt="SSIS OAuth Connection Manager: General Tab Configurations" width="771" height="697" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-General-Tab.png 771w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-General-Tab-300x271.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-for-VSTS-API-configurations-General-Tab-768x694.png 768w" sizes="(max-width: 771px) 100vw, 771px" /></a></p>
<div class="mceTemp"></div>
</li>
<li>finally, you are done with the OAuth Configurations. Click on Generate Token button to Generate token and then click on Test Connection button and click on OK to save the connection manager configurations settings.</li>
</ol>
<h4>How to get ProjectID?</h4>
<p>If you don&#8217;t know the ProjectID, then you can also enter ProjectName in place of ProjectID in Request URL. you can also call GET Request for getting Lists of Projects. the Request URL for getting the list of Projects is:</p><pre class="crayon-plain-tag">https://{accountName}.visualstudio.com/_apis/projects?api-version=4.1</pre><p>
For this, we will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a></p>
<ol>
<li>First of All, Goto Control Flow Section, Drag and Drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a> from the SSIS Toolbox.
<div id="attachment_3777" class="wp-caption aligncenter">
<div id="attachment_3777" style="width: 577px" class="wp-caption aligncenter"><a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png?ssl=1"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3777" class="wp-image-3777 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png" alt="Drag and Drop REST API Task" width="567" height="297" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png 567w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin-300x157.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></a><p id="caption-attachment-3777" class="wp-caption-text">Drag and Drop REST API Task</p></div>
</div>
</li>
<li>furthermore, Double click on that Component to Edit the Configurations and Configure the task like the below-attached screesnshot.<br />
Some basic configurations need to be done in SSIS REST API Task.<br />
<strong># Request Tab: </strong></p>
<blockquote><p><strong>* </strong>Select Request URL Access Mode to Url from Connection.<br />
<strong>* </strong>Select Url Connection to your configured ZS-OAuth Connection Manager.<strong><br />
* </strong>Enter <strong>Request URL:</strong> https://zappysys.visualstudio.com/_apis/projects?api-version=4.1<br />
<strong>* </strong>Select <strong>HTTP Request Method:</strong> GET</p></blockquote>
<div id="attachment_4725" style="width: 810px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Request-Settings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4725" class="size-full wp-image-4725" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Request-Settings.png" alt="SSIS REST API Task: Request Tab Configurations" width="800" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Request-Settings.png 800w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Request-Settings-300x245.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Request-Settings-768x628.png 768w" sizes="(max-width: 800px) 100vw, 800px" /></a><p id="caption-attachment-4725" class="wp-caption-text">SSIS REST API Tsk: Request Tab Configurations</p></div>
<p>Create New Variable from Variable Menu</p>
<div id="attachment_4692" style="width: 1559px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-set-variables.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4692" class="size-full wp-image-4692" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-set-variables.png" alt="SSIS User Variables: Create a new Variable and set Value" width="1549" height="249" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-set-variables.png 1549w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-set-variables-300x48.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-set-variables-768x123.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-set-variables-1024x165.png 1024w" sizes="(max-width: 1549px) 100vw, 1549px" /></a><p id="caption-attachment-4692" class="wp-caption-text">SSIS User Variables: Create a new Variable and set Value</p></div>
<p><strong># Response Tab: </strong></p>
<blockquote><p>* Select <strong>Response Content Type:</strong> Json<br />
* Set <strong>Response Content Filter Expression:</strong> $.value[1].id<br />
* check the checkbox of <strong>Save Response Content<br />
</strong><strong>* </strong>Set <strong>Save Mode </strong>to Save to Variable<br />
* <strong>Select your Variable:</strong> {{User::ProjectID}}</p></blockquote>
<div id="attachment_4726" style="width: 810px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Response-Settings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4726" class="size-full wp-image-4726" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Response-Settings.png" alt="SSIS REST API Task: Response Tab Configurations" width="800" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Response-Settings.png 800w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Response-Settings-300x245.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-to-get-list-of-projects-VSTS-API-Response-Settings-768x628.png 768w" sizes="(max-width: 800px) 100vw, 800px" /></a><p id="caption-attachment-4726" class="wp-caption-text">SSIS REST API Task: Response Tab Configurations</p></div></li>
<li> finally, you are done with the configurations and do Test Request/Response and your ProjectID will be saved in {{User:: ProjectID}}</li>
</ol>
<h4>Configure JSON Source Component</h4>
<ol>
<li>First of all, Create a new SSIS Project or Open Existing Project in Visual Studio  (File &gt; New &gt; Project &gt; Business Intelligence &gt; Integration Services)</li>
<li>Once SSIS Package is open, Goto Data Flow Section, Drag and Drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">ZS JSON Source Component</a> from the SSIS Toolbox.
<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="wp-image-3766 size-full" 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>furthermore, Double click on that Component to Edit the Configurations. Select File path or web URL from the Access Mode drop-down.<br />
Enter Web URL like this:<br />
<pre class="crayon-plain-tag">https://{accountName}.almsearch.visualstudio.com/{project}/_apis/search/workitemsearchresults?api-version=4.1-preview.1</pre>
here, We have used 2 Parameters<strong>.</strong></p>
<p><strong>* {accountName} </strong>is the name of the Visual Studio Team Services &#8211; TFS Online account<strong>.<br />
</strong><strong>* {project} </strong>is Project ID or project name (For more See this <a href="https://docs.microsoft.com/en-us/rest/api/vsts/search/work%20item%20search%20results/fetch%20work%20item%20search%20results?view=vsts-rest-4.1">Visual Studio Team Service API Documentation for getting filtered Issues data Request API</a>)<br />
We have used Search Work Items for Fetching Paginated Work Items(Issues, Bugs)</p>
<p>You can use Variable too in your Request URL, to <strong>make URL Dynamic</strong>, See the below-attached Screenshot.<br />
To make URL dynamic first create an SSIS variable like below screenshot and then change URL to use <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm" target="_blank" rel="noopener">Variable Placeholder</a> like this</p><pre class="crayon-plain-tag">https://zappysys.almsearch.visualstudio.com/{{User::ProjectID}}/_apis/search/workitemsearchresults?api-version=4.1-preview.1</pre><p>
&nbsp;</li>
</ol>
<div id="attachment_4693" style="width: 892px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-enter-request-url.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4693" class="size-full wp-image-4693" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-enter-request-url.png" alt="SSIS JSON Source Component: Enter the Request URL" width="882" height="752" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-enter-request-url.png 882w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-enter-request-url-300x256.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-enter-request-url-768x655.png 768w" sizes="(max-width: 882px) 100vw, 882px" /></a><p id="caption-attachment-4693" class="wp-caption-text">SSIS JSON Source Component: Enter the Request URL</p></div>
<h4>JSON Source Configuration for Pagination</h4>
<ol>
<li>now, we are going to set Pagination related configurations of Visual Studio Team Service &#8211; TFS Online for Getting all WorkItems with Search POST REST Request API. Here in our example,<br />
<strong><strong>Request Method: POST<br />
Body Content-Type: JSON (application/json)<br />
Request Body:<br />
</strong></strong><br />
<pre class="crayon-plain-tag">{
  "searchText": "a",
  "$skip": &lt;%page%&gt;,
  "$top": 100,
  "filters": {
    "System.TeamProject": [
      "ProductTesting"
    ]
  }
}</pre>
here, SearchText: The SearchText for filtering WorkItems based on the keywords match.<br />
<strong>$skip:</strong> Number of results to be skipped<br />
<strong>$top:</strong> Number of results to be returned.<br />
<div class="su-note"  style="border-color:#e5e54c;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:#FFFF66;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">you can take any number of the page size. for example, you can set 100 in both $skip and $top properties (I have set 10 for the Demo Purpose only)</div></div>
filters: Filters to be applied. Set it to null if there are no filters to be applied.<br />
System.TeamProject: ProjectName in which you want to do filtering of WorkItems.</p>
<div id="attachment_4698" style="width: 1174px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-settings-tab.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4698" class="size-full wp-image-4698" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-settings-tab.png" alt="SSIS JSON Source Component: Configurations of Settings Tab" width="1164" height="728" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-settings-tab.png 1164w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-settings-tab-300x188.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-settings-tab-768x480.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-settings-tab-1024x640.png 1024w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-settings-tab-436x272.png 436w" sizes="(max-width: 1164px) 100vw, 1164px" /></a><p id="caption-attachment-4698" class="wp-caption-text">SSIS JSON Source Component: Configurations of Settings Tab</p></div></li>
<li> You can Configure the Pagination Tab something like this:
<div id="attachment_4699" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-pagination-tab.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4699" class="size-full wp-image-4699" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-pagination-tab.png" alt="SSIS JSON Source Component: Pagination Tab Settings" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-pagination-tab.png 826w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-pagination-tab-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-for-VSTS-API-request-pagination-tab-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-4699" class="wp-caption-text">SSIS JSON Source Component: Pagination Tab Settings</p></div></li>
<li>furthermore, Select the Filter to set the Filter.
<div id="attachment_4700" style="width: 1093px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-select-filter-for-VSTS-API-POST-Request.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4700" class="size-full wp-image-4700" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-select-filter-for-VSTS-API-POST-Request.png" alt="SSIS JSON Source Component Configurations: Select Filter" width="1083" height="729" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-select-filter-for-VSTS-API-POST-Request.png 1083w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-select-filter-for-VSTS-API-POST-Request-300x202.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-select-filter-for-VSTS-API-POST-Request-768x517.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-select-filter-for-VSTS-API-POST-Request-1024x689.png 1024w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-select-filter-for-VSTS-API-POST-Request-272x182.png 272w" sizes="(max-width: 1083px) 100vw, 1083px" /></a><p id="caption-attachment-4700" class="wp-caption-text">SSIS JSON Source Component Configurations: Select Filter</p></div></li>
<li>It seems like you are all OK with the configurations, Click on the Preview button to see the response data.
<div id="attachment_4701" style="width: 1519px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-VSTS-API-preview-response-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4701" class="size-full wp-image-4701" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-VSTS-API-preview-response-data.png" alt="SSIS JSON Source Component: See the Preview" width="1509" height="731" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-VSTS-API-preview-response-data.png 1509w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-VSTS-API-preview-response-data-300x145.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-VSTS-API-preview-response-data-768x372.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-VSTS-API-preview-response-data-1024x496.png 1024w" sizes="(max-width: 1509px) 100vw, 1509px" /></a><p id="caption-attachment-4701" class="wp-caption-text">SSIS JSON Source Component: See the Preview</p></div></li>
<li>finally, Click on OK button to save JSON Source settings.</li>
</ol>
<h4>Configure OLE DB Destination Component for dumping Contacts data into SQL</h4>
<ol>
<li>first of all, Drag any destination (i.e. OLEDB Destination) from your SSIS toolbox. For demo purpose, we will load Contacts data into SQL Server Table.
<div id="attachment_4335" style="width: 819px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4335" class="size-full wp-image-4335" src="https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component.png" alt="Drag and Drop OLE DB Destination Component" width="809" height="497" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component.png 809w, https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component-300x184.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component-768x472.png 768w" sizes="(max-width: 809px) 100vw, 809px" /></a><p id="caption-attachment-4335" class="wp-caption-text">Drag and Drop OLE DB Destination Component</p></div></li>
<li>Configure OLEDB Destination (Select Connection and Target Table). You can Create a new Table for the destination by clicking a NEW button next to Table drop-down.
<div id="attachment_4703" style="width: 1176px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-for-dumping-workitems-list-in-sql.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4703" class="size-full wp-image-4703" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-for-dumping-workitems-list-in-sql.png" alt="OLE DB Destination Component - Configure for dumping WorkItems of Project from VSTS data in SQL Table" width="1166" height="772" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-for-dumping-workitems-list-in-sql.png 1166w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-for-dumping-workitems-list-in-sql-300x199.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-for-dumping-workitems-list-in-sql-768x508.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-for-dumping-workitems-list-in-sql-1024x678.png 1024w" sizes="(max-width: 1166px) 100vw, 1166px" /></a><p id="caption-attachment-4703" class="wp-caption-text">OLE DB Destination Component &#8211; Configure for dumping WorkItems of Project from VSTS data in SQL Table</p></div></li>
<li>almost you are done with the configurations, just need to configure mappings, So for that Click on the Columns Tab to configure Mappings. also, Click on OK button to Save the configurations of OLE DB Destination Component.
<div id="attachment_4704" style="width: 834px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-configure-column-mappings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4704" class="size-full wp-image-4704" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-configure-column-mappings.png" alt="OLE DB Destination - Column Configurations" width="824" height="718" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-configure-column-mappings.png 824w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-configure-column-mappings-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-ole-db-destination-configure-column-mappings-768x669.png 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><p id="caption-attachment-4704" class="wp-caption-text">OLE DB Destination &#8211; Column Configurations</p></div></li>
<li>furthermore, You can see the requests in <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/">Fiddler</a> to see the Paginated requests flows.
<div id="attachment_4705" style="width: 1540px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/see-the-fiddler-requests.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4705" class="size-full wp-image-4705" src="https://zappysys.com/blog/wp-content/uploads/2018/08/see-the-fiddler-requests.png" alt="Fiddler - See All The Requests" width="1530" height="649" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/see-the-fiddler-requests.png 1530w, https://zappysys.com/blog/wp-content/uploads/2018/08/see-the-fiddler-requests-300x127.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/see-the-fiddler-requests-768x326.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/see-the-fiddler-requests-1024x434.png 1024w" sizes="(max-width: 1530px) 100vw, 1530px" /></a><p id="caption-attachment-4705" class="wp-caption-text">Fiddler &#8211; See All The Requests</p></div></li>
<li>finally, Execute your package to Load Contacts data from Visual Studio Team Service &#8211; TFS Online to SQL Server.</li>
</ol>
<h2>Create a new WorkItem on Visual Studio Team Service &#8211; TFS Online (Use SSIS REST API Task)</h2>
<p>Now let&#8217;s look at one more example to call Visual Studio Team Service(VSTS) &#8211; TFS Online REST API. This time we will create a new WorkItem using REST API call in SSIS. For this, we will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a></p>
<ol>
<li>First of All, Goto Control Flow Section, Drag and Drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a> from the SSIS Toolbox.
<div id="attachment_3777" style="width: 577px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3777" class="wp-image-3777 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png" alt="Drag and Drop REST API Task" width="567" height="297" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png 567w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin-300x157.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></a><p id="caption-attachment-3777" class="wp-caption-text">Drag and Drop REST API Task</p></div></li>
<li>furthermore, Double click on that Component to Edit the Configurations and Configure the task like the below-attached screesnshot.<br />
<pre class="crayon-plain-tag">::::: Request Settings :::::

* Select Request URL Access Mode to select Url from Connection.
* Select Url Connection: Select your created OAUTH Connection Manager.
* Enter Reqeust URL
      Request URL: POST https://{accountName}.visualstudio.com/{project}/_apis/wit/workitems/${type}?api-version=4.1
      here, 
      {accountName} - The name of the Visual Studio Team Services account.
      {project} - Project ID or project name
      {type} - WorkItems Type (Task, Bug, Issue, Requirement etc)
* Select HTTP Request Method as PATCH method
* Enter Request Body.
      Request Body:
      [
         {
             "op": "add",
             "path": "/fields/System.Title",
             "value": "Sample task"
         }
      ]
* Select Body Content Type: Text/Plain
*Enter Request Header:
        Content-Type: application/json-patch+json
(For more Information See this Visual Studio Team Service - TFS Online API Documentation for Creating a new WorkItem
https://docs.microsoft.com/en-us/rest/api/vsts/wit/work%20items/create?view=vsts-rest-4.1)</pre>
<div id="attachment_4707" style="width: 1068px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4707" class="size-full wp-image-4707" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API.png" alt="REST API Task: Configurations" width="1058" height="652" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API.png 1058w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-300x185.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-768x473.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-1024x631.png 1024w" sizes="(max-width: 1058px) 100vw, 1058px" /></a><p id="caption-attachment-4707" class="wp-caption-text">REST API Task: Configurations</p></div></li>
<li>So all good with the Configurations let&#8217;s do Test Request/Response by clicking on Test Request/Response button. See the below-attached request/response screen.
<div id="attachment_4708" style="width: 1274px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-test-request-response.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4708" class="size-full wp-image-4708" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-test-request-response.png" alt="Create New WorkItem in VSTS Account: Do Test Request/Response" width="1264" height="671" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-test-request-response.png 1264w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-test-request-response-300x159.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-test-request-response-768x408.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-create-new-workitems-VSTS-API-test-request-response-1024x544.png 1024w" sizes="(max-width: 1264px) 100vw, 1264px" /></a><p id="caption-attachment-4708" class="wp-caption-text">Create New WorkItem in VSTS Account: Do Test Request/Response</p></div></li>
<li>finally, you have created a WorkItem in VSTS successfully using VSTS REST API and REST API Task, See in VSTS Site.
<div id="attachment_4714" style="width: 1609px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/newly-created-workitem-in-workitems-list-VSTS-API.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4714" class="wp-image-4714 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/newly-created-workitem-in-workitems-list-VSTS-API.png" alt="VSTS Site: See the Newly Created WorkItem" width="1599" height="389" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/newly-created-workitem-in-workitems-list-VSTS-API.png 1599w, https://zappysys.com/blog/wp-content/uploads/2018/08/newly-created-workitem-in-workitems-list-VSTS-API-300x73.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/newly-created-workitem-in-workitems-list-VSTS-API-768x187.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/newly-created-workitem-in-workitems-list-VSTS-API-1024x249.png 1024w" sizes="(max-width: 1599px) 100vw, 1599px" /></a><p id="caption-attachment-4714" class="wp-caption-text">VSTS Site: See the Newly Created WorkItem</p></div></li>
<li>And that&#8217;s it. similarly, you can Update/Delete particular WorkItem in WorkItems List in VSTS.</li>
</ol>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>In this blog, we learned how to read Visual Studio Team Services &#8211; TFS(Team Foundation Server) Online data in SSIS, How to register an OAuth App for Visual Studio Team Service REST API, How to get all WorkItems data from Visual Studio Team Service  &#8211; TFS(Team Foundation Server) Online and create a new WorkItem on VSTS with SSIS using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">ZS JSON Source Component</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a> in a very simple way. You can achieve many more functionalities with the use of both of these tools. Check our blogs/articles on <strong>REST API Task </strong><a href="https://zappysys.com/blog/tag/ssis-rest-api-task/">https://zappysys.com/blog/tag/ssis-rest-api-task/</a> and <strong>JSON Source Component </strong><a href="https://zappysys.com/blog/tag/ssis-json-source/">https://zappysys.com/blog/tag/ssis-json-source/</a> to find out what <em>these tools</em> are capable of more.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following links for more information about the use of VSTS API with our tools:</p>
<ul>
<li><a href="https://docs.microsoft.com/en-us/rest/api/vsts/?view=vsts-rest-4.1">Visual Studio Team Service Documentation for API</a></li>
<li><strong>Landing Page</strong> for <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">REST API Task</a>, you can also find <a href="https://youtu.be/jPdcQlWOBZA">Tutorial Video</a> here.</li>
<li><strong>Landing Page</strong> for <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Component</a>, you can also find <a href="https://youtu.be/t4fSghbSZLo">Tutorial Video</a> here.</li>
<li><strong>Help File:</strong> Documentation of <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=ssis-rest-api-web-service-task.htm">SSIS REST API Task</a> and <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=json-source.htm">JSON Source Component</a>.</li>
</ul>
<p>The post <a href="https://zappysys.com/blog/read-vsts-data-ssis-call-rest-api-load-sql-server/">Read Azure DevOps data in SSIS (VSTS / TFS Online) – Call REST API / Load to SQL Server</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read Constant Contact data in SSIS – Call REST API / Load to SQL Server</title>
		<link>https://zappysys.com/blog/read-constant-contact-data-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 04 Aug 2018 10:29:59 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[Constant Contact]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=4537</guid>

					<description><![CDATA[<p>Introduction &#160; In this blog, we will learn How to read Constant Contact data in SSIS and load into SQL Server Table, along with few other topics such as how to generate an API Token using Mashery Developer Account for Constant Contact REST API Call, how to read all Contacts from Constant Contact with SSIS and [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-constant-contact-data-ssis/">How to read Constant Contact data in SSIS – Call REST API / Load to SQL Server</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>&nbsp;</p>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/constnt-contact-logo-150x150.png"><img loading="lazy" decoding="async" class=" wp-image-4630 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/08/constnt-contact-logo-150x150.png" alt="Constant Contact Logo" width="198" height="197" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/constnt-contact-logo-150x150.png 364w, https://zappysys.com/blog/wp-content/uploads/2018/08/constnt-contact-logo-150x150-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2018/08/constnt-contact-logo-150x150-300x298.png 300w" sizes="(max-width: 198px) 100vw, 198px" /></a>In this blog, we will learn <strong>How to read Constant Contact data in SSIS and load into SQL Server Table</strong>, along with few other topics such as how to generate an API Token using Mashery Developer Account for <strong>Constant Contact REST API Call</strong>, how to read all Contacts from Constant Contact with SSIS and finally How to add new Contact in Constant Contact Contact List Collection.</p>
<p>We will go through the steps to read Contact data from Constant Contact and Load into SQL Server using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source.</a></p>
<p>In nutshell, this post will focus on how to call Constant Contact API using SSIS. If you are MailChimp user and curious how to perform data integration in SSIS then check this article about <a href="https://zappysys.com/blog/get-data-from-mailchimp-in-ssis-using-rest-api-call/" target="_blank" rel="noopener">reading MailChimp data in SSIS</a>.</p>
<p>So let&#8217;s get started.</p>
<h2><span id="Requirements">Prerequisite<br />
</span></h2>
<ol>
<li>First, you will need to have SSIS installed</li>
<li>Secondly, make sure to have SSDT</li>
<li>Finally, do not forget to install ZappySys <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a></li>
</ol>
<h2>What is Constant Contact</h2>
<p>Keeping in touch with customers on a consistent basis is one key to maintaining current clients and bringing in new ones. A number of companies exist that provide businesses with a way to contact clients regularly through snail mail, email or social media. Constant Contact offers online marketing services for businesses to stay in touch with clients.</p>
<h2>Getting Started</h2>
<p>In order to start, we will show several examples. ZappySys includes an <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source</a> that will help you to call Constant Contact API to read Constant Contact data, retrieve lists of Contacts data from Constant Contact, Add new Contact in Constant Contact with SSIS and do many more actions using REST API. To learn more about Constant Contact API <a href="http://developer.constantcontact.com/docs/developer-guides/overview-of-api-endpoints.html" rel="noopener">check this help file</a>.</p>
<h3>Setup your Mashery Developer Account</h3>
<p>To access Constant Contact data using Mashery Developer Account you need to register a MasheryID with Constant Contact. Follow the steps mentioned below to register Mashery Developer Account for Constant Contact Access:</p>
<ol>
<li>first of all, you can directly login to the <a href="https://constantcontact.mashery.com/member/">Constant Contact site</a> with your credentials, and redirect to the <a href="https://constantcontact.mashery.com/member/register">Mashrey Developer Console</a> to register a MasheryID.</li>
<li>thereafter Fillup the form and click on Register button
<div id="attachment_4541" style="width: 909px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/register-marshey-developer-account.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4541" class="wp-image-4541 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/register-marshey-developer-account.png" alt="Register Mashery ID to Constant Contact" width="899" height="762" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/register-marshey-developer-account.png 899w, https://zappysys.com/blog/wp-content/uploads/2018/08/register-marshey-developer-account-300x254.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/register-marshey-developer-account-768x651.png 768w" sizes="(max-width: 899px) 100vw, 899px" /></a><p id="caption-attachment-4541" class="wp-caption-text">Register Mashery ID to Constant Contact</p></div></li>
<li>If you have already registered on Mashery Developer Account, then you just have to log in using your Credentials.
<div id="attachment_4542" style="width: 910px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/log-in-marshey-developer-account.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4542" class="wp-image-4542 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/log-in-marshey-developer-account.png" alt="Login to Mashery Developer Account" width="900" height="579" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/log-in-marshey-developer-account.png 900w, https://zappysys.com/blog/wp-content/uploads/2018/08/log-in-marshey-developer-account-300x193.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/log-in-marshey-developer-account-768x494.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></a><p id="caption-attachment-4542" class="wp-caption-text">Login to Mashery Developer Account</p></div></li>
<li>So, when you are done with the Mashery, you can go to <a href="https://constantcontact.mashery.com/apps/myapps">MyApplication Page</a> to create a new application.</li>
</ol>
<h3>Create Constant Contact App (for OAuth)</h3>
<p>To access Constant Contact data using REST API call you need to create a Mashery app. Follow the steps mentioned below to register Constant Contact OAuth App:</p>
<ol>
<li>First of all, you can directly login to the <a href="https://constantcontact.mashery.com/login">Mashery Developer Account</a> with your credentials, and redirect to the Constant Contact My Application&#8217;s Page for creating an app.</li>
<li>also, you can open the <a href="https://constantcontact.mashery.com/apps/myapps">MyApps Page</a>.
<div id="attachment_4585" style="width: 910px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-for-oauth-connection-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4585" class="wp-image-4585 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-for-oauth-connection-1.png" alt="Constant Contact: My Apps" width="900" height="356" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-for-oauth-connection-1.png 900w, https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-for-oauth-connection-1-300x119.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-for-oauth-connection-1-768x304.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></a><p id="caption-attachment-4585" class="wp-caption-text">Constant Contact: My Apps</p></div></li>
<li>Click on Create a New Application button while, the new Application form appears, Fill it up.
<div id="attachment_4570" style="width: 907px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-registration-form-for-oauth-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4570" class="size-full wp-image-4570" src="https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-registration-form-for-oauth-connection.png" alt="Constant Contact: Create New Application Form" width="897" height="1544" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-registration-form-for-oauth-connection.png 897w, https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-registration-form-for-oauth-connection-174x300.png 174w, https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-registration-form-for-oauth-connection-768x1322.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/create-new-app-registration-form-for-oauth-connection-595x1024.png 595w" sizes="(max-width: 897px) 100vw, 897px" /></a><p id="caption-attachment-4570" class="wp-caption-text">Constant Contact: Create New Application Form</p></div></li>
<li>Once you are done with the Creation of an App certainly, you can edit the Application.<br />
Enter the Redirect URL there.</p>
<div id="attachment_4587" style="width: 878px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/edit-app-for-oauth-connection-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4587" class="wp-image-4587 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/edit-app-for-oauth-connection-1.png" alt="Constant Contact : Edit Application" width="868" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/edit-app-for-oauth-connection-1.png 868w, https://zappysys.com/blog/wp-content/uploads/2018/08/edit-app-for-oauth-connection-1-300x253.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/edit-app-for-oauth-connection-1-768x649.png 768w" sizes="(max-width: 868px) 100vw, 868px" /></a><p id="caption-attachment-4587" class="wp-caption-text">Constant Contact: Edit Application</p></div></li>
<li>furthermore, Go to Keys tab and you have your App&#8217;s Lists there with App&#8217;s Key as Client ID and Secret as Client Secret.
<div id="attachment_4588" style="width: 908px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/oauth-app-keys-for-connection-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4588" class="wp-image-4588 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/oauth-app-keys-for-connection-1.png" alt="Constant Contact: Apps Keys" width="898" height="698" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/oauth-app-keys-for-connection-1.png 898w, https://zappysys.com/blog/wp-content/uploads/2018/08/oauth-app-keys-for-connection-1-300x233.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/oauth-app-keys-for-connection-1-768x597.png 768w" sizes="(max-width: 898px) 100vw, 898px" /></a><p id="caption-attachment-4588" class="wp-caption-text">Constant Contact: Apps Keys</p></div></li>
</ol>
<p>finally, we are ready with an App. Let´s start with an example. In this example, we will show how to retrieve all Contacts data from Constant Contact and add a new Contact in Contact Collection List on Constant contact with SSIS.</p>
<h3>Load Constant Contact data to SQL Server using SSIS JSON Source</h3>
<p>Now once you registered OAuth app in the Constant Contact website we can move to SSIS Part.</p>
<h4>Configure JSON Source Component</h4>
<ol>
<li>First of all, Create a new SSIS Project or Open Existing Project in Visual Studio  (File &gt; New &gt; Project &gt; Business Intelligence &gt; Integration Services)</li>
<li>Once SSIS Package is open, Goto Data Flow Section, Drag and Drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">ZS JSON Source Component</a> from the SSIS Toolbox.
<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="wp-image-3766 size-full" 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>furthermore, Double click on that Component to Edit the Configurations. Select File path or web URL from the Access Mode drop-down.<br />
Enter Web URL like this:<br />
<pre class="crayon-plain-tag">https://api.constantcontact.com/v2/contacts?status=ALL&amp;limit=100&amp;api_key=&lt;&lt;&lt;Your_App_Key&gt;&gt;&gt;</pre>
here, We have used 2 Parameters<strong>.</strong></p>
<p><strong>* status</strong> is the filter the response based on the contact status property: <strong>ALL, ACTIVE, UNCONFIRMED, OPTOUT, or REMOVED.<br />
</strong><strong>* limit </strong>is the number of contacts to return per page, 1-500, default 50 (For more See this <a href="http://developer.constantcontact.com/docs/contacts-api/contacts-collection.html">Constant Contact API Documentation for getting Contacts Request API</a>)<br />
* <strong>&lt;&lt;&lt;Your_App_Key&gt;&gt;&gt; </strong>is your App Key, So you need to add your app key.</p>
<p>You can use Variable too in your Request URL, to <strong>make URL Dynamic</strong>, See the below-attached Screenshot.<br />
To make URL dynamic first create a SSIS variable like below screenshot and then change URL to use <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm" target="_blank" rel="noopener">Variable Placeholder</a> like this</p>
<p><em>https://api.constantcontact.com/v2/contacts?status=ALL&amp;limit=100&amp;api_key=<strong>{{User::AppKey}}</strong></em></p>
<div id="attachment_4597" style="width: 1565px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-create-variable-and-set-value-for-dynamic-url.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4597" class="wp-image-4597 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-create-variable-and-set-value-for-dynamic-url.png" alt="SSIS User Variables: Create a new Variable and set Value" width="1555" height="317" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-create-variable-and-set-value-for-dynamic-url.png 1555w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-create-variable-and-set-value-for-dynamic-url-300x61.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-create-variable-and-set-value-for-dynamic-url-768x157.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-create-variable-and-set-value-for-dynamic-url-1024x209.png 1024w" sizes="(max-width: 1555px) 100vw, 1555px" /></a><p id="caption-attachment-4597" class="wp-caption-text">SSIS User Variables: Create a new Variable and set Value</p></div>
<div id="attachment_4589" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4589" class="wp-image-4589 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-1.png" alt="SSIS JSON Source Component: Enter the Request URL" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-1.png 826w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-1-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-1-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-4589" class="wp-caption-text">SSIS JSON Source Component: Enter the Request URL</p></div></li>
</ol>
<h4>Configure OAuth Connection Manager</h4>
<ol>
<li>Check Use Credentials Option and select a new ZS-OAuth Connection from the drop-down.</li>
<li>Configure the new OAuth Connection for Constant Contact as below.<br />
Basically, you need to configure the configurations of App on the General tab (i.e. Client ID, Client Secret, Authorization URL, Access Token URL)</p>
<div id="attachment_4590" style="width: 1439px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-general-tab-for-constant-contact-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4590" class="wp-image-4590 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-general-tab-for-constant-contact-1.png" alt="SSIS OAuth Connection Manager: General Tab Configurations" width="1429" height="740" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-general-tab-for-constant-contact-1.png 1429w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-general-tab-for-constant-contact-1-300x155.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-general-tab-for-constant-contact-1-768x398.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-general-tab-for-constant-contact-1-1024x530.png 1024w" sizes="(max-width: 1429px) 100vw, 1429px" /></a><p id="caption-attachment-4590" class="wp-caption-text">SSIS OAuth Connection Manager: General Tab Configurations</p></div>
<p>also, most importantly, you need to Enter your Callback URL in Advanced Tab.</p>
<div id="attachment_4591" style="width: 1438px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-advance-tab-for-constant-contact-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4591" class="wp-image-4591 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-advance-tab-for-constant-contact-1.png" alt="SSIS OAuth Connection Manager: Advance Tab Configurations." width="1428" height="740" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-advance-tab-for-constant-contact-1.png 1428w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-advance-tab-for-constant-contact-1-300x155.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-advance-tab-for-constant-contact-1-768x398.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oauth-connection-manager-advance-tab-for-constant-contact-1-1024x531.png 1024w" sizes="(max-width: 1428px) 100vw, 1428px" /></a><p id="caption-attachment-4591" class="wp-caption-text">SSIS OAuth Connection Manager: Advance Tab Configurations.</p></div></li>
</ol>
<h4>JSON Source Configuration for Pagination</h4>
<ol>
<li> now, we are going to set Pagination related configurations for Constant Contact Getting all Contacts request. Here in our example, we are setting Page size as 5. while We need to read the next page information from the response.<br />
So, we can set the <strong>status=ALL, Limit=100</strong> and also we can specify Next Link Expression something like this: <strong>$.meta.pagination.next_link </strong>and Suffix for Next URL: <strong><strong>?api_key={{User::AppKey}}<br />
</strong></strong></p>
<div id="attachment_4592" style="width: 836px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-pagination-settings-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4592" class="wp-image-4592 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-pagination-settings-1.png" alt="SSIS JSON Source - Constant Contact request Pagination Configurations Settings" width="826" height="733" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-pagination-settings-1.png 826w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-pagination-settings-1-300x266.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-pagination-settings-1-768x682.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-4592" class="wp-caption-text">SSIS JSON Source &#8211; Constant Contact request Pagination Configurations Settings</p></div></li>
<li>furthermore Select the Filter to set the Filter. seems like you are all OK with the configurations, Click on Preview button to see the response data.
<div id="attachment_4593" style="width: 1307px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-see-preview-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4593" class="wp-image-4593 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-see-preview-1.png" alt="JSON Source: Preview Contacts data of Constant Contact" width="1297" height="707" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-see-preview-1.png 1297w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-see-preview-1-300x164.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-see-preview-1-768x419.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-json-source-constant-contact-request-api-see-preview-1-1024x558.png 1024w" sizes="(max-width: 1297px) 100vw, 1297px" /></a><p id="caption-attachment-4593" class="wp-caption-text">JSON Source: Preview Contacts data of Constant Contact</p></div></li>
<li>finally, Click on OK button to save JSON Source settings.</li>
</ol>
<h4>Configure OLE DB Destination Component for dumping Contacts data into SQL</h4>
<ol>
<li>first of all, Drag any destination (i.e. OLEDB Destination) from your SSIS toolbox. For demo purpose, we will load Contacts data into SQL Server Table.
<div id="attachment_4335" style="width: 819px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4335" class="size-full wp-image-4335" src="https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component.png" alt="Drag and Drop OLE DB Destination Component" width="809" height="497" srcset="https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component.png 809w, https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component-300x184.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/07/ssis-oledb-destination-component-768x472.png 768w" sizes="(max-width: 809px) 100vw, 809px" /></a><p id="caption-attachment-4335" class="wp-caption-text">Drag and Drop OLE DB Destination Component</p></div></li>
<li>Configure OLEDB Destination (Select Connection and Target Table). You can Create a new Table for the destination by clicking a NEW button next to Table drop-down.
<div id="attachment_4594" style="width: 1182px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4594" class="wp-image-4594 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-1.png" alt="OLE DB Destination Component - Configure for dumping Constant Contact data in SQL Table" width="1172" height="773" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-1.png 1172w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-1-300x198.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-1-768x507.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-1-1024x675.png 1024w" sizes="(max-width: 1172px) 100vw, 1172px" /></a><p id="caption-attachment-4594" class="wp-caption-text">OLE DB Destination Component &#8211; Configure for dumping Constant Contact data in SQL Table</p></div></li>
<li>almost you are done with the configurations, just need to configure mappings, So for that Click on the Columns Tab to configure Mappings. also, Click on OK button to Save the configurations of OLE DB Destination Component.
<div id="attachment_4595" style="width: 834px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-columns-mappings-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4595" class="wp-image-4595 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-columns-mappings-1.png" alt="OLE DB Destination - Column Configurations" width="824" height="718" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-columns-mappings-1.png 824w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-columns-mappings-1-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-oledb-destination-for-dumping-constant-contact-data-columns-mappings-1-768x669.png 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><p id="caption-attachment-4595" class="wp-caption-text">OLE DB Destination &#8211; Column Configurations</p></div></li>
<li>furthermore, You can see the requests in <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/">Fiddler</a> to see the Paginated requests flows.
<div id="attachment_4580" style="width: 1504px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/see-paginated-requests-of-constantcontact-api-in-fiddler.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4580" class="size-full wp-image-4580" src="https://zappysys.com/blog/wp-content/uploads/2018/08/see-paginated-requests-of-constantcontact-api-in-fiddler.png" alt="Fiddler - See All The Requests" width="1494" height="518" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/see-paginated-requests-of-constantcontact-api-in-fiddler.png 1494w, https://zappysys.com/blog/wp-content/uploads/2018/08/see-paginated-requests-of-constantcontact-api-in-fiddler-300x104.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/see-paginated-requests-of-constantcontact-api-in-fiddler-768x266.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/see-paginated-requests-of-constantcontact-api-in-fiddler-1024x355.png 1024w" sizes="(max-width: 1494px) 100vw, 1494px" /></a><p id="caption-attachment-4580" class="wp-caption-text">Fiddler &#8211; See All The Requests</p></div></li>
<li>finally, Execute your package to Load Contacts data from Constant Contact to SQL Server.</li>
</ol>
<h2>Add a new Contact on Constant Contact (Use SSIS REST API Task)</h2>
<p>Now let&#8217;s look at one more example to call Constant Contact REST API. This time we will add a new contact using REST API call in SSIS. For this, we will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a></p>
<ol>
<li>First of All, Goto Control Flow Section, Drag and Drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a> from the SSIS Toolbox.
<div id="attachment_3777" style="width: 577px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3777" class="wp-image-3777 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png" alt="Drag and Drop REST API Task" width="567" height="297" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png 567w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin-300x157.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></a><p id="caption-attachment-3777" class="wp-caption-text">Drag and Drop REST API Task</p></div></li>
<li>furthermore, Double click on that Component to Edit the Configurations and Configure the task like the below-attached screesnshot.<br />
<pre class="crayon-plain-tag">Request URL: 
https://api.constantcontact.com/v2/contacts?action_by=ACTION_BY_OWNER&amp;api_key=&lt;&lt;&lt;YOUR_APP_KEY&gt;&gt;&gt;

here, action_by Can be ACTION_BY_OWNER or ACTION_BY_VISITOR (from the API Document,<a href="http://developer.constantcontact.com/docs/contacts-api/contacts-collection.html?method=POST">Click here for more Informaion</a>)
Sample Request Body: 
{
	"addresses": [{
		"line1": "4928 Small Street",
		"city": "New York",
		"address_type": "PERSONAL",
		"state_code": "MA",
		"country_code": "us",
		"postal_code": "10022"
	}],
	"lists": [{
		"id": "1652428712"
	}],
	"email_addresses": [{
		"email_address": "hbshah@zappysys.com"
	}],
	"prefix_name": "Mr.",
	"first_name": "Hardik",
	"last_name": "Shah",
	"job_title": "Tech Supporter",
	"company_name": "ZappySys",
	"home_phone": "555-555-5555",
	"work_phone": "555-555-5555",
	"cell_phone": "555-555-5555",
	"fax": "555-555-5555",
	"custom_fields": [{
		"name": "CustomField1",
		"value": "Has control of $25 million budget"
	}]
}</pre>
<div id="attachment_4599" style="width: 1251px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4599" class="size-full wp-image-4599" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact.png" alt="REST API Task: Configurations" width="1241" height="717" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact.png 1241w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-300x173.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-768x444.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-1024x592.png 1024w" sizes="(max-width: 1241px) 100vw, 1241px" /></a><p id="caption-attachment-4599" class="wp-caption-text">REST API Task: Configurations</p></div></li>
<li>now you are done with the configurations. you can do Test Request/Response. See the below-attached request/response screen.
<div id="attachment_4600" style="width: 1328px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-test-request-response.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4600" class="size-full wp-image-4600" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-test-request-response.png" alt="Add New Contact in Costant Contact Account: Do Test Request/Response " width="1318" height="696" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-test-request-response.png 1318w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-test-request-response-300x158.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-test-request-response-768x406.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-test-request-response-1024x541.png 1024w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-rest-api-task-configuration-for-add-new-contact-in-constant-contact-test-request-response-720x380.png 720w" sizes="(max-width: 1318px) 100vw, 1318px" /></a><p id="caption-attachment-4600" class="wp-caption-text">Add New Contact in Constant Contact Account: Do Test Request/Response</p></div></li>
<li>finally, you have successfully added a contact. furthermore, Goto your Constant Contact Account on its site, you can see the latest Contact added which is added by us with the use of ZappySys and SSIS.
<div id="attachment_4601" style="width: 1604px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/constant-contact-newly-added-contact.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4601" class="size-full wp-image-4601" src="https://zappysys.com/blog/wp-content/uploads/2018/08/constant-contact-newly-added-contact.png" alt="Constant Contact Site: See the Newly Added Contact" width="1594" height="593" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/constant-contact-newly-added-contact.png 1594w, https://zappysys.com/blog/wp-content/uploads/2018/08/constant-contact-newly-added-contact-300x112.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/08/constant-contact-newly-added-contact-768x286.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/08/constant-contact-newly-added-contact-1024x381.png 1024w" sizes="(max-width: 1594px) 100vw, 1594px" /></a><p id="caption-attachment-4601" class="wp-caption-text">Constant Contact Site: See the Newly Added Contact</p></div></li>
<li>though, You are done with adding a contact in Constant Contact. similarly, you can Update/Delete particular Contact in Contact Collection List.</li>
</ol>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>In this blog, we learned how to Setup your Mashery Developer Account, Create Constant Contact App for OAuth, Get all Contacts data from Constant Contact and add a new contact on Constant Contact with SSIS using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">ZS JSON Source Component</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a> in a very simple way. You can achieve many more functionalities with the use of both of these tools. Check our blogs/articles on <strong>REST API Task </strong><a href="https://zappysys.com/blog/tag/ssis-rest-api-task/">https://zappysys.com/blog/tag/ssis-rest-api-task/</a> and <strong>JSON Source Component </strong><a href="https://zappysys.com/blog/tag/ssis-json-source/">https://zappysys.com/blog/tag/ssis-json-source/</a> to find out what <em>these tools</em> are capable of more.</p>
<h2><span id="References">References</span></h2>
<p>Finally, you can use the following links for more information about the use of Constant Contact API with our tools:</p>
<ul>
<li><a href="http://developer.constantcontact.com/docs/developer-guides/api-documentation-index.html">Constant Contact Documentation for API</a></li>
<li><strong>Landing Page</strong> for <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">REST API Task</a>, you can also find <a href="https://youtu.be/jPdcQlWOBZA">Tutorial Video</a> here.</li>
<li><strong>Landing Page</strong> for <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source Component</a>, you can also find <a href="https://youtu.be/t4fSghbSZLo">Tutorial Video</a> here.</li>
<li><strong>Help File:</strong> Documentation of <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=ssis-rest-api-web-service-task.htm">SSIS REST API Task</a> and <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=json-source.htm">JSON Source Component</a>.</li>
</ul>
<p>The post <a href="https://zappysys.com/blog/read-constant-contact-data-ssis/">How to read Constant Contact data in SSIS – Call REST API / Load to SQL Server</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Import / Export data from Zuora API using SSIS</title>
		<link>https://zappysys.com/blog/how-to-import-export-data-zuora-api-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 24 Jan 2018 18:57:41 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Parser Task]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[zuora]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2515</guid>

					<description><![CDATA[<p>Introduction In this post, we will learn how to call Zuora API using SSIS.  We will go through steps to read data from Zuora and load into SQL Server using  SSIS REST API Task  and  SSIS JSON Source . At the end of this article, you will find a complete sample (dtsx file). &#160; Tasks/Components in SSIS for [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/how-to-import-export-data-zuora-api-using-ssis/">How to Import / Export data from Zuora API using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class=" wp-image-2520 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/01/zuora-api-integration-logo.png" alt="zuora-api-integration-logo" width="122" height="122" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/zuora-api-integration-logo.png 180w, https://zappysys.com/blog/wp-content/uploads/2018/01/zuora-api-integration-logo-150x150.png 150w" sizes="(max-width: 122px) 100vw, 122px" /></p>
<h2>Introduction</h2>
<p>In this post, we will learn how to call Zuora API using SSIS.  We will go through steps to read data from Zuora and load into SQL Server using  <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">SSIS REST API Task</a>  and  <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source</a> . At the end of this article, you will find a complete sample (dtsx file).</p>
<p>&nbsp;</p>
<h2><span id="TasksComponents_in_SSISfor_Consuming_RESTful_API_WebService">Tasks/Components in SSIS for Consuming RESTful API / WebService</span></h2>
<p>Below are few components you can use to read/write data using REST API for any web service.</p>
<div class="su-table">
<table>
<colgroup>
<col width="100" />
<col /></colgroup>
<tbody>
<tr class="su-even">
<td><img decoding="async" src="https://i1.wp.com/zappysys.com/images/ssis-powerpack/SSIS-Json-Source-Adapter.png?w=720&amp;ssl=1" alt="Custom SSIS Components - Json Source" width="72" /></td>
<td style="vertical-align: top;"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON Source</a> (Read from REST API, JSON File or OData Service): Use this dataflow component when you have to <strong>fetch data from REST API webservice like a table</strong>. This component allows you to extract JSON data from webservice and de-normalize nested structure so you can save to Relational database such as SQL Server or any other target (Oracle, FlatFile, Excel, MySQL). This component also supports reading local JSON files or direct JSON string (Wildcard pattern supported too e.g. c:\data\file*.json).</td>
</tr>
<tr>
<td><img decoding="async" src="https://i2.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination.png?w=720&amp;ssl=1" alt="SSIS Custom Target Adapter - Web API Destination" width="72" /></td>
<td style="vertical-align: top;"><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/">Web API Destination</a> (POST data to API URL) : Use this dataflow component when you have to load data into target system via API calls (<a href="https://zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">POST to URL</a>). E.g. Loading Contacts into Marketing System like <a href="https://zappysys.com/blog/get-data-from-mailchimp-in-ssis-using-rest-api-call/" target="_blank" rel="noopener">MailChimp</a> for email campaign. Loading documents into CRM or document storage systems e.g. Couchbase or <a href="https://zappysys.com/blog/call-elasticsearch-api-using-ssis/" target="_blank" rel="noopener">ElasticSearch</a>.</td>
</tr>
<tr class="su-even">
<td><img decoding="async" src="https://i0.wp.com/zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png?w=720&amp;ssl=1" alt="Custom SSIS Tasks - SSIS Rest Api Web Service Task" width="72" /></td>
<td style="vertical-align: top;"><a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">REST API Task</a> : Use this task when you don’t want to pull REST API data in tabular format but want to call rest API for POST data to server, DELETE data from server or things like download HTML page, extract Authentication tokens etc where you not necessarily dealing data in tabular format. This task also allows you many other options such as saving RAW response into variable or file.</td>
</tr>
<tr>
<td><img decoding="async" src="https://i2.wp.com/zappysys.com/images/ssis-powerpack/ssis-xml-source.png?w=720&amp;ssl=1" alt="Custom SSIS Components - XML Source (Read File/SOAP/REST Web Service)" width="72" /></td>
<td style="vertical-align: top;"><a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML Source</a> (SOAP, File, REST) : Use this dataflow component when you have to fetch data from XML or SOAP webservice and consume data like a table. This component allows you to extract data from webservice and save to SQL Server or any other target (Oracle, FlatFile, Excel, MySQL). This component also supports reading local XML files or direct XML string.</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<h2><span id="Using_SSIS_JSON_Source_to_read_from_REST_API_and_load_into_SQL_Server">Screenshot of Complete SSIS Package (Zuora to SQL Server)</span></h2>
<p>Here is screenshot of our full process (we going to outline in next sections)</p>
<div id="attachment_2521" style="width: 923px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-zuora-api-call-read-data-load-to-sql-use-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2521" class="size-full wp-image-2521" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-zuora-api-call-read-data-load-to-sql-use-pagination.png" alt="SSIS Zuora API Integration - Read/Write Data (Load Zuora Data to SQL Server Table)" width="913" height="713" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-zuora-api-call-read-data-load-to-sql-use-pagination.png 913w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-zuora-api-call-read-data-load-to-sql-use-pagination-300x234.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-zuora-api-call-read-data-load-to-sql-use-pagination-768x600.png 768w" sizes="(max-width: 913px) 100vw, 913px" /></a><p id="caption-attachment-2521" class="wp-caption-text">SSIS Zuora API Integration &#8211; Read/Write Data (Load Zuora Data to SQL Server Table)</p></div>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2><span id="Using_SSIS_JSON_Source_to_read_from_REST_API_and_load_into_SQL_Server">Step-By-Step : Using SSIS JSON Source / REST API Task to read Zuora API </span></h2>
<p>Zuora API is somewhat different than other APIs we <a href="https://zappysys.com/blog/category/api-integration/" target="_blank" rel="noopener">documented here</a> because Zuora API uses very different Pagination Technique. Some common pagination techniques listed <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">here</a> but it&#8217;s not used by Zuora API so we have to do few extra steps.</p>
<p>Let&#8217;s look at step by step.</p>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: Zuora API requires TLS 1.1 or Higher so make sure on all tasks / components / connection manager for zuora API is set to use <strong>TLS 1.1 or Higher</strong> (This setting is usually found on <strong>Advanced tab</strong> of OAuth Connection Manager / REST API Task / Web API Destination / JSON Source / XML Source. <a href="https://zappysys.zendesk.com/hc/en-us/articles/360000926174-How-to-enable-TLS-1-2-for-SSIS-2012-packages" target="_blank" rel="noopener">Click Here for more information</a>.</div></div>
<h3>Configure Zuora OAuth Connection</h3>
<p>The first step to connect to Zuora API is to configure  the OAuth App (Ask your Zuora Admin or Follow <a href="https://knowledgecenter.zuora.com/CF_Users_and_Administrators/A_Administrator_Settings/Manage_Users#Create_an_OAuth_Client_for_a_User" target="_blank" rel="noopener">Steps listed here</a>). Once you create Oauth App get ClientId and ClientSecret.</p>
<p>Now let&#8217;s create new SSIS</p>
<ol>
<li>Right click in the Connection Manager Panel &gt; Click New Connection&#8230;</li>
<li>Select ZS-OAUTH from the list</li>
<li>Configure OAuth Connection as below
<ol>
<li>Set OAuth Version <pre class="crayon-plain-tag">OAuth2</pre></li>
<li>Set OAuth Grant Type to <pre class="crayon-plain-tag">Client Credentials Grant</pre></li>
<li>Enter Client ID and Client Secret</li>
<li>For Token URL enter URL <pre class="crayon-plain-tag">https://rest.zuora.com/oauth/token</pre></li>
<li>Goto Advanced Tab. Select SSL/TLS Protocol <pre class="crayon-plain-tag">v3.0 or Higher</pre></li>
</ol>
</li>
<li>Click Test (Confirm Green Checkmark)</li>
<li>Click OK to Save</li>
</ol>
<div style="width: 869px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-oauth-connection-for-zuora-api.png"><img loading="lazy" decoding="async" class="size-full wp-image-2525" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-oauth-connection-for-zuora-api.png" alt="SSIS OAuth Connection For Zuora API" width="859" height="352" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-oauth-connection-for-zuora-api.png 859w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-oauth-connection-for-zuora-api-300x123.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-oauth-connection-for-zuora-api-768x315.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></a><p class="wp-caption-text">SSIS OAuth Connection For Zuora API</p></div>
<p>&nbsp;</p>
<h3>Configure Variables</h3>
<p>Now lets configure few SSIS variables.</p>
<div id="attachment_2526" style="width: 909px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-variables-for-zuora-api-integration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2526" class="size-full wp-image-2526" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-variables-for-zuora-api-integration.png" alt="SSIS Variables for Zuora API Integration" width="899" height="241" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-variables-for-zuora-api-integration.png 899w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-variables-for-zuora-api-integration-300x80.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-variables-for-zuora-api-integration-768x206.png 768w" sizes="(max-width: 899px) 100vw, 899px" /></a><p id="caption-attachment-2526" class="wp-caption-text">SSIS Variables for Zuora API Integration</p></div>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr>
<th>Name</th>
<th>Value</th>
<th>Expression</th>
</tr>
<tr>
<td>url  (String) <strong>Expression</strong></td>
<td>&#8212; blank &#8212;</td>
<td>
<pre class="crayon-plain-tag">@counter &gt; 0 
   ? "https://rest.zuora.com/v1/action/queryMore" 
   : "https://rest.zuora.com/v1/action/query"</pre>
</td>
</tr>
<tr>
<td>bodyString  (String)</td>
<td>
<pre class="crayon-plain-tag">{"queryString": "SELECT Id,Name,AccountNumber,Status FROM Account"}</pre>
&nbsp;</td>
<td></td>
</tr>
<tr>
<td>continue (Boolean)</td>
<td>True</td>
<td></td>
</tr>
<tr>
<td>doneFlag (Boolean)</td>
<td>False</td>
<td></td>
</tr>
<tr>
<td>queryLocator (String)</td>
<td>&#8212; blank &#8212;</td>
<td></td>
</tr>
<tr>
<td>responseFile (String)</td>
<td>c:\ssis\dump.json</td>
<td></td>
</tr>
<tr>
<td>counter (Int32)</td>
<td>0</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<h3>Configure API Pagination</h3>
<p>Now let&#8217;s configure For Loop such a way that it keeps looping until @continue flag is True</p>
<ol>
<li>Drag For Loop Task from SSIS Toolbox</li>
<li>Configure as below
<ol>
<li>Enter EvalExpression as <pre class="crayon-plain-tag">@continue==true</pre></li>
<li>Enter AssignExpression as <pre class="crayon-plain-tag">@counter=@counter+1</pre></li>
</ol>
</li>
</ol>
<div id="attachment_2527" style="width: 715px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-for-loop-task-api-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2527" class="size-full wp-image-2527" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-for-loop-task-api-pagination.png" alt="Configure API Pagination using For Loop Task" width="705" height="318" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-for-loop-task-api-pagination.png 705w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-for-loop-task-api-pagination-300x135.png 300w" sizes="(max-width: 705px) 100vw, 705px" /></a><p id="caption-attachment-2527" class="wp-caption-text">Configure API Pagination using For Loop Task</p></div>
<h3>Configure API Call using SSIS REST API Task</h3>
<p>Now let&#8217;s configure REST API Task to make a call to get data from Zuora API and save JSON response into File (which we will parse in next step)</p>
<p>So if we making the first request will call API via <pre class="crayon-plain-tag">https://rest.zuora.com/v1/action/query</pre>   and any call after that (2nd response or Higher) we will call <pre class="crayon-plain-tag">https://rest.zuora.com/v1/action/queryMore</pre> . This API uses SQL like query language ZOQL. <a href="https://knowledgecenter.zuora.com/DC_Developers/K_Zuora_Object_Query_Language" target="_blank" rel="noopener">Click here to learn more about ZOQL</a></p>
<p>This is controlled by Expression we defined in URL variable.</p>
<div id="attachment_2528" style="width: 819px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2528" class="wp-image-2528 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api.png" alt="Configure SSIS REST API Task - Call Zuora Query API (ZOQL - SQL Query)" width="809" height="422" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api.png 809w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api-300x156.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api-768x401.png 768w" sizes="(max-width: 809px) 100vw, 809px" /></a><p id="caption-attachment-2528" class="wp-caption-text">Configure SSIS REST API Task &#8211; Call Zuora Query API (ZOQL &#8211; SQL Query)</p></div>
<div id="attachment_2529" style="width: 803px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api-save-to-json-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2529" class="size-full wp-image-2529" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api-save-to-json-file.png" alt="Configure SSIS REST API Response Settings - Save Zuora Query to JSON File" width="793" height="319" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api-save-to-json-file.png 793w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api-save-to-json-file-300x121.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-configure-rest-api-task-call-zuora-query-api-save-to-json-file-768x309.png 768w" sizes="(max-width: 793px) 100vw, 793px" /></a><p id="caption-attachment-2529" class="wp-caption-text">Configure SSIS REST API Response Settings &#8211; Save Zuora Query to JSON File</p></div>
<h3>Configure Data Flow (Read Zuora Data and Load into SQL Server Table)</h3>
<p>We will skip this configuration on how to read JSON file and Save to SQL Server. Because it will be covered in next section.</p>
<p>Inside Data Flow when you configure ZS JSON Source</p>
<p>Make sure to set Filter to $.records[*]
<h3>Parse Pagination Attributes (done flag, queryLocator for next page)</h3>
<p>Once that done you can parse the response from saved File. We need to check for 2 attributes (done and queryLocator ). Parse JSON as below.</p>
<div id="attachment_2530" style="width: 735px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-parse-multiple-fields-from-json-save-variable.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2530" class="size-full wp-image-2530" src="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-parse-multiple-fields-from-json-save-variable.png" alt="SSIS JSON Parser Task - Parse Multiple Fields from JSON FIle and Save to Variable" width="725" height="520" srcset="https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-parse-multiple-fields-from-json-save-variable.png 725w, https://zappysys.com/blog/wp-content/uploads/2018/01/ssis-parse-multiple-fields-from-json-save-variable-300x215.png 300w" sizes="(max-width: 725px) 100vw, 725px" /></a><p id="caption-attachment-2530" class="wp-caption-text">SSIS JSON Parser Task &#8211;<br />Parse Multiple Fields from JSON FIle and Save to Variable</p></div>
<h3>Detect Last Page (Set Variables)</h3>
<p>Drag two Set Expression Tasks from SSIS Toolbox.</p>
<p>For First Task [Set Continue Flag] Enter Expression as <pre class="crayon-plain-tag">@continue=!@doneFlag</pre>
<p>For First Task [Set Query Locator ] Enter Expression as <pre class="crayon-plain-tag">@[User::bodyString]="{ \"queryLocator\" : \"" + @[User::queryLocator] + "\" }"</pre>
<h3>Save and execute Package</h3>
<p>That&#8217;s all now you can save package and execute. Check Progress.</p>
<div class="content_block" id="custom_post_widget-2516"><h2><span id="Debug_Web_API_call_using_Fiddler">Debug Web API call using Fiddler</span></h2>
To test how things looking behind the scene we strongly suggest to use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">tool like  fiddler</a>.

You can double click the URL entry (Right side) to see Request and Response Panels. Top panel is Request (URL, Headers, Body) and Bottom Panel is Response.
<div id="attachment_2344" class="wp-caption alignnone">

<a href="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?ssl=1"><img loading="lazy" decoding="async" class="size-full wp-image-2344" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?resize=720%2C316&amp;ssl=1" sizes="(max-width: 720px) 100vw, 720px" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?w=1287&amp;ssl=1 1287w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?resize=300%2C131&amp;ssl=1 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?resize=768%2C337&amp;ssl=1 768w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?resize=1024%2C449&amp;ssl=1 1024w" alt="Debugging Web API call using Fiddler in SSIS" width="702" height="308" data-attachment-id="2344" data-permalink="https://zappysys.com/blog/pass-authorization-header-redirected-location/ssis-rest-api-call-debug-via-fiddler/#main" data-orig-file="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=1287%2C564&amp;ssl=1" data-orig-size="1287,564" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-rest-api-call-debug-via-fiddler" data-image-description="&lt;p&gt;Debugging Web API call using Fiddler in SSIS&lt;/p&gt; " data-medium-file="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=300%2C131&amp;ssl=1" data-large-file="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=720%2C316&amp;ssl=1" /></a>
<p class="wp-caption-text">Debugging Web API call using Fiddler in SSIS</p>

</div>
<h2><span id="Loadingdata_fromREST_API_to_SQL_Server">Loading <span id="Loading_Graph_API_Office_365_data_to_SQL_Server">data from </span>REST API to SQL Server</span></h2>
Once you setup HTTP / OAUTH connection we can use <strong>JSON Source</strong> or <strong>XML Source</strong> to extract data from API and  load into SQL Server. If you are API is XML based API then use XML Source in below examples else use JSON Source.

For example purpose we will load data into SQL Server but you can load into any Target (e.g. Flat file, Oracle, Excel) using Microsoft or ZappySys Destination connectors

To load REST API data into SQL Server perform the following steps (<strong>Screenshots are generic</strong> and used for demonstration for purpose, <strong>your values can be different</strong> than below)
<ol>
 	<li>Go to SSIS Data Flow tab</li>
 	<li>Drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a> from the SSIS Toolbox (Use <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZS XML Source</a> if your API is XML based API)</li>
 	<li>Double click to edit Source</li>
 	<li>Set API URL you like to call, Check Use Credentials if you need to use HTTP or OAuth connection</li>
 	<li>Set Method / Body if its other than GET. For method other than GET make sure you select correct <strong>Content-Type</strong> from Dropdown (e.g. <strong>application/json</strong>). This indicate input data format in Body.</li>
 	<li>Set <strong>HTTP Headers</strong> if needed (in Most cases you won't need to set this)</li>
 	<li>Select Filter (many times this is not needed). If your API response has array node then select it here. For example if your response looks like this <strong>{ rows: [ {...}, {...}, {...} ] }</strong> then filter would be <strong>$.rows[*]</strong>. Select Array node you like to extract in the Filter selection UI.

<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1573" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png" alt="" width="675" height="363" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter-300x161.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a></li>
 	<li><a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">Configure Pagination</a> if needed on the pagination tab. Check your API documentation see it supports pagination.</li>
 	<li>Click OK to Save component settings and generate <a href="https://zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">desired metadata / columns for the output</a>.</li>
 	<li>Now drag <strong>OLEDB destination</strong> from the SSIS toolbox and drop on the Data Flow surface (technically you can use any valid Destination but for demo we will use OLEDB Destination)</li>
 	<li>Connect Source to Destination Component</li>
 	<li>On OLEDB destination select / create new SQL Connection and then Click "<strong>New Table</strong>"</li>
 	<li>Click on <strong>Mappings tab</strong> to map columns by names and click OK to save</li>
 	<li>Execute the Package</li>
</ol>
<div id="attachment_1617" class="wp-caption alignnone">

<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png"><img loading="lazy" decoding="async" class="size-full wp-image-1617" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?resize=720%2C546" sizes="(max-width: 720px) 100vw, 720px" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?w=782 782w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?resize=300%2C227 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?resize=768%2C582 768w" alt="Configure SSIS OLEDB Destination - Loading Xero Data into SQL Server Table" width="702" height="532" data-attachment-id="1617" data-permalink="https://zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/ssis-xero-to-sql-server-data-load/#main" data-orig-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?fit=782%2C593&amp;ssl=1" data-orig-size="782,593" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-xero-to-sql-server-data-load" data-image-description="&lt;p&gt;Configure SSIS OLEDB Destination – Loading Xero Data into SQL Server Table&lt;/p&gt; " data-medium-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?fit=300%2C227&amp;ssl=1" data-large-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-to-sql-server-data-load.png?fit=720%2C546&amp;ssl=1" /></a>
<p class="wp-caption-text">Configure SSIS OLEDB Destination – Loading REST API Data into SQL Server Table</p>

</div>
<div id="attachment_1618" class="wp-caption alignnone">

<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png"><img loading="lazy" decoding="async" class="size-full wp-image-1618" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?resize=720%2C533" sizes="(max-width: 720px) 100vw, 720px" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?w=734 734w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?resize=300%2C222 300w" alt="Xero to SQL Server Column Mappings for OLEDB Destination" width="702" height="519" data-attachment-id="1618" data-permalink="https://zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/ssis-xero-sql-server-load-mappings/#main" data-orig-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?fit=734%2C543&amp;ssl=1" data-orig-size="734,543" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-xero-sql-server-load-mappings" data-image-description="&lt;p&gt;Xero to SQL Server Column Mappings for OLEDB Destination&lt;/p&gt; " data-medium-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?fit=300%2C222&amp;ssl=1" data-large-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-xero-sql-server-load-mappings.png?fit=720%2C533&amp;ssl=1" /></a>
<p class="wp-caption-text">REST API to SQL Server Column Mappings for OLEDB Destination</p>

</div>
<div id="attachment_1619" class="wp-caption alignnone">

<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png"><img loading="lazy" decoding="async" class="size-full wp-image-1619" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?resize=283%2C391" sizes="(max-width: 283px) 100vw, 283px" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?w=283 283w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?resize=217%2C300 217w" alt="Loading Xero data to SQL Server in SSIS" width="275" height="380" data-attachment-id="1619" data-permalink="https://zappysys.com/blog/reading-loading-data-in-xero-sql-server-ssis/ssis-loading-data-from-xero-to-sql-server/#main" data-orig-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?fit=283%2C391&amp;ssl=1" data-orig-size="283,391" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-loading-data-from-xero-to-sql-server" data-image-description="&lt;p&gt;Loading Xero data to SQL Server in SSIS&lt;/p&gt; " data-medium-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?fit=217%2C300&amp;ssl=1" data-large-file="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-loading-data-from-xero-to-sql-server.png?fit=283%2C391&amp;ssl=1" /></a>
<p class="wp-caption-text">Loading REST API to SQL Server in SSIS</p>

</div>
<h2><span id="POST_Data_to_ServiceNow_API_Insert_Update_or_Delete">POST / Write Data to API (Insert, Update or Delete)</span></h2>
There will be a time you like to automate POST actions (e.g. create new incident via API call). <a href="https://zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">Check this article</a> to learn more on how to POST , DELETE, PUT data using API calls
<h2><span id="Common_Errors">Common Errors</span></h2>
There are many error can occur during runtime. Here are most common errors you may face at runtime.
<div id="custom_post_widget-1887" class="content_block">
<h3><span id="Truncation_related_error">Truncation related error</span></h3>
The most common error you may face when you run a SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions how to fix common metadata related errors read an article "<a href="https://zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".
<h3><span id="Authentication_related_error">Authentication related error</span></h3>
Another frequent error you may get is authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="https://zappysys.com/blog/loading-data-from-rest-api-to-sql-server-in-ssis/#Deployment_to_Production">Deployment to Production</a> below to see why it happens and how to solve this problem.

</div>
<h2><span id="Deployment_to_Production">Deployment to Production</span></h2>
<div id="custom_post_widget-1932" class="content_block">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords, when you run it from another machine using another Windows account. To circumvent this when you are creating a SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way you won’t face authentication related errors when package is deployed to a production server. Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</div></div>
<p>&nbsp;</p>
<h2>Download Sample SSIS Package (2012 or Higher Version)</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/01/ZuoraApiPagination.zip">Click here to download SSIS Sample Package &#8211; ZuoraApiPagination.dtsx</a></p>
<h2><span id="ConclusionWhat8217s_next">Conclusion. What’s next?</span></h2>
<p>In this article, we have learned how to load data from Zuora and load into SQL Server using SSIS ( drag and drop approach without coding). We used <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS JSON Source/REST API</a> to extract data from Zuora REST API using OAuth. JSON Source makes it super simple to parsing complex / large JSON Files or any Web API Response into rows and column so you can load into a database like SQL Server. <a href="https://zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try many other automation scenarios not discussed in this article.</p>
<p>The post <a href="https://zappysys.com/blog/how-to-import-export-data-zuora-api-using-ssis/">How to Import / Export data from Zuora 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>How to get data from MailChimp in SSIS with REST API</title>
		<link>https://zappysys.com/blog/get-data-from-mailchimp-in-ssis-using-rest-api-call/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 08 Jan 2016 14:42:45 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MailChimp]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=291</guid>

					<description><![CDATA[<p>Introduction In this article you will learn how to automate/integrate MailChimp API calls inside SSIS without any coding efforts. Historically anytime you want to access API or Automate workflow you have to use SDKs or write custom script which can be very time consuming and expensive effort. If you are looking for drag and drop [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-mailchimp-in-ssis-using-rest-api-call/">How to get data from MailChimp in SSIS with REST API</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:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff7b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: <strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/mailchimp-connector/ssis">API Connector for SSIS Mailchimp Connector</a> which makes it much simpler to <strong>Read / write MailChimp Campaigns, Lists, Members, Reports in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).</div></div>
<p><a href="//zappysys.com/blog/wp-content/uploads/2016/01/mailchimp-api-integration.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1630" src="//zappysys.com/blog/wp-content/uploads/2016/01/mailchimp-api-integration.png" alt="" width="180" height="180" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/mailchimp-api-integration.png 210w, https://zappysys.com/blog/wp-content/uploads/2016/01/mailchimp-api-integration-150x150.png 150w" sizes="(max-width: 180px) 100vw, 180px" /></a>In this article you will learn how to <strong>automate/integrate MailChimp API calls inside SSIS</strong> without any coding efforts. Historically anytime you want to access API or Automate workflow you have to use SDKs or write custom script which can be very time consuming and expensive effort. If you are looking for drag and drop approach rather than coding for your MailChimp API integration then this article is perfect for your need.</p>
<p>To call MailChimp REST API inside SSIS we you will need to download <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a>. Following SSIS task/components can help you to call any API and parse JSON response into table format (i.e. Rows and Columns) which you can write to any Destination later (i.e. Load MailChimp data into SQL Server or other way around).</p>
<div class="su-table su-table-alternate">
<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">JSON Source Connector (File, REST API)</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png" alt="Custom SSIS Tasks - Call REST API Webservice (GET, POST, DELETE etc)" width="32" /></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Webservice Task</a></td>
</tr>
</tbody>
</table>
</div>
<h2>Calling MailChimp API two different ways in SSIS</h2>
<p>MailChimp API offers two different ways to authenticate your API requests.</p>
<ol>
<li>Use OAuth 2.0 Authorization</li>
<li>Use Basic Authorization (Use API Key)</li>
</ol>
<h3>Method-1 : Use OAuth 2.0 Authentication &#8211; Call MailChimp API using SSIS REST API Task</h3>
<p>This section will show you how to call MailChimp API using OAuth 2.0 protocol. Simplest way to test our MailChimp API call is use <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Webservice Task</a>.</p>
<ol>
<li>Download and Install SSIS PowerPack (<a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><span style="color: #248cc8;">Click here to download</span></a>). It includes 40+ components which can help you with any JSON or API Integration scenario inside SSIS</li>
<li>Open / Create SSIS Project</li>
<li>Drag ZS REST API Task from SSIS Toolbox</li>
<li>Double click REST API Task to configure it</li>
<li>Set Url Access mode to [Url from Connection]</li>
<li>From connection dropdown select New OAuth Connection</li>
<li>Select Provider = MailChimp</li>
<li>Click Generate Token and once done Click Test and OK to save UI
<div id="attachment_907" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/01/ssis-oauth-provider-mailchimp-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-907" class="wp-image-907" src="//zappysys.com/blog/wp-content/uploads/2016/01/ssis-oauth-provider-mailchimp-api.png" alt="SSIS MailChimp OAuth Provider - OAuth connection manager" width="600" height="685" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-oauth-provider-mailchimp-api.png 683w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-oauth-provider-mailchimp-api-263x300.png 263w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-907" class="wp-caption-text">SSIS MailChimp OAuth Provider &#8211; OAuth connection manager</p></div></li>
<li>Once you are back to REST API Task enter following partial URL in URL box. Notice that we have not supplied full URL because depending on which region you are MailChimp may be using different URL for API access (e.g. https://us14.api.mailchimp.com/3.0/campaigns ). If you don&#8217;t specify full URL then OAuth connection manager automatically determines correct Data center for you and prepares correct URL at runtime.<br />
<pre class="crayon-plain-tag">/3.0/campaigns</pre>
</li>
<li>Click Test Request &#8211; Scroll to see Content (you should see JSON like below)
<div id="attachment_908" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/01/call-mailchimp-api-using-ssis-rest-api-task-oauth-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-908" class="wp-image-908" src="//zappysys.com/blog/wp-content/uploads/2016/01/call-mailchimp-api-using-ssis-rest-api-task-oauth-connection.png" alt="Call MailChimp API using SSIS REST API Task (OAuth 2.0 Connection Manager)" width="600" height="542" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/call-mailchimp-api-using-ssis-rest-api-task-oauth-connection.png 796w, https://zappysys.com/blog/wp-content/uploads/2016/01/call-mailchimp-api-using-ssis-rest-api-task-oauth-connection-300x271.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-908" class="wp-caption-text">Call MailChimp API using SSIS REST API Task (Use OAuth 2.0 Connection Manager)</p></div></li>
</ol>
<h3>Method-2 : Use Basic Authentication &#8211; Call MailChimp API using SSIS REST API Task</h3>
<p>Simplest way to test our MailChimp API call is use <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Webservice Task</a>.</p>
<ol>
<li>Download and Install SSIS PowerPack (<a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><span style="color: #248cc8;">Click here to download</span></a>). It includes 40+ components which can help you with any JSON or API Integration scenario inside SSIS</li>
<li>Open / Create SSIS Project</li>
<li>Drag ZS REST API Task from SSIS Toolbox</li>
<li>Double click REST API Task to configure it</li>
<li>Set Url Access mode to [Url from Connection]</li>
<li>From connection dropdown select New HTTP Connection</li>
<li>Enter any valid URL e.g. https://us14.api.mailchimp.com/3.0/campaigns (If you are not sure what is your DC then try to call https://login.mailchimp.com/oauth2/metadata URL first and get response via REST API Task &#8211; Test to see api_endpoint URL)<br />
<pre class="crayon-plain-tag">https://us14.api.mailchimp.com/3.0/campaigns</pre>
</li>
<li>Click use credentials. Click Use userid/password option</li>
<li>Enter any fake userid (this is ignored) and Valid API Key in Password field. If you are not sure how to get Mailchimp API Key then <a href="http://kb.mailchimp.com/integrations/api-integrations/about-api-keys" target="_blank" rel="noopener">check this article</a></li>
<li>Click OK to save HTTP connection</li>
<li>Click Test Request &#8211; Scroll to see Content (you should see JSON like below)</li>
</ol>
<h2>Get data from MailChimp API and load into SQL Server</h2>
<p>In previous section we saw how to use REST API Task to call any MailChimp API. It can do POST / PUT / DELETE try of requests. Another scenario could be read data from MailChimp and load into SQL Server (i.e. your local Data warehouse). For this purpose you can use JSON Source. It can parse JSON response into Rows and columns. Also it supports pagination so you can loop through response.</p>
<ol>
<li>Download and Install SSIS PowerPack (<a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><span style="color: #248cc8;">Click here to download</span></a>). It includes 40+ components which can help you with any JSON or API Integration scenario inside SSIS</li>
<li>Open / Create SSIS Project</li>
<li>Drag and drop Data flow task in SSIS designer from SSIS Toolbox
<div id="attachment_8028" style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8028" class="size-full wp-image-8028" src="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" alt="" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /><p id="caption-attachment-8028" class="wp-caption-text">Dragging and dropping Data Flow Task into Control Flow</p></div></li>
<li>Double click Data flow to open Data flow designer</li>
<li>From SSIS toolbox find ZS JSON Source and drag on the surface</li>
<li>Double click to configure JSON source</li>
<li>Set Access mode to [Path or URL from Connection]</li>
<li>Before entering URL check option [Use credentials] and Select existing OAuth connection manager created in Previous section (i.e. Method-1 : Use OAuth)</li>
<li>Now we have to enter API URL. First determine endpoint assigned to your account. For that enter https://login.mailchimp.com/oauth2/metadata and click preview. Copy url from api_endpoint column found on the preview window. Once copied click OK to close</li>
<li>Now Use API endpoint URL (copied from previous step) and append version number (i.e. /3.0) and API (i.e. /campaigns) you like to call. Your final URL may be something like below. Our DC was us14 yours can be different.<br />
<pre class="crayon-plain-tag">https://us14.api.mailchimp.com/3.0/campaigns</pre>
</li>
<li>Once you enter correct API URL click on Select Filter button to select correct hierarchy you want to extract. If API response contains records inside JSON array then select that as your filter. For example if you getting list of all campaigns then your Filter may be like $.campaigns[*]</li>
<li>Once filter is specified, click Preview.</li>
<li>Click on columns tab to review columns and metadata. You can change default length or datatype. If you change default metadata then make sure to check Lock option (last column &#8211; right side) so it stays there when metadata refresh occurs</li>
<li>Click OK to save UI</li>
<li>Now you can connect your JSON source to any destination such as SQL Server (Use OLEDB or ADO.net Destination component)</li>
<li>Execute SSIS Package to see data in destination</li>
</ol>
<div id="attachment_909" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/01/load-mailchimp-data-into-sql-server-oauth-json-rest-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-909" class="wp-image-909" src="//zappysys.com/blog/wp-content/uploads/2016/01/load-mailchimp-data-into-sql-server-oauth-json-rest-api-call.png" alt="Load MailChimp data into SQL Server - Use SSIS JSON Source to call REST API" width="600" height="447" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/load-mailchimp-data-into-sql-server-oauth-json-rest-api-call.png 971w, https://zappysys.com/blog/wp-content/uploads/2016/01/load-mailchimp-data-into-sql-server-oauth-json-rest-api-call-300x223.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-909" class="wp-caption-text">Load MailChimp data into SQL Server &#8211; Use SSIS JSON Source to call REST API</p></div>
<h2>MailChimp REST API Pagination</h2>
<p>If you have many records then most likely your response will be partial. To fetch all records from MailChimp you have to use Pagination technique. <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/#Method-1_REST_APIPaginationvia_URL_Parameter" target="_blank" rel="noopener">Read this article for more information</a></p>
<p>Page number is indicated by offset query string parameter in URL as below. 0 mean first page. When pagination method is used on JSON source it will automatically increment offset and fetch data from next URL until no more records found for selected expression in JSON (e.g. $.campaigns[*] )</p>
<div id="attachment_912" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/01/mailchimp-api-pagination-using-ssis-json-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-912" class="wp-image-912" src="//zappysys.com/blog/wp-content/uploads/2016/01/mailchimp-api-pagination-using-ssis-json-source.png" alt="MailChimp API Pagination using SSIS JSON Source" width="600" height="464" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/mailchimp-api-pagination-using-ssis-json-source.png 903w, https://zappysys.com/blog/wp-content/uploads/2016/01/mailchimp-api-pagination-using-ssis-json-source-300x232.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-912" class="wp-caption-text">MailChimp API Pagination using SSIS JSON Source</p></div>
<h2>Conclusion</h2>
<p>As you saw how easy it is to consume MailChimp API using SSIS without any coding. <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> is one of the finest toolset for virtually any API or JSON integration project. Click here to <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Try SSIS PowerPack for FREE</a>.</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-mailchimp-in-ssis-using-rest-api-call/">How to get data from MailChimp in SSIS with REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read Zendesk data in SSIS with REST API</title>
		<link>https://zappysys.com/blog/read-zendesk-data-in-ssis-call-rest-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 27 Oct 2015 20:18:41 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[api pagination]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[zendesk]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=132</guid>

					<description><![CDATA[<p>Introduction Zendesk is one of the most popular customer service platforms available today. Zendesk offers a REST API to interact with its cloud-based service programmatically (to manage or read data). The problem is that not everyone is a programmer, and not everyone has time to learn how to write C# or JAVA code to access a [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-zendesk-data-in-ssis-call-rest-api/">How to read Zendesk data in SSIS with REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a target="_blank" rel="noopener">Zendesk Online connector,</a> which makes it much simpler to <strong>read/write Zendesk Data in SSIS</strong> compared to the steps listed in this article. You can still use the steps from this article, but if you are new to APIs or want to avoid the learning curve, use a newer approach.</p>
</div></div>
<p><a href="//zappysys.com/blog/wp-content/uploads/2015/10/zendesk-api-integration.png"><img loading="lazy" decoding="async" class=" wp-image-1628 alignleft" src="//zappysys.com/blog/wp-content/uploads/2015/10/zendesk-api-integration.png" alt="" width="126" height="126" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/zendesk-api-integration.png 200w, https://zappysys.com/blog/wp-content/uploads/2015/10/zendesk-api-integration-150x150.png 150w" sizes="(max-width: 126px) 100vw, 126px" /></a><a href="http://zendesk.com">Zendesk</a> is one of the most popular customer service platforms available today. <span style="box-sizing: border-box; margin: 0px; padding: 0px;"><a href="https://developer.zendesk.com/rest_api/docs/support/introduction" target="_blank" rel="noopener">Zendesk offers a REST API</a> to interact with its cloud-based service programmatically (to manage or read data).</span> The problem is that not everyone is a programmer, and not everyone has time to learn how to write C# or JAVA code to access a REST API.</p>
<p>In this article, you will learn how to get Zendesk data using the <a target="_blank" rel="noopener">SSIS JSON Source (REST API Connector).</a> This connector allows you to read Zendesk data in SSIS using REST API Calls without any scripting/programming. <span style="box-sizing: border-box; margin: 0px; padding: 0px;">Techniques mentioned in this article can also be used to consume data from other services (e.g., <a target="_blank" rel="noopener">read data from Twitter</a>).</span> In this article, you will see step-by-step instructions to read Zendesk ticket information and load it into on-premises SQL Server.</p>
<p>Also, check our other article <span style="box-sizing: border-box; margin: 0px; padding: 0px;">on <a target="_blank" rel="noopener">how</a></span><a href="//zappysys.com/blog/call-zendesk-rest-api-ssis-create-new-ticket/" target="_blank" rel="noopener"> to call the Zendesk REST API to create a new ticket</a>.</p>
<h2>Different methods for Zendesk REST API Access</h2>
<p>Zendesk allows you to access its data in three different ways.</p>
<ol>
<li>REST API access using OAuth Access Token</li>
<li>REST API access using API Token</li>
<li>REST API access using Basic Authentication (Use userid (e.g., email) and Password)</li>
</ol>
<p>Each method has pros and cons. The simplest method is the third, which is easy to use but requires passing your account password with each call. The second method is also easy to use but requires an additional step to create an access token. The first method is the most secure, but it has a few extra steps compared to the other methods.</p>
<h2><span id="Prerequisite">Prerequisite</span></h2>
<p>Before you can finish the tasks explained in this article, you have to finish the following steps. This article assumes you have basic knowledge of SSIS (SQL Server Integration Services)</p>
<ol>
<li>Make sure you have the SSIS designer installed. Sometimes it&#8217;s referred to as BIDS or SSDT (<a href="https://msdn.microsoft.com/en-us/mt186501" target="_blank" rel="noopener">Get from here)</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Download SSIS PowerPack</a> (FREE Trial &#8211; 30 days).</li>
<li>Optional – Another very useful Free tool is Fiddler. You can use it to see raw request/response (<a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Check this article</a>)</li>
</ol>
<h2>Method-1: Zendesk API Access using OAuth in SSIS</h2>
<p>To read about the OAuth Method, <a href="https://zappysys.com/blog/configure-zendesk-oauth-application-for-rest-api-call/" target="_blank" rel="noopener">click here</a></p>
<h2>Method-2: Zendesk API Access using Token in SSIS</h2>
<p>Now let&#8217;s look at the second method for accessing Zendesk data using SSIS.</p>
<h3>Create Token in Zendesk Portal for REST API Access</h3>
<ol>
<li>Log in to your account https://{{your-subdomain}}.zendesk.com/login and then click on the settings icon</li>
<li>On the next page, click on the API link</li>
<li>On the API page, scroll to the API Access Tokens section. Make sure the <strong>Token Access</strong> method is checked.</li>
<li>Click on the &#8221; add new token hyperlink. Once prompted, give a name to the Token token (this is just a label)</li>
<li>Once the above steps are done, a token should be created and listed under your API Access page. The token will be used as your Password to access the REST API (will be shown in the next section). For more information, check this link &gt;&gt;&gt;  <a href="https://support.zendesk.com/hc/en-us/articles/226022787-Generating-a-new-API-token-" target="_blank" rel="noopener">How to generate a token for ZenDesk API Call</a>.
<div id="attachment_11852" style="width: 993px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/Create-new-Zendesk-REST-API-Access-Token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11852" class="size-full wp-image-11852" src="https://zappysys.com/blog/wp-content/uploads/2015/10/Create-new-Zendesk-REST-API-Access-Token.png" alt="" width="983" height="701" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/Create-new-Zendesk-REST-API-Access-Token.png 983w, https://zappysys.com/blog/wp-content/uploads/2015/10/Create-new-Zendesk-REST-API-Access-Token-300x214.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/Create-new-Zendesk-REST-API-Access-Token-768x548.png 768w" sizes="(max-width: 983px) 100vw, 983px" /></a><p id="caption-attachment-11852" class="wp-caption-text">Create a new Zendesk REST API Access Token</p></div></li>
</ol>
<h3>Configure SSIS HTTP Connection</h3>
<p>Perform the following steps to extract data from Zendesk and load it into SQL Server. The steps below assume that you are using the API Token method (#2 from the supported methods to call the Zendesk API). This is better than using Userid and Password.</p>
<ol>
<li>Open a new SSIS Project.</li>
<li>First of all, drag and drop the Data Flow Task from the SSIS Toolbox and double-click it to edit.
<div class="mceTemp"></div>
<div id="attachment_11784" style="width: 485px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11784" class="size-full wp-image-11784" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png" alt="" width="475" height="178" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png 475w, https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow-300x112.png 300w" sizes="(max-width: 475px) 100vw, 475px" /></a><p id="caption-attachment-11784" class="wp-caption-text">Drag and drop Data flow.w</p></div></li>
<li>From the SSIS toolbox, drag and drop the <a target="_blank" rel="noopener">ZS JSON Source</a> onto the data flow designer surface, then double-click it to edit.
<div id="attachment_11533" style="width: 553px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/09/ssis-json-source-adapter-drag.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11533" class="size-full wp-image-11533" src="https://zappysys.com/blog/wp-content/uploads/2015/09/ssis-json-source-adapter-drag.png" alt="" width="543" height="146" srcset="https://zappysys.com/blog/wp-content/uploads/2015/09/ssis-json-source-adapter-drag.png 543w, https://zappysys.com/blog/wp-content/uploads/2015/09/ssis-json-source-adapter-drag-300x81.png 300w" sizes="(max-width: 543px) 100vw, 543px" /></a><p id="caption-attachment-11533" class="wp-caption-text">SSIS JSON Source &#8211; Drag and Drop</p></div>
<div class="mceTemp"></div>
</li>
<li>From the AccessMode dropdown [<strong>Url From Connection</strong>]</li>
<li>Assume you want to extract all tickets from Zendesk, then enter the following URL (in the screenshot, we appended?page=1, which is optional)<br />
<pre class="crayon-plain-tag">https://YOUR_SUB_DOMAIN.zendesk.com/api/v2/tickets.json</pre>
</li>
<li>Check the <strong>Use Credentials</strong> option and select New ZS-HTTP connection. When prompted<br />
For Credential Type: select <strong>Basic Authentication</strong>  (Use of UserID and Token ).<br />
For Web URL: Enter any URL (This will be ignored anyway because the URL entered on the JSON Source UI will be used)<br />
For user name : enter <strong>YOUR_EMAIL/token  (e.g. bob@mycompany.com/token)<br />
</strong>For Password: enteToken token obtained from the Admin console &gt; API section. For more information, check this link &gt;&gt;&gt;  <a href="https://support.zendesk.com/hc/en-us/articles/226022787-Generating-a-new-API-token-" target="_blank" rel="noopener">How to generate a token for ZenDesk API Call</a>.<br />
<div class="su-note"  style="border-color:#e5e5c6;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: Appending /token command in Userid will allow us to pass the token rather than the Password of that account. This approach is more secure because you can disable the Token at any time without deactivating the user account. If you want to access data using your userid and Password rather than a token, then do not use <strong>/token</strong> after your email. By default, uToken Token and the use of Password are not allowed unless you enable these methods from the Admin console (See above section)</div></div>
<div class="mceTemp"></div>
<div id="attachment_11844" style="width: 838px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/Configure-SSIS-HTTP-Connection-Use-Zendesk-Token-to-Call-REST-API.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11844" class="size-full wp-image-11844" src="https://zappysys.com/blog/wp-content/uploads/2015/10/Configure-SSIS-HTTP-Connection-Use-Zendesk-Token-to-Call-REST-API.png" alt="" width="828" height="745" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/Configure-SSIS-HTTP-Connection-Use-Zendesk-Token-to-Call-REST-API.png 828w, https://zappysys.com/blog/wp-content/uploads/2015/10/Configure-SSIS-HTTP-Connection-Use-Zendesk-Token-to-Call-REST-API-300x270.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/Configure-SSIS-HTTP-Connection-Use-Zendesk-Token-to-Call-REST-API-768x691.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-11844" class="wp-caption-text">Configure SSIS HTTP Connection &#8211; Use Zendesk Token to Call REST API</p></div></li>
</ol>
<h3>Adding Retry Settings for HTTP or OAuth connection</h3>
<p>Zendesk enforces an API rate limit, which means you cannot issue too many API calls within a given time frame. <a href="https://developer.zendesk.com/rest_api/docs/support/introduction#rate-limits" target="_blank" rel="noopener">Check this document</a> for exact information.</p>
<p>ZappySys provides API retry settings on both the OAuth Connection and the HTTP Connection. For Zendesk, you can retry on a specific status code <strong>429</strong></p>
<ol>
<li>Open connection manager UI</li>
<li>Go to the Retry-Settings page</li>
<li>Select <strong>Retry web error on matching response status code</strong>.</li>
<li>Enter <strong>429</strong> for the status code</li>
<li>Check <strong>multiple wait times</strong></li>
<li>In the wait time, enter <strong>5000</strong> (wait 5 seconds or multiple of 5 seconds)</li>
<li>Set the max retry count to <strong>6. </strong>See the example (It&#8217;s not for Zendesk, but will give you an idea)
<div id="attachment_11847" style="width: 667px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/OAuth-connection-Retry-Options.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11847" class="size-full wp-image-11847" src="https://zappysys.com/blog/wp-content/uploads/2015/10/OAuth-connection-Retry-Options.png" alt="" width="657" height="604" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/OAuth-connection-Retry-Options.png 657w, https://zappysys.com/blog/wp-content/uploads/2015/10/OAuth-connection-Retry-Options-300x276.png 300w" sizes="(max-width: 657px) 100vw, 657px" /></a><p id="caption-attachment-11847" class="wp-caption-text">OAuth connection &#8211; Retry Options</p></div></li>
</ol>
<h3>Configure Zendesk API Pagination and Filter for SSIS JSON Source</h3>
<ol>
<li>Now click [Select Filter], select the tickets node (see the array icon), and click OK. It will generate the following Filter Expression to extract all records found under the tickets array node (e.g., tickets : [ {&#8230;} , {&#8230;} &#8230; ] )<br />
<pre class="crayon-plain-tag">$.tickets[*]</pre>
<div class="mceTemp"></div>
<div id="attachment_11853" style="width: 838px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/Select-Filter-Extract-Data-from-Zendesk-API-Response-Read-Ticket.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11853" class="size-full wp-image-11853" src="https://zappysys.com/blog/wp-content/uploads/2015/10/Select-Filter-Extract-Data-from-Zendesk-API-Response-Read-Ticket.png" alt="" width="828" height="745" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/Select-Filter-Extract-Data-from-Zendesk-API-Response-Read-Ticket.png 828w, https://zappysys.com/blog/wp-content/uploads/2015/10/Select-Filter-Extract-Data-from-Zendesk-API-Response-Read-Ticket-300x270.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/Select-Filter-Extract-Data-from-Zendesk-API-Response-Read-Ticket-768x691.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-11853" class="wp-caption-text">Select Filter &#8211; Extract Data from Zendesk API Response (Read Ticket)</p></div></li>
<li>N, let&#8217;sts configure pagination. By default, Zendesk API doesn&#8217;t return all records, so you have to specify pagination as below. Click on the <strong>Pagination</strong> Tab. Enter <em>$.next_page</em> for Next URL attribute as below (you can also Browse Path)
<div id="attachment_11854" style="width: 841px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Zendesk-Pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11854" class="size-full wp-image-11854" src="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Zendesk-Pagination.png" alt="" width="831" height="747" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Zendesk-Pagination.png 831w, https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Zendesk-Pagination-300x270.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Zendesk-Pagination-768x690.png 768w" sizes="(max-width: 831px) 100vw, 831px" /></a><p id="caption-attachment-11854" class="wp-caption-text">SSIS JSON Source Zendesk Pagination</p></div></li>
<li>Now time to click <strong>Preview. </strong>If you followed everything correctly, then when you click the <strong>Preview</strong> Button, you should see some data in the preview (assuming you have at least one ticket).
<div class="mceTemp"></div>
<div id="attachment_11850" style="width: 840px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Data-Preview-Zendesk-REST-API-Call-to-extract-tickets.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11850" class="size-full wp-image-11850" src="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Data-Preview-Zendesk-REST-API-Call-to-extract-tickets.png" alt="" width="830" height="747" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Data-Preview-Zendesk-REST-API-Call-to-extract-tickets.png 830w, https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Data-Preview-Zendesk-REST-API-Call-to-extract-tickets-300x270.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-JSON-Source-Data-Preview-Zendesk-REST-API-Call-to-extract-tickets-768x691.png 768w" sizes="(max-width: 830px) 100vw, 830px" /></a><p id="caption-attachment-11850" class="wp-caption-text">SSIS JSON Source &#8211; Data Preview &#8211; Zendesk REST API Call to extract tickets</p></div></li>
<li>Now click the <strong>Columns tab</strong> to review data types (you can change the default length and check the Lock option on the right side). This change is needed because the datatype guess happens based on the design-time setting (only 300 rows scanned by default). At runtime, if you get a truncation-related error, then copy the error message into Notepad to get the exact steps and column name that caused the error. If you need a length greater than 4000 chars, use the DT_NTEXT data type instead (change the datatype and click the column name cell on the right to save the change).</li>
<li>Click <strong>OK</strong> to save UI</li>
</ol>
<h3>How to extract Zendesk data using Incremental API</h3>
<p>There will be a time when you need to extract data incrementally (i.e., Extract only the changed data since the last load). Zendesk API supports many <a href="https://developer.zendesk.com/rest_api/docs/support/incremental_export" target="_blank" rel="noopener">Incremental API endpoints</a>. If you are using this endpoint, you have to make sure of a few things.</p>
<ul>
<li>For the OAuth connection method, make sure the <pre class="crayon-plain-tag">read</pre>  scope is included ( <pre class="crayon-plain-tag">tickets:read</pre>  won&#8217;t work, so just use <pre class="crayon-plain-tag">read</pre> )</li>
<li>Your URL must include /incremental path before the API type, and you must include start_time for the extract in <a href="https://www.epochconverter.com/" target="_blank" rel="noopener">Unix Epoch Format</a>.  The following example will pull records modified after<br />
<pre class="crayon-plain-tag">https://zappysys.zendesk.com/api/v2/incremental/tickets.json?start_time=1514764800</pre>
</li>
<li>On the pagination tab, you have to configure the following settings
<ul>
<li>Set Next Link as <pre class="crayon-plain-tag">$.next_link</pre></li>
<li>Set the Stop Indicator attribute as <pre class="crayon-plain-tag">$.count</pre></li>
<li>Set the Stop Indicator Value as <pre class="crayon-plain-tag">regex=^\d{1,3}$</pre>  Notice that using <strong>regex=</strong> prefix treats your end indicator value as a pattern check.<strong>&#8212;OR&#8212;</strong></li>
<li>Set the Stop Indicator attribute as <pre class="crayon-plain-tag">$.end_of_stream</pre>   and the Stop indicator value as <pre class="crayon-plain-tag"><span class="lang:default decode:true crayon-inline ">true</pre></span>
<div id="attachment_11848" style="width: 838px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/Pagination-for-Zendesk-Incremental-API-Next-Link-and-Last-Page-detection-using-Stop-Indicator-Regular-Expression.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11848" class="size-full wp-image-11848" src="https://zappysys.com/blog/wp-content/uploads/2015/10/Pagination-for-Zendesk-Incremental-API-Next-Link-and-Last-Page-detection-using-Stop-Indicator-Regular-Expression.png" alt="" width="828" height="745" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/Pagination-for-Zendesk-Incremental-API-Next-Link-and-Last-Page-detection-using-Stop-Indicator-Regular-Expression.png 828w, https://zappysys.com/blog/wp-content/uploads/2015/10/Pagination-for-Zendesk-Incremental-API-Next-Link-and-Last-Page-detection-using-Stop-Indicator-Regular-Expression-300x270.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/Pagination-for-Zendesk-Incremental-API-Next-Link-and-Last-Page-detection-using-Stop-Indicator-Regular-Expression-768x691.png 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><p id="caption-attachment-11848" class="wp-caption-text">Pagination for Zendesk Incremental API &#8211; Next Link and Last Page detection using Stop Indicator Regular Expression</p></div></li>
</ul>
</li>
</ul>
<p>Here is a simple SQL query to convert date/time to Unix time</p><pre class="crayon-plain-tag">select DATEDIFF(SECOND,'1970-01-01', GETUTCDATE() )

select DATEDIFF(SECOND,'1970-01-01', LastExtractDate ) as LastExtractDateAsUnix From dbo.ExtractStatus Where ExtractName='ZendeskExtract'</pre><p>
For C# code in the SSIS Script Task, you can use something like the following:</p><pre class="crayon-plain-tag">Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;</pre><p>
Assuming you extracted Date/Time from the database and saved it to some SSIS Variable called User::varLastExtract. Now we like to convert that to Unix format using C#.</p>
<p>We assume you have created the following variables in the SSIS Package. Also, you have set varLastExtract to a date/time value you want to convert.</p><pre class="crayon-plain-tag">User::varLastExtractTimeUnix  (Int32)
User::varLastExtractTime (DateTime)</pre><p>
Use the steps below. to convert date time to Unix format in C#</p>
<ol>
<li>Drag and drop Script Task in SSIS designer</li>
<li>Add both variable names in Read/Write Variable List (e.g., User::varLastExtractTimeUnix, User::varLastTimeExtract ).</li>
<li>Edit Script</li>
<li>Enter something like below<br />
<pre class="crayon-plain-tag">DateTime dtUtc= Convert.ToDateTime( Dts.Variables["User::varLastExtractTime"].Value ).ToUniversalTime();
Dts.Variables["User::varLastExtractTimeUnix"].Value = (Int32)(dtUtc.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;</pre>
</li>
</ol>
<p>Now you can use this variable in your JSON Source URL to make things dynamic.</p><pre class="crayon-plain-tag">https://zappysys.zendesk.com/api/v2/incremental/tickets.json?start_time={{User::varLastExtractTimeUnix}}</pre><p>
<h3>Handling duplicate data during incremental load (DISTINCT)</h3>
<p>As per <a href="https://developer.zendesk.com/rest_api/docs/support/incremental_export#excluding-pagination-duplicates" target="_blank" rel="noopener">this Zendesk document,</a> they may include the last row of the previous page on the next page if the update timestamp. It is possible to have duplicate rows in your staging table. <span style="box-sizing: border-box; margin: 0px; padding: 0px;">You can easily avoid this by using the <strong>DISTINCT</strong> keyword or another SQL query to remove duplicates.</span> Make sure not to include <strong>P_next_page</strong> and <strong>P_count,</strong> as they can differ when duplicate rows are detected at page boundaries.</p><pre class="crayon-plain-tag">SELECT DISTINCT 
--[P_next_page] --- Do NOT include this... 
[P_previous_page]
--,[P_count] --- Do NOT include this... 
,[url]
,[id]
,[external_id]
,[via.channel]
,[via.source.rel]

,[assignee_id]
......
......
......
,[allow_attachments]
FROM [dbo]._stgZendeskTickets</pre><p>
&nbsp;</p>
<h3>Loading data from Zendesk to SQL Server using SSIS</h3>
<ol>
<li>Now, drag a new OLE DB Destination into the Data Flow Designer. Connect the JSON source with the destination. Now double-click Destination. At the destination, select connection manager (or create one), then click [New] next to the Table name dropdown. You will see default metadata for the table based on upstream columns. Notice how P_previous_link is 40 chars rather than 140. This can be edited in the source metadata under the Columns tab, as described in the previous step, so that Table datatypes are set correctly. Once you change the table name and datatypes, click OK to create the new table. Click on the <strong>Mapping</strong> Tab to map source columns to target columns. Once that&#8217;s done, click OK to save.
<div id="attachment_11846" style="width: 763px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/Load-Zendesk-Data-into-SQL-Server-Using-SSIS-JSON-Connector-REST-API.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11846" class="size-full wp-image-11846" src="https://zappysys.com/blog/wp-content/uploads/2015/10/Load-Zendesk-Data-into-SQL-Server-Using-SSIS-JSON-Connector-REST-API.png" alt="" width="753" height="684" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/Load-Zendesk-Data-into-SQL-Server-Using-SSIS-JSON-Connector-REST-API.png 753w, https://zappysys.com/blog/wp-content/uploads/2015/10/Load-Zendesk-Data-into-SQL-Server-Using-SSIS-JSON-Connector-REST-API-300x273.png 300w" sizes="(max-width: 753px) 100vw, 753px" /></a><p id="caption-attachment-11846" class="wp-caption-text">Load Zendesk Data into SQL Server Using SSIS JSON Connector (REST API)</p></div></li>
<li>Now execute the package. If you have multiple pages in response, you will notice several requests in the log (e.g., &amp;page=1 &#8230; &amp;page=2 &#8230;).<br />
<div class="su-note"  style="border-color:#e5e5c6;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: In below screenshot we used per_page=2 for example purpose only. In reality, make it bigger, e.g., per_page=100 or per_page=200, so you don&#8217;t hit the server too often. If you&#8217;re not sure, then exclude the per_page parameter from the URL to use the default setting.</div></div>
<div id="attachment_11845" style="width: 1099px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/Execute-SSIS-Package-Extract-data-from-Zendesk-and-load-into-SQL-Server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11845" class="size-full wp-image-11845" src="https://zappysys.com/blog/wp-content/uploads/2015/10/Execute-SSIS-Package-Extract-data-from-Zendesk-and-load-into-SQL-Server.png" alt="" width="1089" height="416" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/Execute-SSIS-Package-Extract-data-from-Zendesk-and-load-into-SQL-Server.png 1089w, https://zappysys.com/blog/wp-content/uploads/2015/10/Execute-SSIS-Package-Extract-data-from-Zendesk-and-load-into-SQL-Server-300x115.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/Execute-SSIS-Package-Extract-data-from-Zendesk-and-load-into-SQL-Server-1024x391.png 1024w, https://zappysys.com/blog/wp-content/uploads/2015/10/Execute-SSIS-Package-Extract-data-from-Zendesk-and-load-into-SQL-Server-768x293.png 768w" sizes="(max-width: 1089px) 100vw, 1089px" /></a><p id="caption-attachment-11845" class="wp-caption-text">Execute SSIS Package &#8211; Extract data from Zendesk and load into SQL Server</p></div></li>
</ol>
<h2>Method-3: Zendesk API Access using Username and Password in SSIS (Basic Authentication)</h2>
<p>This method is the same as the second method outlined in the previous section. Except for a few changes. When you create an HTTP Connection, use your Username (without appenTokentoken ). For the Password, use your account password (the same one you use to log in to the Zendesk portal)</p>
<h2>Zendesk API Rate Limit (Throttling)</h2>
<p>Zendesk may limit how many calls you can make per second, so make sure to slow down if you get errors about api rate limit. You can slow down by entering Wait time on the Throttling tab of JSON Source (100 means wait 100 ms after each Request &#8230; only useful if pagination is enabled)</p>
<h2>Making things Dynamic (e.g., URL)</h2>
<p>You can use SSIS variables in your URL to make it dynamic. See below</p><pre class="crayon-plain-tag">https://mycompany.zendesk.com/api/v2/items/{{User::TicketNumber}}.json</pre><p>
<h2>Dealing with common errors</h2>
<p><span style="box-sizing: border-box; margin: 0px; padding: 0px;">For detailed instructions to fix common metadata-related errors, <a target="_blank" rel="noopener">read this article</a>.</span></p>
<div id="attachment_11851" style="width: 796px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-PowerPack-Column-Metadata-Editor-i.e.-Change-DataType-Column-Length.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11851" class="size-full wp-image-11851" src="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-PowerPack-Column-Metadata-Editor-i.e.-Change-DataType-Column-Length.png" alt="" width="786" height="471" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-PowerPack-Column-Metadata-Editor-i.e.-Change-DataType-Column-Length.png 786w, https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-PowerPack-Column-Metadata-Editor-i.e.-Change-DataType-Column-Length-300x180.png 300w, https://zappysys.com/blog/wp-content/uploads/2015/10/SSIS-PowerPack-Column-Metadata-Editor-i.e.-Change-DataType-Column-Length-768x460.png 768w" sizes="(max-width: 786px) 100vw, 786px" /></a><p id="caption-attachment-11851" class="wp-caption-text">SSIS PowerPack &#8211; Column Metadata Editor (i.e., Change DataType, Column Length)</p></div>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2>Deploy to production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<div class="content_block" id="custom_post_widget-2021"><h2>Things have gone bad: Error handling &amp; debugging</h2>
<p style="text-align: justify;">Incidentally, bad things can happen<i>. </i>A remote server may go offline or your server may go out of memory. In any case, you may want to know when that happens and take actions accordingly. For that purpose, you have to redirect bad rows to some other destination. For this example, we will take and use <em>Web API Destination</em>, but basically, you can use any SSIS component:</p>

<h3>Handling errors</h3>
<ol style="margin-left: 0;">
 	<li>Add a <em>Derived Column</em> above <em>Web API Destination</em> with expression <strong>"(DT_WSTR,4000)ZS_JSON_OUT"</strong> and name it <strong>"JsonAsString"</strong>. This will let you see what JSON you are actually passing.</li>
 	<li>Then add a database or file destination or use another <em>Trash Destination</em> for debugging purposes and redirect the bad rows (<span style="color: #d66565;">red arrow</span>) from <em><em>Web API Destination </em></em>into it<em><em>. </em></em>Don't forget to set <span class="lang:default decode:true crayon-inline">Redirect row</span> option for both, <em>Error</em> and <em>Truncation</em> columns:<em><em>
</em></em>
<div class="wp-caption">

<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1487 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" alt="Redirect bad rows from &lt;em&gt;Web API Destination&lt;/em&gt; to &lt;em&gt;Trash Destination&lt;/em&gt; when load from SQL Server to Elasticsearch is failing. Add derived column JsonAsString to be able to read JSON you are using." width="739" height="267" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png 739w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows-300x108.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></a>
<p class="wp-caption-text">Redirected failed requests from <em>Web API Destination</em> to a desired destination when loading from SQL Server to REST API Service is failing. Derived Column <em>JsonAsString</em> added to be able to read JSON which was passed to Elasticsearch</p>

</div></li>
 	<li>Finally, add a <a href="https://technet.microsoft.com/en-us/library/ms140318%28v=sql.90%29.aspx?f=255&amp;MSPPError=-2147217396" target="_blank" rel="noopener"><em>Data Viewer</em></a> for the red path, if you want to debug the flow. You will be able to see URL, JSON and the error message for each record. You may want to copy-paste <em>ErrorMessage</em> to <em>Notepad </em>if you want it to be more readable:
<div class="wp-caption">

<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1494 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" alt="Use Data Viewer to view HTTP requests that failed to be fulfilled in Elasticsearch" width="752" height="280" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png 752w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-300x112.png 300w" sizes="(max-width: 752px) 100vw, 752px" /></a>
<p class="wp-caption-text">Use Data Viewer to view HTTP requests that failed to be fulfilled.</p>

</div></li>
</ol>
<div class="su-note" style="border-color: #e5dea5; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;">
<div class="su-note-inner su-clearfix" style="background-color: #fff7b7; border-color: #fffdf1; color: #333333; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;"><strong>NOTE</strong>: You can read more about redirecting rows in <a href="//zappysys.com/blog/ssis-error-handling-in-data-flow-redirect-bad-rows/" target="_blank" rel="noopener">SSIS Error Handling (Redirect bad rows)</a> article.</div>
</div>
<h3>Debugging HTTP requests</h3>
<p style="text-align: justify;">A common thing you have to do when working with HTTP requests is to debug those requests; e.g. to check what headers, body or URL was passed. <span id="Debug_Web_API_call_using_Fiddler"></span>To test how things look behind the scenes we strongly suggest to use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a> - a popular web debugging tool.</p>
<p style="text-align: justify;">Inside it, you can double-click the URL entry (Right side) to see Request and Response Panels. The top panel is Request (URL, Headers, Body) and Bottom Panel is Response. For https:// (secure URL) make sure you enable HTTPS option in Fiddler (Tools &gt; Options &gt; HTTPS &gt; Check Decrypt https request):</p>

<div id="attachment_2344" class="wp-caption alignnone">

<a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-2344 size-full" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png" alt="Debugging Web API call using Fiddler in SSIS" width="1287" height="564" data-attachment-id="2344" data-permalink="https://zappysys.com/blog/pass-authorization-header-redirected-location/ssis-rest-api-call-debug-via-fiddler/#main" data-orig-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=1287%2C564&amp;ssl=1" data-orig-size="1287,564" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-rest-api-call-debug-via-fiddler" data-image-description="&lt;p&gt;Debugging Web API call using Fiddler in SSIS&lt;/p&gt; " data-medium-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=300%2C131&amp;ssl=1" data-large-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=720%2C316&amp;ssl=1" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png 1287w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-300x131.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-768x337.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-1024x449.png 1024w" sizes="(max-width: 1287px) 100vw, 1287px" /></a>
<p class="wp-caption-text">Debugging Web API call using Fiddler in SSIS</p>

</div></div>
<h2>Conclusion</h2>
<p>In this post, you saw how easy it is to read data from Zendesk using the SSIS JSON Source (REST API Connector). <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">Click here to download</a> and try it yourself.</p>
<p><strong>Keywords</strong></p>
<p>Loading Zendesk data into SQL Server<br />
How to read Zendesk tickets in SSIS<br />
Calling Zendesk REST API in SSIS<br />
Fetch Zendesk data using a REST API call in SSIS<br />
Extract Zendesk data using a REST API call in SSIS<br />
Reading data from Zendesk using rest api call<br />
Pulling Zendesk tickets using rest api call</p>
<p>The post <a href="https://zappysys.com/blog/read-zendesk-data-in-ssis-call-rest-api/">How to read Zendesk data in SSIS with REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
