SlideShare a Scribd company logo
ApiFacebook development by Wang Tao at Ethos  / 2011-2-17
About me @anytao in twitter A .net geek in China
Facebook & its API overview graph Api FQL authentication current solution Other Social Network: Twitter, t.sina
Overview Plugin FBML FB App SDK Testing
Restful API
Restful Api https://api.facebook.com/method/[name] users.hasAppPermission users.isAppUser users.getLoggedInUser Benefit Easy SOA Resource Only Http Stateless Light Weight Simple Readable Json and XML deprecated https://api.facebook.com/method/users.getInfo?uids=555020699&fields=name&access_token=…
Graph API Simple, Consistent, and Connected
Objects
Object user page message status message photo video http://graph.facebook.com/anytao http://graph.facebook.com/platform https://graph.facebook.com/{ID}
Simple https://graph.facebook.com/{ID} Me https://graph.facebook.com/me/friends
Data object as URL! Consistent All objects in Facebook can be accessed in the same way: Users: https://graph.facebook.com/btaylor (Bret Taylor) Pages: https://graph.facebook.com/cocacola (Coca-Cola page) Events: https://graph.facebook.com/251906384206 (Facebook Developer Garage Austin) Groups: https://graph.facebook.com/195466193802264 (Facebook Developers group) Applications: https://graph.facebook.com/2439131959 (the Graffiti app) Status messages: https://graph.facebook.com/367501354973 (A status message from Bret) Photos: https://graph.facebook.com/98423808305 (A photo from the Coca-Cola page) Photo albums: https://graph.facebook.com/99394368305 (Coca-Cola's wall photos) Profile pictures: http://graph.facebook.com/anytao/picture (your profile picture) Videos: https://graph.facebook.com/614004947048 (A Facebook tech talk on Tornado) Notes: https://graph.facebook.com/122788341354 (Note announcing Facebook for iPhone 3.0) Checkins: https://graph.facebook.com/414866888308 (Check-in at a pizzeria)
Connected user@connections ,[object Object]
feed
posts
friends
picture
photos
…Objects + connections http://graph.facebook.com/anytao/picture http://graph.facebook.com/me/friends
Json return {    "data": [       {          "id": "555020699_160639637289676",          "message": "I agree with Reg, this makes me really proud to live in Toronto...", "picture": "http://external.ak.fbcdn.net/safe_image.php?d=ace00444e7daf6cb40d8605fae85c257&w=130&h=130&url=http%3A%2F%2Fi.ytimg.com%2Fvi%2F-KGLgDQAo5U%2F0.jpg",          "link": "http://www.youtube.com/watch?v=-KGLgDQAo5U&feature=youtube_gdata_player",          "source": "http://www.youtube.com/v/-KGLgDQAo5U&autoplay=1",          "name": "Hoedown Throwdown",          "caption": "www.youtube.com",          "description": "I got off the subway at Bloor and Yonge last night, and this is what I saw; some buskers with a fiddle and a banjo were playing, and these four other guys just started to pop it and lock it, apparently just for the hell of it. It cheered me right up.",          "icon": "http://static.ak.fbcdn.net/rsrc.php/zj/r/v2OnaTyTQZE.gif",          "actions": [             {                "name": "Comment",                "link": "http://www.facebook.com/555020699/posts/160639637289676"             },             {                "name": "Like",                "link": "http://www.facebook.com/555020699/posts/160639637289676"             } ],
Demo Every object in the social graph has a unique ID. You can access the properties of an object by requesting. https://graph.facebook.com/{ID} http://graph.facebook.com/anytao http://graph.facebook.com/anytao https://graph.facebook.com/anytao/friends?access_token=2227470867|2.0x1QCxus6HCsWaaMArPglg__.3600.1297929600-738694610|aZXed9W0Ank-2mhI73UnwIX3gYI https://graph.facebook.com/anytao/friends?access_token=2227470867|2.0x1QCxus6HCsWaaMArPglg__.3600.1297929600-738694610|aZXed9W0Ank-2mhI73UnwIX3gYI
FQL
Key advantages Common syntax for all methods Condense Facebook queries Reduce response size
FQL is an SQL-like syntax SELECT name FROM user WHERE uid = 4 Has AND, OR and NOT keywords Use basic boolean operators SELECT uid2 FROM friend WHERE uid = 4 AND uid2 > (4 + 1000) Enhance queries with basic functions now() strlen()
FQL is an SQL-like syntax substr() strpos() Example, SELECT location FROM event WHRERE eid=1234567 AND strpos(name, “facebook”) AND start_time > 10000000
FQL: Advanced Query SELECT eid FROM event WHERE eid 	IN ( 	SELECT eid FROM event_member WHERE uid = 4 ) AND location = “beijing”
FQL, not SQL No JOIN No ORDER BY No GROUP BY No LIMIT Only one table in FROM Not allowed: SELECT * FROM user, photo WHERE uid = 4
FQL, not SQL display most recently updated events in Bejing SQL: SELECT * FROM event WHERE location = “bejing” AND user = 4 ORDER BY update_time ASC FQL: SELCT update_time, eid, name, location FROM event WHERE eid IN (SLECT eid FROM event_member WHERE uid = 4) AND location = “beijing”
Demo https://api.facebook.com/method/fql.query?access_token=2227470867|2.9stmGn8B630JCOkK7xICMw__.3600.1297922400-738694610|gdYJgGegkPa71WVFv-HD2XMxi0M&format=json&query=select%20name%20from%20user%20where%20uid=621627426 https://api.facebook.com/method/fql.query?access_token=2227470867|2.gouA9cuplsTSEpAOnMBlhA__.3600.1298304000-738694610|allgk00e3d6e6S33DzFi8-kteQ0&format=json&query=select%20name,%20location%20from%20event%20where%20eid%20in%20(select%20eid%20from%20event_member%20where%20uid%20=%20738694610) select name, location from event where eid in (select eid from event_member where uid = 738694610)
Authentication
Facebook Authentication oauth 2.0 http://graph.facebook.com/anytao http://graph.facebook.com/anytao/picture <public data> http://graph.facebook.com/anytao/home?access_token= http://graph.facebook.com/anytao/feed?access_token= access_token <privatec data>
What is OAuth?
Actors on Facebook oAuth Jacky - User Explorer - Consumer Facebook - Service Provider 1 2 3 Example
Retrieve a request token 1 2 3 Request user authorization Exchange request token for an access token Example
Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) OAuth Dialog (User Authentication) https://www.facebook.com/dialog/oauth?     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL
Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) OAuth Dialog (User Authentication) https://www.facebook.com/dialog/oauth?     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream
Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) OAuth Dialog (User Authentication) Cookie not found, show OAuthDialog(facebook layout)
Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) OAuth Dialog (User Authentication) Goes to App Authorization directly…
Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) Http 302 (redirect_urlparam) OAuth Dialog (User Authentication) Don’t allow! http://YOUR_URL?error_reason=user_denied&     error=access_denied&error_description=The+user+denied+your+request.
Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) Http 302 (redirect_urlparam) OAuth Dialog (User Authentication) Allow! Redirect with Authorization Code param http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER
Facebook Authentication / Server side flow http://mydomain.com OAuth (App authorization) Request: https://graph.facebook.com/oauth/access_token https://graph.facebook.com/oauth/access_token?     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&     client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE
Facebook Authentication / Server side flow http://mydomain.com Http 400 Failed! { "error": { "type": "OAuthException", "message": "Error validating verification code." } }
Facebook Authentication / Server side flow http://mydomain.com HTTP 302 (redirect_url) Successful authenticated! access_tokenin the body of the request
Facebook Authentication / Client side flow Http request HTTP 302 (redirect_url) Pass URI fragment with access_token

