Working with Objects

At the heart of every Graph API call is an object (see Chapter 7). An object can be any number of things, such as

  • Usernames
  • User IDs
  • Event IDs
  • Photo IDs
  • Page names
  • Page IDs
  • Group IDs
  • Status message IDs
  • Note IDs
  • Check-in IDs
  • Video IDs
  • Application IDs
  • Photo album IDs

Basically, any “thing” with metadata (meaning, it contains elements and properties) about it is an object. Most of those “things” have a Globally Unique Identifier (GUID) that is unique on Facebook's database referencing back to the “thing,” what it is, and what fields are available to it. Some “things” can also be identified by a unique name, like a profile username or page username.

Accessing an object

To access an object, you simply make a Graph API call (see Chapter 7). You can make a Graph API call in your browser; if you want to, just test it out! A simple Graph API call referencing an object consists of the following items:

  • The protocol: You can make very few Graph API calls without going through Secure Sockets Layer (SSL), so you should start every Graph API request with https://. This tells your browser to encrypt the request as it goes through, and it prevents people who might be sniffing your requests from knowing what your secret key and other private information are. It's also core to OAuth 2.0 (see Chapter 9).
  • The URL: Every Graph API call should be sent to graph.facebook.com. This unique URL tells Facebook that you want to access information from the API, not the Web site. It also ...

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.