Use the Facebook API and create an application that will allow me to log in and pick one of my friends and see all of our common interest and common friends.
git clone git://github.com/jwalsh/wpogfc.git
If using localhost with external linking to a non-root location a
sudo ln -s ~/sandbox/wpogfc /opt/local/html
For sandbox review this can be completed with
http://localhost/wpogfc/
assuming a symlink to the directory was provided above.
Assuming only localhost is used the default configuration should work.
http://developers.facebook.com/setup/
- Site name: wpogfc
- Site URL: http://localhost/wpogfc
- Locale: [default]
At the end of the application process you should have access to a review page like:
This should only be necessary when not using localhost.
Using jQuery for manipulating DOM elements and XHR. Underscore added for Array extras.
Use the hardcoded OAuth token from the sample page.
- http://developers.facebook.com/docs/reference/javascript/
- http://developers.facebook.com/docs/guides/web
Default to alert() just for showing the required information needed to pass to the REST call.
http://developers.facebook.com/docs/reference/rest/friends.get
{ "error": { "type": "OAuthException", "message": "(#604) Can't lookup all friends of 10720515. Can only lookup for the logged in user (1178471455), or friends of the logged in user with the appropriate permission" } }
http://developers.facebook.com/docs/reference/rest/friends.getMutualFriends
<?xml version="1.0" encoding="UTF-8"?> <friends_getMutualFriends_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true"> <uid>10732378</uid> <uid>586317678</uid> <uid>641709854</uid> <uid>710480979</uid> <uid>749820125</uid> <uid>1029541308</uid> <uid>1222026451</uid> <uid>1362995778</uid> </friends_getMutualFriends_response>
This is the deprecated REST API which initially appeared to only return XML which would have required an nginx proxy setup for all of the API calls.
On a second review of the JavaScript test console though the link provided a format parameter to specify JSON:
// Test from http://developers.facebook.com/docs/reference/javascript/FB.api var body = 'Reading Connect JS documentation'; FB.api('/me/feed', 'post', { body: body }, function(response) { if (!response || response.error) { console.error(response.error); } else { alert('Post ID: ' + response); } });