More Related Content

What's hot

Virtual Tech Days 2010 - Integrating Social Networks with ASP.NET
Virtual Tech Days 2010 - Integrating Social Networks with ASP.NETVirtual Tech Days 2010 - Integrating Social Networks with ASP.NET
Virtual Tech Days 2010 - Integrating Social Networks with ASP.NETKrishna T
 
What's New on the Facebook Platform, May 2011
What's New on the Facebook Platform, May 2011What's New on the Facebook Platform, May 2011
What's New on the Facebook Platform, May 2011
Iskandar Najmuddin
 
How to connect social media with open standards
How to connect social media with open standardsHow to connect social media with open standards
How to connect social media with open standards
Glenn Jones
 
Captured Moments
Captured MomentsCaptured Moments
Captured Moments
Diane Cordell
 
1111 companies for good career
1111 companies for good career1111 companies for good career
1111 companies for good careerAnand Balaji
 
DevCon 2010 - Facebook Apps development for ASP.NET devs
DevCon 2010 - Facebook Apps development  for ASP.NET devsDevCon 2010 - Facebook Apps development  for ASP.NET devs
DevCon 2010 - Facebook Apps development for ASP.NET devsKrishna T
 
The DiSo Project and the Open Web
The DiSo Project and the Open WebThe DiSo Project and the Open Web
The DiSo Project and the Open WebChris Messina
 
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Abhishek Kumar
 

