<?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>facebook graph api Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/facebook-graph-api/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/facebook-graph-api/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Mon, 07 Apr 2025 12:57:41 +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>facebook graph api Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/facebook-graph-api/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to register Facebook OAuth App for Graph API Access</title>
		<link>https://zappysys.com/blog/register-facebook-oauth-app-graph-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 16 Jun 2016 18:27:52 +0000</pubDate>
				<category><![CDATA[REST API]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[facebook graph api]]></category>
		<category><![CDATA[json source]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[OAuthApp]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=584</guid>

					<description><![CDATA[<p>Introduction In this article, you will learn how to register Facebook OAuth App (Graph API) for data access using SSIS PowerPack REST API Connectors. Using SSIS PowerPack you can consume/manage Facebook data by calling Graph API. These connectors have drag and drop UI so you can do data integration without any coding (e.g. C#, Java, [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/register-facebook-oauth-app-graph-api/">How to register Facebook OAuth App for Graph API Access</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this article, you will learn how to <strong>register Facebook OAuth App</strong> (<strong>Graph API</strong>) for data access using <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> REST API Connectors. Using SSIS PowerPack you can consume/manage Facebook data by calling Graph API. These connectors have drag and drop UI so you can do data integration without any coding (e.g. C#, Java, Python, Ruby).</p>
<p><a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON /REST Source Connector</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> they both support a wide range of options for any type of REST API integration scenarios including Facebook REST API integration into your ETL Workflow. It also supports the use of OAuth 1.0 and 2.0 Protocols used by Twitter, Facebook, Google, LinkedIn, and many other popular Apis.</p>
<p><strong>Facebook Graph API</strong> can be used to read or manage Facebook data via REST API Calls. To access Graph API you will have to create OAuth App inside Facebook Developer Portal. Let&#8217;s take a look step by step.</p>
<h2>Step-By-Step: Create Facebook OAuth App (i.e Register OAuth App)</h2>
<ol>
<li>Go to www.facebook.com and log in with an account which you want to use to access Facebook data. You can access your own data using API without issue but if you have to access someone else data via App then it will require additional steps listed in this article in &#8220;Create Public Facebook OAuth App&#8221; section</li>
<li>Once you login to Facebook type <a href="https://developers.facebook.com/apps" target="_blank" rel="noopener">https://developers.facebook.com/apps</a> in the Address bar</li>
<li>Click on <strong>Create New App</strong>. If you never access developer portal then you may be prompted to Register as a developer.
<div id="attachment_6506" style="width: 730px" class="wp-caption aligncenter"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-1.png" target="_blank" rel="noopener"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-6506" class="wp-image-6506 size-large" src="https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-1-1-1024x655.png" alt="create-facebook-oauth-app-developer-graph-api-1" width="720" height="461" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-1-1-1024x655.png 1024w, https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-1-1-300x192.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-1-1-768x491.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-1-1.png 1047w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-6506" class="wp-caption-text">Create Facebook OAuth App for Graph API access (For SSIS PowerPack REST Connectors)</p></div></li>
<li>It creates the app by given name and asked you to choose some options like ads and FB login. Click on skip to skip that step.</li>
<li>Now go to basic settings and there you can change app name, contact email and select category (e.g. Business). There you can also found OAuth App ID and App Secret store it somewhere for the next phase.
<div id="attachment_6508" style="width: 730px" class="wp-caption aligncenter"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-2.png" target="_blank" rel="noopener"><img decoding="async" aria-describedby="caption-attachment-6508" class="wp-image-6508 size-large" src="https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-2-1-1024x719.png" alt="Register Facebook OAuth App for Custom Desktop Application (Basic Setup)" width="720" height="506" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-2-1-1024x719.png 1024w, https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-2-1-300x211.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-2-1-768x539.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/06/create-facebook-oauth-app-developer-graph-api-2-1.png 1055w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-6508" class="wp-caption-text">Register Facebook OAuth App for Custom Desktop Application (Basic Setup)</p></div></li>
<li>No Click on Add Products and add Facebook Login. Because our app is used for SSIS PowerPack which has custom login flow (using Embedded Browser). We have to Add Facebook Login support and check Embedded browser option (see below).
<div id="attachment_6509" style="width: 730px" class="wp-caption aligncenter"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/facebook-desktop-native-oauth-app-add-login-embedded-browser-support.png"><img decoding="async" aria-describedby="caption-attachment-6509" class="wp-image-6509 size-large" src="https://zappysys.com/blog/wp-content/uploads/2016/06/facebook-desktop-native-oauth-app-add-login-embedded-browser-support-1-1024x625.png" alt="Adding Embedded browser support for Facebook OAuth Application" width="720" height="439" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/facebook-desktop-native-oauth-app-add-login-embedded-browser-support-1-1024x625.png 1024w, https://zappysys.com/blog/wp-content/uploads/2016/06/facebook-desktop-native-oauth-app-add-login-embedded-browser-support-1-300x183.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/06/facebook-desktop-native-oauth-app-add-login-embedded-browser-support-1-768x468.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/06/facebook-desktop-native-oauth-app-add-login-embedded-browser-support-1.png 1041w" sizes="(max-width: 720px) 100vw, 720px" /></a><p id="caption-attachment-6509" class="wp-caption-text">Adding Embedded browser support for Facebook OAuth Application</p></div></li>
<li>Now you ready to use your App to use OAuth App ID and App Secret.</li>
</ol>
<h2>Test Facebook OAuth App (Consume graph api in SSIS)</h2>
<p>If you using SSIS PowerPack to manage your Facebook data using Graph API then perform the following steps to test your connectivity.</p>
<ol>
<li>In the SSIS Designer in connection manager page .. right click and add ZS-OAUTH</li>
<li>Select Facebook provider, Configure App ID and OAuth App Secret</li>
<li>Select Permission (i.e. Scope) or type by hand (1 per each line)</li>
<li>Click generate Token. You will be redirected to login page and then it will show Authorize App confirmation. Click Accept.</li>
<li>Test Connection (If things go well it will show green success)
<div id="attachment_588" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-facebook-test-oauth-connection-graph-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-588" class="wp-image-588" src="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-facebook-test-oauth-connection-graph-api.png" alt="Testing Facebook OAuth Connectivity in SSIS (Use Graph API)" width="600" height="384" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-facebook-test-oauth-connection-graph-api.png 957w, https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-facebook-test-oauth-connection-graph-api-300x192.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-588" class="wp-caption-text">Testing Facebook OAuth Connectivity in SSIS (Use Graph API)</p></div></li>
</ol>
<h2>Fetch from Facebook Graph API (Load data into SQL Server)</h2>
<p>Below is sample screenshot how you can use JSON Source to pull data from Facebook REST API and load into SQL Server. <a href="//zappysys.com/blog/get-data-from-facebook-in-ssis-using-rest-api/" target="_blank" rel="noopener">Refer this article</a> for step-by-step information.</p>
<div id="attachment_587" style="width: 710px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/extract-data-from-facebook-graph-rest-api-use-oauth-load-sql-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-587" class="wp-image-587" src="//zappysys.com/blog/wp-content/uploads/2016/06/extract-data-from-facebook-graph-rest-api-use-oauth-load-sql-server.png" alt="Extract data from Facebook using Graph API (SSIS JSON/REST API Connector) - Load into SQL Server Table" width="700" height="508" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/extract-data-from-facebook-graph-rest-api-use-oauth-load-sql-server.png 889w, https://zappysys.com/blog/wp-content/uploads/2016/06/extract-data-from-facebook-graph-rest-api-use-oauth-load-sql-server-300x218.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-587" class="wp-caption-text">Extract data from Facebook using Graph API (SSIS JSON/REST API Connector) &#8211; Load into SQL Server Table</p></div>
<p>The post <a href="https://zappysys.com/blog/register-facebook-oauth-app-graph-api/">How to register Facebook OAuth App for Graph API Access</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to get data from Facebook in SSIS using REST API</title>
		<link>https://zappysys.com/blog/get-data-from-facebook-in-ssis-using-rest-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 11 Jan 2016 15:41:54 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[facebook graph api]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[paging]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=320</guid>

					<description><![CDATA[<p>Introduction In this article you will learn how to get data from Facebook using Graph API (OAuth 2.0) using SSIS PowerPack REST api Connectors. Facebook provides rich set of REST API to access data. Their REST API is also known as Facebook Graph API and it uses OAuth 2.0 Authorization. Traditionally any REST API Integration scenarios [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-facebook-in-ssis-using-rest-api/">How to get data from Facebook in SSIS using REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2016/01/facebook-api-integration.png"><img loading="lazy" decoding="async" class="size-full wp-image-1667 alignleft" src="//zappysys.com/blog/wp-content/uploads/2016/01/facebook-api-integration.png" alt="" width="123" height="123" /></a>In this article you will learn how to get data from Facebook using Graph API (OAuth 2.0) using <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> REST api Connectors. Facebook provides rich set of REST API to access data. Their REST API is also known as <strong>Facebook Graph API</strong> and it uses <strong>OAuth 2.0</strong> Authorization. Traditionally any REST API Integration scenarios in <strong>SSIS</strong> requires you to use some sort of SDKs using popular programming languages (e.g. C#, Java, Ruby, Python). If you are DBA or SSIS Developer and you prefer to use clean drag and drop approach rather complex programming then this article will show you how to achieve it.</p>
<p><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> REST API Connectors can be used to consume/manage Facebook data using REST API. Following connectors will be used in this article.</p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png" alt="Custom SSIS Tasks - Call REST API Webservice (GET, POST, DELETE etc)" width="32" /></td>
<td><u><a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a></u></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/oauth-connection/ssis-oauth-connection-manager.png" alt="SSIS OAuth Connection Manager" width="32" /></td>
<td><a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/SSIS-PowerPack/SSIS-Json-Source-Adapter.png" alt="Custom SSIS Components - JSON Source (File, REST, OData)" width="32" /></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source (File, REST, OData)</a></td>
</tr>
</tbody>
</table>
</div>
<h2>Register Facebook OAuth App for Graph API access</h2>
<p>Very first step to access Facebook API is register your custom OAuth App under Facebook developer portal. <a href="//zappysys.com/blog/register-facebook-oauth-app-graph-api/" target="_blank" rel="noopener">Check this article for more information on this topic</a>.</p>
<h2>Consume data from Facebook using REST API in SSIS</h2>
<p>In this section we will guide you how to create OAuth connection and consume data from Facebook in few clicks using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source (File, REST, OData)</a> . We will load Facebook data into SQL Server.</p>
<h3>Find Facebook PageID from its Name</h3>
<p>In our case for example we want to Extract Page Insights for some page (e.g. facebook.com/MyPage ). To findout pageid perform following steps</p>
<ol>
<li>Navigate to <a href="https://developers.facebook.com/tools/explorer" target="_blank" rel="noopener">https://developers.facebook.com/tools/explorer</a></li>
<li>Click Get Token button, select permission you really care (To get PageID you don&#8217;t need to check anything).</li>
<li>Type /YourPageName in the API Url bar</li>
<li>Now click Submit. You will see response json which will have pagename and pageID
<div id="attachment_603" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/01/using-facebook-graph-api-explorer-ssis-get-page-id.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-603" class="wp-image-603" src="//zappysys.com/blog/wp-content/uploads/2016/01/using-facebook-graph-api-explorer-ssis-get-page-id.png" alt="Using Facebook Graph API Explorer, Test API, Find Object ID / PageID from Name" width="600" height="231" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/using-facebook-graph-api-explorer-ssis-get-page-id.png 709w, https://zappysys.com/blog/wp-content/uploads/2016/01/using-facebook-graph-api-explorer-ssis-get-page-id-300x116.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-603" class="wp-caption-text">Using Facebook Graph API Explorer, Test API, Find Object ID / PageID from Name</p></div></li>
</ol>
<h3>Create Facebook OAuth Connection</h3>
<p>You can create SSIS OAuth connection manager two ways. 1) From Add Connection manager option from designer or Click Add ZS-OAuth from Component UI. Lets use first method.</p>
<ol>
<li>In the SSIS Designer in connection manager pane .. right click and new connection &#8230; select ZS-OAUTH Connection from list</li>
<li>Select Facebook provider from dropdown</li>
<li>Select Custom OAuth App option</li>
<li>Enter Facebook OAuth App ID and OAuth App Secret</li>
<li>Select Permission (i.e. Scope) or type by hand (1 per each line)</li>
<li>Click generate Token. You will be redirected to login page and then it will show Authorize App confirmation. Click Accept.</li>
<li>Test Connection (If things go well it will show green success)
<div id="attachment_588" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-facebook-test-oauth-connection-graph-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-588" class="wp-image-588" src="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-facebook-test-oauth-connection-graph-api.png" alt="Testing Facebook OAuth Connectivity in SSIS (Use Graph API)" width="600" height="384" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-facebook-test-oauth-connection-graph-api.png 957w, https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-facebook-test-oauth-connection-graph-api-300x192.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-588" class="wp-caption-text">Testing Facebook OAuth Connectivity in SSIS (Use Graph API)</p></div></li>
</ol>
<h3>Get Page Access Token (optional)</h3>
<p>Accessing data of your Facebook page requires to generate a <em>Page Access Token</em>, follow the steps below to get it. If you are using non-page API methods, then you can freely skip this step. In SSIS Designer drag and drop REST API Task.</p>
<ol>
<li>Then use the same OAuth connection we created in the previous step.</li>
<li>Proceed with setting the URL using this format:<br />
<code>https://graph.facebook.com/v2.5/<strong>REPLACE_WITH_PAGE_ID</strong>?fields=access_token</code></li>
<li>Click <strong>Test Request/Response</strong> button and then copy the <strong>Page Access Token</strong> to a Notepad.</li>
</ol>
<div id="attachment_8730" style="width: 825px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/001-get-data-from-facebook-in-ssis-using-rest-api-getting-page-access-token.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8730" class="wp-image-8730 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/01/001-get-data-from-facebook-in-ssis-using-rest-api-getting-page-access-token.png" alt="Getting Facebook Page Access Token using Facebook Graph API and SSIS" width="815" height="752" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/001-get-data-from-facebook-in-ssis-using-rest-api-getting-page-access-token.png 815w, https://zappysys.com/blog/wp-content/uploads/2016/01/001-get-data-from-facebook-in-ssis-using-rest-api-getting-page-access-token-300x277.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/01/001-get-data-from-facebook-in-ssis-using-rest-api-getting-page-access-token-768x709.png 768w" sizes="(max-width: 815px) 100vw, 815px" /></a><p id="caption-attachment-8730" class="wp-caption-text">Getting Facebook Page Access Token using Facebook Graph API and SSIS</p></div>
<h3>Get Long-Lived Access Token</h3>
<p>Most likely, once finished, you will deploy the SSIS package to your SQL Server and then set a schedule to run it daily or hourly. With ordinary Access Tokens you will run into a problem after 30 or 60 days because these tokens will expire after a similar time and your SQL Job will fail. To avoid that, we can generate a Long-Lived Access Token which will live for 60 days, as long as you use that token (and running the package <em>is</em> using it). Perform these steps to generate a Long-Lived Access Token:</p>
<ol>
<li>Firstly, you will need to find out your Facebook User ID. To do that, call this URL in Facebook Graph Explorer or using REST API Task with configured OAuth Connection Manager:<br />
<code>https://graph.facebook.com/v2.5/me</code></li>
<li>Copy the ID from the response.</li>
<li>Then drag and drop another REST API Task and configure it like this, if you want to generate a Long-Lived <span style="text-decoration: underline;"><em>Page</em></span> Access Token:
<div id="attachment_8731" style="width: 800px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/002-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-page-access-token.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8731" class="wp-image-8731 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/01/002-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-page-access-token.png" alt="Getting Facebook Long-Lived Page Access Token using Facebook Graph API and SSIS" width="790" height="709" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/002-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-page-access-token.png 790w, https://zappysys.com/blog/wp-content/uploads/2016/01/002-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-page-access-token-300x269.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/01/002-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-page-access-token-768x689.png 768w" sizes="(max-width: 790px) 100vw, 790px" /></a><p id="caption-attachment-8731" class="wp-caption-text">Getting Facebook Long-Lived Page Access Token using Facebook Graph API and SSIS</p></div>
<p>Otherwise, if you want to generate a <em><span style="text-decoration: underline;">non-page</span></em> Long-Lived Access Token, use this configuration:</p>
<div id="attachment_8732" style="width: 696px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/003-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-access-token.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8732" class="wp-image-8732 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/01/003-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-access-token.png" alt="Getting Facebook Long-Lived Access Token using Facebook Graph API and SSIS" width="686" height="356" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/003-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-access-token.png 686w, https://zappysys.com/blog/wp-content/uploads/2016/01/003-get-data-from-facebook-in-ssis-using-rest-api-getting-long-lived-access-token-300x156.png 300w" sizes="(max-width: 686px) 100vw, 686px" /></a><p id="caption-attachment-8732" class="wp-caption-text">Getting Facebook Long-Lived Access Token using Facebook Graph API and SSIS</p></div></li>
</ol>
<h3>Use JSON/REST API Source to read from Graph API</h3>
<p>Once you have OAuth connection manager. You can perform following steps to Extract data from Graph API Url. Facebook Graph API uses ObjectID in the URL so make sure you have that handy for whatever resource you want to access.</p>
<h3>Configure JSON/REST API Source</h3>
<p>Once you know pageid we can build our API URL. Lets assume your pageid is 12345678 and you want to extract page insight data via API call. In that case you may build your URL following way. You can change v2.5 to something else depending on API version you wish to use. If you omit version number from URL then default version will be used by Facebook API (Default API version can be found on Dashboard of your OAuth App).</p><pre class="crayon-plain-tag">https://graph.facebook.com/v2.5/<strong>YOUR_PAGE_ID</strong>/insights/page_impressions_organic_unique</pre><p>
Now perform the following steps to configure JSON Source to extract data from Facebook API.</p>
<p><strong>NOTE:</strong> Below steps assume that you already Downloaded and Installed <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a></p>
<ol>
<li>Drag Data Flow Task from SSIS Toolbox and double click to view Dataflow designer</li>
<li>Drag <strong>ZS JSON Source</strong> from SSIS Toolbox. Double click to configure.</li>
<li>In the AccessMode select &#8220;File Path or Web URL&#8221;</li>
<li>Enter URL:<br />
<code>https://graph.facebook.com/v2.5/<strong>YOUR_PAGE_ID</strong>/insights/page_impressions_organic_unique?access_token=<strong>REPLACE_WITH_LONG_LIVED_ACCESS_TOKEN</strong></code><br />
<strong>NOTE:</strong> <a href="https://zappysys.com/blog/get-api-data-with-dynamic-url-and-load-into-sql-server/" target="_blank" rel="noopener">You may use variables and parameters in the URL</a> e.g. http://mydomain/{{User::MyPath}}:</p>
<div id="attachment_8733" style="width: 698px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/004-get-data-from-facebook-in-ssis-using-rest-api-getting-page-data.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8733" class="wp-image-8733 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/01/004-get-data-from-facebook-in-ssis-using-rest-api-getting-page-data.png" alt="Getting Facebook Page data using Facebook Graph API and SSIS" width="688" height="680" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/004-get-data-from-facebook-in-ssis-using-rest-api-getting-page-data.png 688w, https://zappysys.com/blog/wp-content/uploads/2016/01/004-get-data-from-facebook-in-ssis-using-rest-api-getting-page-data-300x297.png 300w" sizes="(max-width: 688px) 100vw, 688px" /></a><p id="caption-attachment-8733" class="wp-caption-text">Getting Facebook Page data using Facebook Graph API and SSIS</p></div></li>
<li>Click on Select Filter and select values node and click OK. It may produce filter expression like below.</li>
<li>You can set <strong>Max Rows</strong> option to desired value if you don&#8217;t want to extract all rows (0=Unlimited)</li>
<li>Goto Paging Tab and enter <strong>$.paging.next</strong> in the &#8220;Next Cursor&#8221; field as below
<div id="attachment_8734" style="width: 646px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/01/005-get-data-from-facebook-in-ssis-using-rest-api-paging-through-the-results.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8734" class="wp-image-8734 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/01/005-get-data-from-facebook-in-ssis-using-rest-api-paging-through-the-results.png" alt="Getting page data from Facebook and paginating through the results using SSIS" width="636" height="449" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/005-get-data-from-facebook-in-ssis-using-rest-api-paging-through-the-results.png 636w, https://zappysys.com/blog/wp-content/uploads/2016/01/005-get-data-from-facebook-in-ssis-using-rest-api-paging-through-the-results-300x212.png 300w" sizes="(max-width: 636px) 100vw, 636px" /></a><p id="caption-attachment-8734" class="wp-caption-text">Getting page data from Facebook and paginating through the results using SSIS</p></div></li>
<li>Click on Columns tab if you wish to see/change metadata (You can change size / datatype there and Lock metadata to prevent auto refresh)</li>
<li>Now click Preview to see sample data and then exit preview and click OK to save UI changes</li>
</ol>
<h3>Load Facebook data into SQL Server</h3>
<p>If you wish to save Facebook data into SQL Server or any other target like Oracle, MySQL, FlatFile, Excel, etc., then you can use some native SSIS Connectors (e.g. OLEDB Destination, ADO.net Destination). Connect JSON Source to Destination and map source columns to target.</p>
<h2>Facebook API Paging through dataset (i.e. Loop, Cursor)</h2>
<p>In the previous section, you saw how to adjust few attributes so JSON Source can paginate through Facebook API response. To learn more about <a href="//zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">REST API Paging Methods &#8211; Click this link</a></p>
<p>Here is <a href="https://developers.facebook.com/docs/graph-api/using-graph-api#paging" target="_blank" rel="noopener">another link</a> from Facebook Documentation for Paging</p>
<h2>Manage/Write/Update Facebook data using REST API</h2>
<p>If you wish to create new POST  or manage data using REST API then you most likely need to use <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> rather than JSON Source. REST API Task also supports uploading media files.</p>
<p>&nbsp;</p>
<h2>Deployment to Production</h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<p>You may also check the article on <a href="https://zappysys.com/blog/get-api-data-with-dynamic-url-and-load-into-sql-server/" target="_blank" rel="noopener">how to make URL dynamic/parametric</a>, so that you can pass Long-Lived Access Token as an argument in a SQL Job.</p>
<h2>Conclusion</h2>
<p>Facebook data integration can be quite challenging without right set of tools. <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> provides complete toolset for any REST API integration related scenarios. Try it yourself and find out all hidden features not discussed in this article.</p>
<h2>References</h2>
<p><a href="https://developers.facebook.com/docs/graph-api" target="_blank" rel="noopener">Facebook Graph REST API reference link</a></p>
<p><a href="https://developers.facebook.com/tools/explorer" target="_blank" rel="noopener">https://developers.facebook.com/tools/explorer</a></p>
<p><a href="https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing/" target="_blank" rel="noopener">https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing/</a></p>
<h2>Similar articles</h2>
<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/" rel="bookmark">Read Twitter data in SSIS using REST API Task and JSON Source – OAuth2 Protocol</a></p>
<p><a title="Permalink to How to get data from Google AdWords using SSIS" href="//zappysys.com/blog/get-data-from-google-adwords-using-ssis/" rel="bookmark">How to get data from Google AdWords using SSIS</a></p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-facebook-in-ssis-using-rest-api/">How to get data from Facebook in SSIS using REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
