Graph api
-
Upload
milan-steskal -
Category
Technology
-
view
2.077 -
download
1
description
Transcript of Graph api
![Page 1: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/1.jpg)
Graph API
![Page 2: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/2.jpg)
SDKs & Tools
![Page 3: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/3.jpg)
Introduction
SDKs lets you access Graph API and other JavaScript SDK (Graph API, dialogs) PHP SDK (Graph API, Login) iOS SDK (SSO, Graph API, dialogs) Android SDK (SSO, Graph API, dialogs) other (ex: c#)
Tools guides and tutorials debuggers (ex: Graph API Explorer)
https://developers.facebook.com/docs/sdks/
![Page 4: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/4.jpg)
JavaScript SDK
Access Facebook server API calls from the client Graph API REST API Dialogs
Render XFBML social plugins Supports OAuth 2.0 App ID is needed to initialize the SDK
![Page 5: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/5.jpg)
Initialization <div id="fb-root"></div> <script src="//connect.facebook.net/en_US/all.js"></script> <script> FB.init({ appId : '178747652203562', status : true, cookie : true, xfbml : true, oauth : true }); </script>
![Page 6: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/6.jpg)
Platform dialogs - FB.ui() Integrate Facebook UI flow into the
application Feed Dialog Add a friend Authorize the application Buy credits Send application request Share a link
![Page 7: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/7.jpg)
Feed dialog FB.ui( { method: 'feed', name: 'Developer Community', link: 'https://www.facebook.com/event.php?eid=206539312741159', picture: 'http://blog.mist.sk/wp-content/uploads/2011/10/FacebookDevSK-thumb.jpg', caption: 'Facebook Developer Community', description: 'The first Facebook developer community meeting in Bratislava' }, function(response) { if (response && response.post_id) { alert('Post was published.'); } else { alert('Post was not published.'); } } );
![Page 8: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/8.jpg)
Feed dialog FB.ui( { method: 'feed', name: 'Developer Community', link: 'https://www.facebook.com/event.php?eid=206539312741159', picture: 'http://blog.mist.sk/wp-content/uploads/2011/10/FacebookDevSK-thumb.jpg', caption: 'Facebook Developer Community', description: 'The first Facebook developer community meeting in Bratislava' }, function(response) { if (response && response.post_id) { alert('Post was published.'); } else { alert('Post was not published.'); } } );
![Page 9: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/9.jpg)
Feed dialog FB.ui( { method: 'feed', name: 'Developer Community', link: 'https://www.facebook.com/event.php?eid=206539312741159', picture: 'http://blog.mist.sk/wp-content/uploads/2011/10/FacebookDevSK-thumb.jpg', caption: 'Facebook Developer Community', description: 'The first Facebook developer community meeting in Bratislava' }, function(response) { if (response && response.post_id) { alert('Post was published.'); } else { alert('Post was not published.'); } } );
![Page 10: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/10.jpg)
Application request FB.ui( { method: 'apprequests', message: 'Check the Bratislava Facebook Community meeting demo app' }, function(response) { // handle callback console.log(response); } );
![Page 11: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/11.jpg)
Application request FB.ui( { method: 'apprequests', message: 'Check the Bratislava Facebook Community meeting demo app' }, function(response) { // handle callback console.log(response); } );
![Page 12: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/12.jpg)
Application request FB.ui( { method: 'apprequests', message: 'Check the Bratislava Facebook Community meeting demo app' }, function(response) { // handle callback console.log(response); } );
![Page 13: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/13.jpg)
User Authentication
Register to the website using Facebook or get the permissions for the app FB.login() FB.logout() FB.getLoginStatus() FB.getAuthResponse()
Advantages sharing logged in user state registration flow on the website isn't needed get access to the user's social graph
![Page 14: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/14.jpg)
Login user FB.login( function(response) { if (response.authResponse) { console.log('Welcome! Fetching your information.... '); FB.api('/me', function(response) { console.log('Good to see you, ' + response.name + '.'); }); } else { console.log('User cancelled login or did not fully authorize.'); } }, {scope: 'email'});
![Page 15: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/15.jpg)
Login user FB.login( function(response) { if (response.authResponse) { console.log('Welcome! Fetching your information.... '); FB.api('/me', function(response) { console.log('Good to see you, ' + response.name + '.'); }); } else { console.log('User cancelled login or did not fully authorize.'); } }, {scope: 'email'});
![Page 16: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/16.jpg)
Demo
https://apps.facebook.com/bratislava-developer/
![Page 17: Graph api](https://reader033.fdocuments.in/reader033/viewer/2022061209/5485afc75806b5a9588b47be/html5/thumbnails/17.jpg)
Milan STESKAL
@milansteskal @facebookDevSk facebook.com/groups/188066214578728/