What's hot (9)

Virtual Tech Days 2010 - Integrating Social Networks with ASP.NET
Virtual Tech Days 2010 - Integrating Social Networks with ASP.NETVirtual Tech Days 2010 - Integrating Social Networks with ASP.NET
Virtual Tech Days 2010 - Integrating Social Networks with ASP.NET
 
What's New on the Facebook Platform, May 2011
What's New on the Facebook Platform, May 2011What's New on the Facebook Platform, May 2011
What's New on the Facebook Platform, May 2011
 
How to connect social media with open standards
How to connect social media with open standardsHow to connect social media with open standards
How to connect social media with open standards
 
Captured Moments
Captured MomentsCaptured Moments
Captured Moments
 
1111 companies for good career
1111 companies for good career1111 companies for good career
1111 companies for good career
 
DevCon 2010 - Facebook Apps development for ASP.NET devs
DevCon 2010 - Facebook Apps development  for ASP.NET devsDevCon 2010 - Facebook Apps development  for ASP.NET devs
DevCon 2010 - Facebook Apps development for ASP.NET devs
 
The DiSo Project and the Open Web
The DiSo Project and the Open WebThe DiSo Project and the Open Web
The DiSo Project and the Open Web
 
Hacking location aware hacks HackU IIT Bombay
Hacking location aware hacks HackU IIT BombayHacking location aware hacks HackU IIT Bombay
Hacking location aware hacks HackU IIT Bombay
 
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
 

Viewers also liked

Facebook Development for Beginners
Facebook Development for BeginnersFacebook Development for Beginners
Facebook Development for Beginners
Jesse Stay
 
Intro to Facebook Presentation – Facebook, How to Get Started Safely
Intro to Facebook Presentation – Facebook, How to Get Started SafelyIntro to Facebook Presentation – Facebook, How to Get Started Safely
Intro to Facebook Presentation – Facebook, How to Get Started Safely
hewie
 
Social Media Marketing Strategy Case Study – Intel Inc. presence on Facebook,...
Social Media Marketing Strategy Case Study – Intel Inc. presence on Facebook,...Social Media Marketing Strategy Case Study – Intel Inc. presence on Facebook,...
Social Media Marketing Strategy Case Study – Intel Inc. presence on Facebook,...
Rajesh Prabhakar
 
Facebook business model canvas
Facebook business model  canvasFacebook business model  canvas
Facebook business model canvas
Susheel Racherla
 
Facebook Competitive Advantage (social networking)
Facebook Competitive Advantage (social networking)Facebook Competitive Advantage (social networking)
Facebook Competitive Advantage (social networking)
Akash Senapaty
 
Facebook Case Study + Solutions 2013
Facebook Case Study + Solutions 2013Facebook Case Study + Solutions 2013
Facebook Case Study + Solutions 2013
André L. Campino
 
SWOT and PESTLE analysis of Facebook
SWOT and PESTLE analysis of FacebookSWOT and PESTLE analysis of Facebook
SWOT and PESTLE analysis of Facebook
Mouad Gouffia
 
