Facebook API FQL API to get actor name as well as id
I am making an FQL request using the PHP API PHP, for example:
$stream = $this->facebook->api('fql', array( "q" => "SELECT post_id, actor_id, message, description, description_tags, type, attachment FROM stream WHERE filter_key in ( SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed' ) AND is_hidden = 0" ));
This gives me the user's news feed. However, this will only give me an ID
- I need the name of the actor. (Actor, I mean the author of the news feed story.)
I understand that I will need to query the API again to get the name. How can I accomplish such a multiscreen? Using this example, how can I get the name of the actor?
The main reaction of most people was to offer multiple requests. However, I am not suggesting this for the following reason: perhaps you can already find out the actor's name.
Let's say you make a lot of these calls to get stream items (one of my production apps does and I got this encoding as I describe). What you don't want to do is overload the API and make Facebook unhappy with your App ID and start decreasing call limits!
So what you can do is cache (using memcached, web application cache, database, or whatever) the username (since the name for id rarely changes for the transfer id) based on actor_id. It is also useful for finding to / from ids for other facebook fql objects like comments, comments, etc.
source to share