Retrieving a User’s Pending Friend Requests

Problem

I need to retrieve all of the pending friend requests for a specific user using FQL.

Solution

This query will return an empty set if there are no pending requests:

SELECT uid_from FROM friend_request WHERE uid_to = $uid;

Discussion

You can run this query only for the current loggedinuser or you’ll get an “Error 604, Message: Can only lookup friend requests for logged in user” (see 600 Errors for more information).

Get Facebook Cookbook 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.