Business Strategy Analysis on Facebook
Business Strategy Analysis on FacebookBusiness Strategy Analysis on Facebook
Business Strategy Analysis on Facebook
Shanker Naik
 
Facebook Analysis and Study
Facebook Analysis and StudyFacebook Analysis and Study
Facebook Analysis and Study
Ouriel Ohayon
 
Venture Design Workshop: Business Model Canvas
Venture Design Workshop: Business Model CanvasVenture Design Workshop: Business Model Canvas
Venture Design Workshop: Business Model Canvas
Alex Cowan
 

Viewers also liked (10)

Facebook Development for Beginners
Facebook Development for BeginnersFacebook Development for Beginners
Facebook Development for Beginners
 
Intro to Facebook Presentation – Facebook, How to Get Started Safely
Intro to Facebook Presentation – Facebook, How to Get Started SafelyIntro to Facebook Presentation – Facebook, How to Get Started Safely
Intro to Facebook Presentation – Facebook, How to Get Started Safely
 
Social Media Marketing Strategy Case Study – Intel Inc. presence on Facebook,...
Social Media Marketing Strategy Case Study – Intel Inc. presence on Facebook,...Social Media Marketing Strategy Case Study – Intel Inc. presence on Facebook,...
Social Media Marketing Strategy Case Study – Intel Inc. presence on Facebook,...
 
Facebook business model canvas
Facebook business model  canvasFacebook business model  canvas
Facebook business model canvas
 
Facebook Competitive Advantage (social networking)
Facebook Competitive Advantage (social networking)Facebook Competitive Advantage (social networking)
Facebook Competitive Advantage (social networking)
 
Facebook Case Study + Solutions 2013
Facebook Case Study + Solutions 2013Facebook Case Study + Solutions 2013
Facebook Case Study + Solutions 2013
 
SWOT and PESTLE analysis of Facebook
SWOT and PESTLE analysis of FacebookSWOT and PESTLE analysis of Facebook
SWOT and PESTLE analysis of Facebook
 
Business Strategy Analysis on Facebook
Business Strategy Analysis on FacebookBusiness Strategy Analysis on Facebook
Business Strategy Analysis on Facebook
 
Facebook Analysis and Study
Facebook Analysis and StudyFacebook Analysis and Study
Facebook Analysis and Study
 
Venture Design Workshop: Business Model Canvas
Venture Design Workshop: Business Model CanvasVenture Design Workshop: Business Model Canvas
Venture Design Workshop: Business Model Canvas
 

Similar to Facebook and its development

Facebook Platform
Facebook PlatformFacebook Platform
Facebook Platform
David Nattriss
 
Facebook API
Facebook APIFacebook API
Facebook APIsnipermkd
 
Introduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDKIntroduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDK
Colin Su
 
What's New on the Facebook Platform, July 2011
What's New on the Facebook Platform, July 2011What's New on the Facebook Platform, July 2011
What's New on the Facebook Platform, July 2011
Iskandar Najmuddin
 
Node social
Node socialNode social
Node social
orkaplan
 
Facebook + Ruby
Facebook + RubyFacebook + Ruby
Facebook + Ruby
Alex Koppel
 
Facebook Connect Integration
Facebook Connect IntegrationFacebook Connect Integration
Facebook Connect Integration
mujahidslideshare
 
Facebook Platform for Developers
Facebook Platform for DevelopersFacebook Platform for Developers
Facebook Platform for Developers
Lidan Hifi
 
Facebook open graph Presentation
Facebook open graph PresentationFacebook open graph Presentation
Facebook open graph Presentation
Incheol Baek
 
Iskandar Najmuddin
Iskandar NajmuddinIskandar Najmuddin
Iskandar Najmuddin
iPlatform
 
Facebook Development with Zend Framework
Facebook Development with Zend FrameworkFacebook Development with Zend Framework
Facebook Development with Zend Framework
Brett Harris
 
Facebook fql and tweepy
Facebook fql and tweepyFacebook fql and tweepy
Facebook fql and tweepyDaeMyung Kang
 
