SlideShare uma empresa Scribd logo
1 de 43
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

Mais conteúdo relacionado

Mais procurados

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 2011Iskandar 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 standardsGlenn Jones
 
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
 

Mais procurados (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'
 

Destaque

Facebook Development for Beginners
Facebook Development for BeginnersFacebook Development for Beginners
Facebook Development for BeginnersJesse 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 Safelyhewie
 
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 canvasSusheel 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 2013André L. Campino
 
SWOT and PESTLE analysis of Facebook
SWOT and PESTLE analysis of FacebookSWOT and PESTLE analysis of Facebook
SWOT and PESTLE analysis of FacebookMouad Gouffia
 
Business Strategy Analysis on Facebook
Business Strategy Analysis on FacebookBusiness Strategy Analysis on Facebook
Business Strategy Analysis on FacebookShanker Naik
 
Facebook Analysis and Study
Facebook Analysis and StudyFacebook Analysis and Study
Facebook Analysis and StudyOuriel Ohayon
 
Venture Design Workshop: Business Model Canvas
Venture Design Workshop: Business Model CanvasVenture Design Workshop: Business Model Canvas
Venture Design Workshop: Business Model CanvasAlex Cowan
 

Destaque (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
 

Semelhante a Facebook and its development

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 SDKColin 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 2011Iskandar Najmuddin
 
Node social
Node socialNode social
Node socialorkaplan
 
Facebook Connect Integration
Facebook Connect IntegrationFacebook Connect Integration
Facebook Connect Integrationmujahidslideshare
 
Facebook Platform for Developers
Facebook Platform for DevelopersFacebook Platform for Developers
Facebook Platform for DevelopersLidan Hifi
 
Facebook open graph Presentation
Facebook open graph PresentationFacebook open graph Presentation
Facebook open graph PresentationIncheol Baek
 
Iskandar Najmuddin
Iskandar NajmuddinIskandar Najmuddin
Iskandar NajmuddiniPlatform
 
Facebook Development with Zend Framework
Facebook Development with Zend FrameworkFacebook Development with Zend Framework
Facebook Development with Zend FrameworkBrett 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 TaipeiCardinal Blue Software
 
Graph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage TaipeiGraph API - Facebook Developer Garage Taipei
Graph API - Facebook Developer Garage TaipeiCardinal Blue Software
 
Mashups & APIs
Mashups & APIsMashups & APIs
Mashups & APIsPamela Fox
 
Backlinks Examples PR7-10
Backlinks Examples PR7-10Backlinks Examples PR7-10
Backlinks Examples PR7-10Kieran 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 Tutorialmikel_maron
 
Pimp My Web Page
Pimp My Web PagePimp My Web Page
Pimp My Web PageGage Choat
 

Semelhante a 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
 

Mais de Tao Wang

团队高效沟通的秘密
团队高效沟通的秘密团队高效沟通的秘密
团队高效沟通的秘密Tao Wang
 
高效团队的秘密
高效团队的秘密高效团队的秘密
高效团队的秘密Tao Wang
 
Worktile 更好用的企业协作平台
Worktile   更好用的企业协作平台Worktile   更好用的企业协作平台
Worktile 更好用的企业协作平台Tao Wang
 
Hello, Worktile Pro
Hello, Worktile ProHello, Worktile Pro
Hello, Worktile ProTao 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
 

Mais de 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
 

Último

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Último (20)

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

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

Notas do Editor

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