Time for action – getting a user's friends' names with AS3

We can start by getting a list of the IDs of a user's friends using the query above:

SELECT uid2
FROM friend
WHERE uid1 = «user's ID»

From earlier in the chapter, you know that we can call this API URL to get that list:

https://api.facebook.com/method/fql.query?access_token=«access_token»&format=json&query=SELECT%20page_id%20FROM%20page%20WHERE%20name%20=%20%22Facebook%22

Except, actually, that won't work. Just like when using the Graph API to access private information, you'll need to use an access token. (See Chapter 3 for a reminder of how to generate one of these.)

The correct API URL, then, is:

https://api.facebook.com/method/fql.query?access_token=ACCESS_TOKEN&format=json&query=SELECT%20page_id%20FROM%20page%20WHERE%20name%20=%20%22Facebook%22 ...

Get Facebook Graph API Development with Flash 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.