Graph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage TaipeiGraph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage Taipei
Cardinal Blue Software
 
Graph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage TaipeiGraph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage Taipei
Cardinal Blue Software
 
Mashups & APIs
Mashups & APIsMashups & APIs
Mashups & APIs
Pamela Fox
 
Backlinks Examples PR7-10
Backlinks Examples PR7-10Backlinks Examples PR7-10
Backlinks Examples PR7-10
Kieran Pitt
 
Illuminated Hacks -- Where 2.0 101 Tutorial
Illuminated Hacks -- Where 2.0 101 TutorialIlluminated Hacks -- Where 2.0 101 Tutorial
Illuminated Hacks -- Where 2.0 101 Tutorial
mikel_maron
 
Pimp My Web Page
Pimp My Web PagePimp My Web Page
Pimp My Web Page
Gage Choat
 

Similar to Facebook and its development (20)

Facebook Platform
Facebook PlatformFacebook Platform
Facebook Platform
 
Facebook API
Facebook APIFacebook API
Facebook API
 
Introduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDKIntroduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDK
 
What's New on the Facebook Platform, July 2011
What's New on the Facebook Platform, July 2011What's New on the Facebook Platform, July 2011
What's New on the Facebook Platform, July 2011
 
Node social
Node socialNode social
Node social
 
Facebook + Ruby
Facebook + RubyFacebook + Ruby
Facebook + Ruby
 
Facebook Connect Integration
Facebook Connect IntegrationFacebook Connect Integration
Facebook Connect Integration
 
Facebook Platform for Developers
Facebook Platform for DevelopersFacebook Platform for Developers
Facebook Platform for Developers
 
Facebook open graph Presentation
Facebook open graph PresentationFacebook open graph Presentation
Facebook open graph Presentation
 
Iskandar Najmuddin
Iskandar NajmuddinIskandar Najmuddin
Iskandar Najmuddin
 
Facebook Development with Zend Framework
Facebook Development with Zend FrameworkFacebook Development with Zend Framework
Facebook Development with Zend Framework
 
Facebook fql and tweepy
Facebook fql and tweepyFacebook fql and tweepy
Facebook fql and tweepy
 
Graph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage TaipeiGraph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage Taipei
 
Graph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage TaipeiGraph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage Taipei
 
Mashups & APIs
Mashups & APIsMashups & APIs
Mashups & APIs
 
Backlinks Examples PR7-10
Backlinks Examples PR7-10Backlinks Examples PR7-10
Backlinks Examples PR7-10
 
Http xayaguud
Http xayaguudHttp xayaguud
Http xayaguud
 
Illuminated Hacks -- Where 2.0 101 Tutorial
Illuminated Hacks -- Where 2.0 101 TutorialIlluminated Hacks -- Where 2.0 101 Tutorial
Illuminated Hacks -- Where 2.0 101 Tutorial
 
YQL - HackU IIT Madras 2012
YQL - HackU IIT Madras 2012YQL - HackU IIT Madras 2012
YQL - HackU IIT Madras 2012
 
Pimp My Web Page
Pimp My Web PagePimp My Web Page
Pimp My Web Page
 

More from Tao Wang

团队高效沟通的秘密
团队高效沟通的秘密团队高效沟通的秘密
团队高效沟通的秘密
Tao Wang
 
高效团队的秘密
高效团队的秘密高效团队的秘密
高效团队的秘密
Tao Wang
 
Worktile 更好用的企业协作平台
Worktile   更好用的企业协作平台Worktile   更好用的企业协作平台
Worktile 更好用的企业协作平台
Tao Wang
 
Hello, Worktile Pro
Hello, Worktile ProHello, Worktile Pro
Hello, Worktile Pro
Tao Wang
 
Windows Phone 7 in azure
Windows Phone 7 in azureWindows Phone 7 in azure
Windows Phone 7 in azureTao Wang
 
Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔Tao Wang
 
13 wp7 working with azure
13 wp7   working with azure13 wp7   working with azure
13 wp7 working with azureTao Wang
 
