Blog


Facebook Graph API - Project

| 0 comments | facebook

I have managed to crack the OAuth thing that Facebook has taken up to authenticate web apps calling their new Graph API. I found it quite simple actually.

Before you can make restricted requests, you need to be first issued with an auth_token. To get one you need to send a request to:

https://graph.facebook.com/oauth/authorize?client_id=YOUR_APP_ID&redirect_uri=YOUR_APP_URL&scope=LIST_OF_OBJECTS

LIST_OF_OBJECTS is where you comma delimit the list of things you will want to access (ie events,photos,email etc). The call returns a code which you then use along with your secret to retrieve the auth_token

http://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&redirect_uri=YOUR_APP_URL&client_secret=YOUR_APP_SECRET&code=THE_CODE

The auth_token is then returned along with an expiry countdown in seconds. This can then be added to any API calls for which you need permission.

I have used just one PHP script to do everything. It just checks if its receiving instructions by the user to make a call as a GET variable else goes along through the authentication procedure until an auth_token is set

Feel free to test it out over at dyl.anjon.es/musicwall


Recipe - Nachos

| 0 comments | recipe

Ingredients:

Crisps (Dorito style)Plate Full
Chopped Tomatoes1 Tin
CheeseQuite a lot grated
Whole Pepper1 sliced (green best)
Chilli Powder5 Pinches
  1. Heat a frying pan and add sliced pepper
  2. Add chopped tomatoes and chilli powder
  3. Keep stiring and keep on medium heat until simmering
  4. Put a covering of crisps on a plate and add the first layer of salsa
  5. Add a layer of grated cheese
  6. Keep layering in this order until ingredients have run out - crisps, salsa, cheese
  7. Place in microwave a d put on high heat for 45 seconds or until cheese has melted
  8. ENJOY YOUR NACHOS!!


Facebook Graph - Creating a Social Web

| 0 comments | facebook

Last week, Facebook announced some interesting things at their F8 conference. Their BIG plan for the world is to make it a more social and personalized web. With this in mind they have released a few tools to help the world.

Starting first with their big initiative, the Graph API which is the foundation of the new API.

This is a fantastically easy way to get machine readable (JSON) real-time information from FB. An example:
http://graph.facebook.com/dylanjamesvernonjones

{ "id": "512982904", "name": "Dylan Jones", "first_name": "Dylan", "last_name": "Jones", "link": "http://www.facebook.com/dylanjamesvernonjones" }

You get some basic information on me. You can delve deeper into my life by getting my news feed by calling :
http://graph.facebook.com/dylanjamesvernonjones/feed

{ "data": [ { "id": "512982904_427382302904", "from": { "name": "Dylan Jones", "id": "512982904" }, "message": "And thats the end of that chapter! (that chapter is maths by the way)", "icon": "http://photos-f.ak.fbcdn.net/photos-ak-sf2p/v43/53/146139331013/app_2_146139331013_1286.gif", "attribution": "TweetDeck for iPhone", "actions": [ { "name": "Get TweetDeck", "link": "http://www.tweetdeck.com" } ], "created_time": "2010-04-30T10:01:30+0000", "updated_time": "2010-04-30T10:01:30+0000", "likes": 2 }, { "id": "512982904_119487514744084", "from": { "name": "Dylan Jones", "id": "512982904" }, "message": "Whats that coming over the hill, is it a monster, is it a monster?", "created_time": "2010-04-29T21:14:12+0000", "updated_time": "2010-04-29T21:14:12+0000", "likes": 2 . . . . . . . . . . . .

Using OAuth 2.0 as authentication, you can get more data, if not everything you could possibly want from events, friends, likes etc. More information is available from the documentation on Facebook's Developers site.

I have already put to use this graph API to cache my public facebook messages on my database for inclusion in my live feed on this site located at: me.dylanjones.info For this I just use the json_decode() function in PHP.

Facebook also announced other things such as social plugins inluding their plan to get a 'Like' button on every page online. Some extra metadata is required for web pages to describe content to facebook, rather than using existing protocols - I did try this on dylanjones.info but it is not valid html so I removed it hastily.

More thoughts and uses for the new Facebook Platform later today.