
Time for action - loading a Page
Browse to http://www.facebook.com/PacktPub to load Packt Publishing's Facebook Page. You'll see a list of recent wall posts, an Info tab, some photo albums (mostly containing book covers), a profile picture, and a list of fans and links.

That's how website users view the information. How will our code "see" it? Take a look at how the Graph API represents Packt Publishing's Page by pointing your web browser at https://graph.facebook.com/PacktPub. This is called a Graph URL—note that it's the same URL as the Page itself, but with a secure https
connection, and using the graph
sub domain, rather thanwww.
What you'll see is as follows:
{ "id": "204603129458", "name": "Packt Publishing", "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/ hs302.ash1/23274_204603129458_7460_s.jpg", "link": "http://www.facebook.com/PacktPub", "category": "Products_other", "username": "PacktPub", "company_overview": "Packt is a modern, IT focused book publisher, specializing in producing cutting-edge books for communities of developers, administrators, and newbies alike.\n\nPackt published its first book, Mastering phpMyAdmin for MySQL Management in April 2004.", "fan_count": 412 }
What just happened?
You just fetched the Graph API's representation of the Packt Publishing Page in your browser.
The Graph API is designed to be easy to pick up—practically self-documenting—and you can see that it's a success in that respect. It's pretty clear that the previous data is a list of fields and their values.
The one field that's perhaps not clear is id
; this number is what Facebook uses internally to refer to the Page. This means Pages can have two IDs: the numeric one assigned automatically by Facebook, and an alphanumeric one chosen by the Page's owner. The two IDs are equivalent: if you browse to https://graph.facebook.com/204603129458, you'll see exactly the same data as if you browse to https://graph.facebook.com/PacktPub.
Have a go hero - exploring other objects
Of course, the Packt Publishing Page is not the only Page you can explore with the Graph API in your browser. Find some other Pages through the Facebook website in your browser, then, using the https://graph.facebook.com/id format, take a look at their Graph API representations. Do they have more information, or less?
Next, move on to other types of Facebook objects: personal profiles, events, groups. For personal profiles, the id
may be alphanumeric (if the person has signed up for a custom Facebook Username at http://www.facebook.com/username/), but in general the id
will be numeric, and auto-assigned by Facebook when the user signed up.
For certain types of objects (like photo albums), the value of id
will not be obvious from the URL within the Facebook website; we'll look at how to find these later in the chapter.
In some cases, you'll get an error message, like:
{ "error": { "type": "OAuthAccessTokenException", "message": "An access token is required to request this resource." } }
Again, we'll look at what this means and how to get around it later in the book.