12 wp7 marketing windows phone applications
12 wp7   marketing windows phone applications12 wp7   marketing windows phone applications
12 wp7 marketing windows phone applicationsTao Wang
 
11 wp7 designing applicationsusingexpressionblend
11 wp7   designing applicationsusingexpressionblend11 wp7   designing applicationsusingexpressionblend
11 wp7 designing applicationsusingexpressionblendTao Wang
 
10 wp7 local database
10 wp7   local database10 wp7   local database
10 wp7 local databaseTao Wang
 
09 wp7 multitasking
09 wp7   multitasking09 wp7   multitasking
09 wp7 multitaskingTao Wang
 
08 wp7 push notification
08 wp7   push notification08 wp7   push notification
08 wp7 push notificationTao Wang
 
08 wp7 push notification
08 wp7   push notification08 wp7   push notification
08 wp7 push notificationTao Wang
 
07 wp7 application lifecycle
07 wp7   application lifecycle07 wp7   application lifecycle
07 wp7 application lifecycleTao Wang
 
06 wp7 isolation storage
06 wp7   isolation storage06 wp7   isolation storage
06 wp7 isolation storageTao Wang
 
03 wp7 application bar
03 wp7   application bar03 wp7   application bar
03 wp7 application barTao Wang
 
03 wp7 application bar
03 wp7   application bar03 wp7   application bar
03 wp7 application barTao Wang
 
05 wp7 launchers and choosers
05 wp7   launchers and choosers05 wp7   launchers and choosers
05 wp7 launchers and choosersTao Wang
 
04 wp7 pivot and panorama
04 wp7   pivot and panorama04 wp7   pivot and panorama
04 wp7 pivot and panoramaTao Wang
 
02 wp7 building silverlight applications
02 wp7   building silverlight applications02 wp7   building silverlight applications
02 wp7 building silverlight applicationsTao Wang
 

More from Tao Wang (20)

团队高效沟通的秘密
团队高效沟通的秘密团队高效沟通的秘密
团队高效沟通的秘密
 
高效团队的秘密
高效团队的秘密高效团队的秘密
高效团队的秘密
 
Worktile 更好用的企业协作平台
Worktile   更好用的企业协作平台Worktile   更好用的企业协作平台
Worktile 更好用的企业协作平台
 
Hello, Worktile Pro
Hello, Worktile ProHello, Worktile Pro
Hello, Worktile Pro
 
Windows Phone 7 in azure
Windows Phone 7 in azureWindows Phone 7 in azure
Windows Phone 7 in azure
 
Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔
 
13 wp7 working with azure
13 wp7   working with azure13 wp7   working with azure
13 wp7 working with azure
 
12 wp7 marketing windows phone applications
12 wp7   marketing windows phone applications12 wp7   marketing windows phone applications
12 wp7 marketing windows phone applications
 
11 wp7 designing applicationsusingexpressionblend
11 wp7   designing applicationsusingexpressionblend11 wp7   designing applicationsusingexpressionblend
11 wp7 designing applicationsusingexpressionblend
 
10 wp7 local database
10 wp7   local database10 wp7   local database
10 wp7 local database
 
09 wp7 multitasking
09 wp7   multitasking09 wp7   multitasking
09 wp7 multitasking
 
08 wp7 push notification
08 wp7   push notification08 wp7   push notification
08 wp7 push notification
 
08 wp7 push notification
08 wp7   push notification08 wp7   push notification
08 wp7 push notification
 
07 wp7 application lifecycle
07 wp7   application lifecycle07 wp7   application lifecycle
07 wp7 application lifecycle
 
06 wp7 isolation storage
06 wp7   isolation storage06 wp7   isolation storage
06 wp7 isolation storage
 
03 wp7 application bar
03 wp7   application bar03 wp7   application bar
03 wp7 application bar
 
03 wp7 application bar
03 wp7   application bar03 wp7   application bar
03 wp7 application bar
 
05 wp7 launchers and choosers
05 wp7   launchers and choosers05 wp7   launchers and choosers
05 wp7 launchers and choosers
 
