Reviews
Facebook DevelopmentAPI Test Console
The Facebook Platform Elements
You'll find that the API Test Console has a number of fields:
- User ID—A read- only field which (when you're logged on to Facebook) unsurprisingly displays your user ID number.
- Response Format—With this, you can select the type of response that you want, and this can be:
- XML
- JSON
- Facebook PHP Client
- Callback—If you are using XML or JSON, then you can encapsulate the response in a function.
- Method—The actual Facebook method that you want to test.
Once you've logged in, you'll see that your User ID is displayed, and that all the drop-downs are enabled:

You will also notice that a new link, documentation, appears on the screen, which is very useful. All you have to do is to select a method from the drop-down list, and then click on documentation. Once you've done that you'll see:
- A description of the method
- The parameters used by the method
- An example return XML
- A description of the expected response.
- The FQL equivalent (we will discuss this later in the chapter.)
- Error codes
For now, let's just change the Response Format to Facebook PHP Client, and then click on Call Method to see what happens:

In this case, you can see that the method returns an array of user ids—each one being the ID of one of the friends of the currently logged in user (that is your list of friends because you're the person logged in). You could, of course, go on to use this array in PHP as part of your application, but don't worry about that at the moment. We'll see how to use the methods in a real application, in Chapter 2. For the time being, we'll just concentrate on working with our prototyping in the test console.
However, before we move on, it's worth noting that you can obtain an array of friends only for the currently logged in user. You can't obtain the list of friends for any other user. So, for example, you would not be able to use friends.get on id 286601116 or 705175505. In fact, you wouldn't be able to use friends.get for 614902533 (as shown in the example) because that's my ID and not yours.
On the other hand, having obtained a list of valid IDs we can now do something more interesting with them. For example, we can use the users.getinfo method to obtain the first name and birthday for particular users:

As you can see, a multidimensional array is returned to your PHP code (if you were actually using this in an application).Therefore, for example, if you were to load the array into a variable $birthdays, then $birthdays[0][birthday] would contain January 27, 1960.
Of course, in the above example, the most important piece of information is the first birthday in the array—record that in your diary for future reference. And, if you're thinking that I'm old enough to be your father, well, in some cases this is actually true:

Now that you've come to grips with the API Test console, we can turn our attention to FBML and the FBML Test Console.
Facebook Development
- Learning Facebook Application Development
- Getting to Grips with the Facebook Platform
- The Facebook Platform Elements
- Facebook Markup Language - FBML
- Facebook Query Language - FQL
- Obtaining the Facebook Client Libraries
- Adding Facebook Developer Application
- Setting Up Facebook Application
- Facebook Integration Points







