www.dsp-ip.com Fast Forward Your Development facebook 3 rd part API
May 17, 2015
www.dsp-ip.comFast Forward Your Development
facebook 3rd part API
www.dsp-ip.comFast Forward Your Development
Overview
•Facebook Introduction•Facebook API capabilities•Facebook application types•Facebook language support•Facebook & Microsoft
www.dsp-ip.comFast Forward Your Development
Facebook Introduction
•Facebook - social service enabling people to share and connect
•Facebook allows you to search for your friends co-workers and anyone you know.
•Facebook is an easy to use and manage, web 2.0 application.
•Facebook allows any user to build it’s own applications using the benefits of their social grid.
•More than that, Facebook architecture causes a mass distribution of your applications.
www.dsp-ip.comFast Forward Your Development
Facebook API Capabilities
• facebook API allows you to access any relevant information the user exposes to your application.
• facebook gives you access to profiles, friends, photos, groups, and much more.
•FQL - Facebook Query Language• facebook API allows you to perform queries
on their DB by writing queries. FQL queries syntax is similar to SQL queries.
•FBML - Facebook Markup Language - similar to HTML syntax. Provides easily integration with facebook platform.
www.dsp-ip.comFast Forward Your Development
Facebook Application types
•There are three main application types Facebook supports:▫External Desktop Application .▫External Web Application.▫Internal Facebook Application.
•These three types of applications allows you, the developer, to bind Facebook data to any application you’re writing.
www.dsp-ip.comFast Forward Your Development
Facebook Language support
•Facebook officially supports PHP 4/5 and Java client libraries
•Facebook partnered with Microsoft to support .Net applications
•Facebook API language support includes:▫ActionScript▫Cocoa ▫ColdFusion▫Perl▫Python▫Ruby
www.dsp-ip.comFast Forward Your Development
Facebook & Microsoft
•Facebook has a .Net library containing all you need, as a developer, for using Facebook through your desktop or web application.
•The .Net library contains Desktop controls, Web controls, Facebook
•Microsoft also supports Facebook with their PopFly application that allows the developer easily build an application.
www.dsp-ip.comFast Forward Your Development
Developing facebook application
www.dsp-ip.comFast Forward Your Development
Adding new application
• Opening a new application• For external application: In the callback URL you
enter the URL of your application.• For internal application you need to enable the
“Can your application be added on Facebook?” selection.
• Fill your application URLs in the added fields.
• After completing the registration you get API key and Secret strings to use in your application.
www.dsp-ip.comFast Forward Your Development
Code Review
•At your website project, Add reference to Facebook.dll and to Facebook.WebControls.dll.
•At the .cs code file write the following:new protected void Page_Load(object sender, EventArgs e){base.Api = “Your Application key”; //Inform which application to use.base.Secret = “Your Application Secret”; //Added encryption for security.base.Page_Load(sender, e); //must be calledif (!IsPostBack) { //Use Facebook API to pull data from Facebook. Facebook.Entity.User user = this.FBService.GetUserInfo(); Collection<Facebook.Entity.User> friends = this.FBService.GetFriends();}
}
www.dsp-ip.comFast Forward Your Development
Code Review (contd.)
•Now we can use the data from Facebook in our application.
•Let’s first build a simple page in ASP.Net
•This page declares two labels that will be rendered in the server-side, and a link to another page.
•Pay attention to the ID attr. of the asp:labels, we will use these IDs now.
www.dsp-ip.comFast Forward Your Development
Code Review (contd.)•Now we need to insert the data we pulled
from Facebook platform into our web page.lblHelloWorld.Text = "Hello " + user.Name + " you have " + friends.Count + " friends + "..." + this.FBService.SessionKey;this.FBService.SetFBML("Hello " + u.Name + " you have " + f.Count + "
friends”);//Set FBML method sets an FBML string to the profile page.
lblDashboard.Text = "<fb:dashboard><fb:action href=\"http://apps.facebook.com/aspnetcanvasfbml/default3.aspx\">
Go to Default3</fb:action></fb:dashboard><br/>";
//Sets FBML dashboard element to the applcication
• That’s all you need to create an application
www.dsp-ip.comFast Forward Your Development
DSP-IP Contact informationFor Course materials & lecture request contact: For Course materials & lecture request contact:
For projects development services contact: For projects development services contact:
Adi YakovAdi YakovTraining and Courses ManagerTraining and Courses [email protected]@dsp-ip.com+972-9-8651933+972-9-8651933
www.dsp-ip.com www.dsp-ip.com Mail : [email protected] Mail : [email protected] Phone: Phone: +972-9-8850956, +972-9-8850956, Fax : +972-50- 8962910Fax : +972-50- 8962910
Alona AshkenaziAlona AshkenaziTechnology Management Technology Management Services Services : : [email protected]@dsp-ip.com+972-9-8850956+972-9-8850956