04 wp7 pivot and panorama
04 wp7   pivot and panorama04 wp7   pivot and panorama
04 wp7 pivot and panorama
 
02 wp7 building silverlight applications
02 wp7   building silverlight applications02 wp7   building silverlight applications
02 wp7 building silverlight applications
 

Recently uploaded

Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 

Recently uploaded (20)

Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 

Facebook and its development

  • 1. ApiFacebook development by Wang Tao at Ethos / 2011-2-17
  • 2. About me @anytao in twitter A .net geek in China
  • 3. Facebook & its API overview graph Api FQL authentication current solution Other Social Network: Twitter, t.sina
  • 4. Overview Plugin FBML FB App SDK Testing
  • 6. Restful Api https://api.facebook.com/method/[name] users.hasAppPermission users.isAppUser users.getLoggedInUser Benefit Easy SOA Resource Only Http Stateless Light Weight Simple Readable Json and XML deprecated https://api.facebook.com/method/users.getInfo?uids=555020699&fields=name&access_token=…
  • 7. Graph API Simple, Consistent, and Connected
  • 9. Object user page message status message photo video http://graph.facebook.com/anytao http://graph.facebook.com/platform https://graph.facebook.com/{ID}
  • 10. Simple https://graph.facebook.com/{ID} Me https://graph.facebook.com/me/friends
  • 11. Data object as URL! Consistent All objects in Facebook can be accessed in the same way: Users: https://graph.facebook.com/btaylor (Bret Taylor) Pages: https://graph.facebook.com/cocacola (Coca-Cola page) Events: https://graph.facebook.com/251906384206 (Facebook Developer Garage Austin) Groups: https://graph.facebook.com/195466193802264 (Facebook Developers group) Applications: https://graph.facebook.com/2439131959 (the Graffiti app) Status messages: https://graph.facebook.com/367501354973 (A status message from Bret) Photos: https://graph.facebook.com/98423808305 (A photo from the Coca-Cola page) Photo albums: https://graph.facebook.com/99394368305 (Coca-Cola's wall photos) Profile pictures: http://graph.facebook.com/anytao/picture (your profile picture) Videos: https://graph.facebook.com/614004947048 (A Facebook tech talk on Tornado) Notes: https://graph.facebook.com/122788341354 (Note announcing Facebook for iPhone 3.0) Checkins: https://graph.facebook.com/414866888308 (Check-in at a pizzeria)
  • 12.
  • 13. feed
  • 14. posts
  • 18. …Objects + connections http://graph.facebook.com/anytao/picture http://graph.facebook.com/me/friends
  • 19. Json return { "data": [ { "id": "555020699_160639637289676", "message": "I agree with Reg, this makes me really proud to live in Toronto...", "picture": "http://external.ak.fbcdn.net/safe_image.php?d=ace00444e7daf6cb40d8605fae85c257&w=130&h=130&url=http%3A%2F%2Fi.ytimg.com%2Fvi%2F-KGLgDQAo5U%2F0.jpg", "link": "http://www.youtube.com/watch?v=-KGLgDQAo5U&feature=youtube_gdata_player", "source": "http://www.youtube.com/v/-KGLgDQAo5U&autoplay=1", "name": "Hoedown Throwdown", "caption": "www.youtube.com", "description": "I got off the subway at Bloor and Yonge last night, and this is what I saw; some buskers with a fiddle and a banjo were playing, and these four other guys just started to pop it and lock it, apparently just for the hell of it. It cheered me right up.", "icon": "http://static.ak.fbcdn.net/rsrc.php/zj/r/v2OnaTyTQZE.gif", "actions": [ { "name": "Comment", "link": "http://www.facebook.com/555020699/posts/160639637289676" }, { "name": "Like", "link": "http://www.facebook.com/555020699/posts/160639637289676" } ],
  • 20. Demo Every object in the social graph has a unique ID. You can access the properties of an object by requesting. https://graph.facebook.com/{ID} http://graph.facebook.com/anytao http://graph.facebook.com/anytao https://graph.facebook.com/anytao/friends?access_token=2227470867|2.0x1QCxus6HCsWaaMArPglg__.3600.1297929600-738694610|aZXed9W0Ank-2mhI73UnwIX3gYI https://graph.facebook.com/anytao/friends?access_token=2227470867|2.0x1QCxus6HCsWaaMArPglg__.3600.1297929600-738694610|aZXed9W0Ank-2mhI73UnwIX3gYI
  • 21. FQL
  • 22. Key advantages Common syntax for all methods Condense Facebook queries Reduce response size
  • 23. FQL is an SQL-like syntax SELECT name FROM user WHERE uid = 4 Has AND, OR and NOT keywords Use basic boolean operators SELECT uid2 FROM friend WHERE uid = 4 AND uid2 > (4 + 1000) Enhance queries with basic functions now() strlen()
  • 24. FQL is an SQL-like syntax substr() strpos() Example, SELECT location FROM event WHRERE eid=1234567 AND strpos(name, “facebook”) AND start_time > 10000000
  • 25. FQL: Advanced Query SELECT eid FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = 4 ) AND location = “beijing”
  • 26. FQL, not SQL No JOIN No ORDER BY No GROUP BY No LIMIT Only one table in FROM Not allowed: SELECT * FROM user, photo WHERE uid = 4
  • 27. FQL, not SQL display most recently updated events in Bejing SQL: SELECT * FROM event WHERE location = “bejing” AND user = 4 ORDER BY update_time ASC FQL: SELCT update_time, eid, name, location FROM event WHERE eid IN (SLECT eid FROM event_member WHERE uid = 4) AND location = “beijing”
  • 30. Facebook Authentication oauth 2.0 http://graph.facebook.com/anytao http://graph.facebook.com/anytao/picture <public data> http://graph.facebook.com/anytao/home?access_token= http://graph.facebook.com/anytao/feed?access_token= access_token <privatec data>
  • 32. Actors on Facebook oAuth Jacky - User Explorer - Consumer Facebook - Service Provider 1 2 3 Example
  • 33. Retrieve a request token 1 2 3 Request user authorization Exchange request token for an access token Example
  • 34. Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) OAuth Dialog (User Authentication) https://www.facebook.com/dialog/oauth?     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL
  • 35. Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) OAuth Dialog (User Authentication) https://www.facebook.com/dialog/oauth?     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream
  • 36. Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) OAuth Dialog (User Authentication) Cookie not found, show OAuthDialog(facebook layout)
  • 37. Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) OAuth Dialog (User Authentication) Goes to App Authorization directly…
  • 38. Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) Http 302 (redirect_urlparam) OAuth Dialog (User Authentication) Don’t allow! http://YOUR_URL?error_reason=user_denied&     error=access_denied&error_description=The+user+denied+your+request.
  • 39. Facebook Authentication / Server side flow Explorer try to access FB OAuth Dialog (App Authorization) Http 302 (redirect_urlparam) OAuth Dialog (User Authentication) Allow! Redirect with Authorization Code param http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER
  • 40. Facebook Authentication / Server side flow http://mydomain.com OAuth (App authorization) Request: https://graph.facebook.com/oauth/access_token https://graph.facebook.com/oauth/access_token?     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&     client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE
  • 41. Facebook Authentication / Server side flow http://mydomain.com Http 400 Failed! { "error": { "type": "OAuthException", "message": "Error validating verification code." } }
  • 42. Facebook Authentication / Server side flow http://mydomain.com HTTP 302 (redirect_url) Successful authenticated! access_tokenin the body of the request
  • 43. Facebook Authentication / Client side flow Http request HTTP 302 (redirect_url) Pass URI fragment with access_token
  • 45. Current: Data crawler Get public data at first Get friends’ public data Build popular application to link Facebook user
  • 46. Future: Data crawler provider in Cloud Design as provider Deploy and administration in Azure Get grant and permission automatically or other way
  • 47. Other Social Twitter t.Sina Linkedin
  • 48. Thanks :- ), @anytao

Editor's Notes

  1. arsort($result);array_slice($result, 0, 5);