Understanding the Fundamentals of Graph API

Facebook Graph API was announced at Facebook's F8 Conference in the spring of 2010 as an easier, simpler way to access anything on Facebook. At its simplest form, Facebook Graph API allows anyone to access data about any object on Facebook in an organized form through his or her Web browser. Data is requested by typing https://graph.facebook.com/ into the browser, followed by the name or ID of any object, followed by anything you want to retrieve about that object.

So, to retrieve my own information, I type https://graph.facebook.com/JesseStay into my Web browser, and immediately I get results similar to those shown in the following code (notice that I can also type https://graph.facebook.com/683545112 — 683545112 is my Facebook ID — and it returns the same data). To access my friends, I just need to pass https://graph.facebook.com/JesseStay/friends and I'm given a JSON-formatted list of my friends (per Facebook privacy limits, which I discuss in a bit).

image You may be asking yourself, “What is JSON?” JSON stands for JavaScript Object Notation. If you're a Perl programmer or JavaScript coder, JSON is a format that you might be familiar with — curly brackets encapsulate key-value pairs containing information (or “objects” in JavaScript). Square brackets encapsulate lists of data — these can be lists of strings, lists of objects (the curly ...

Get Facebook® Application Development For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.