Checking for a Friend Request Between Two Users

Problem

I need to check to see whether there’s a pending friend request between two specific users using FQL.

Solution

SELECT uid_to, uid_from FROM friend_request WHERE uid_from
 = $user2 AND uid_to = $user1;

Discussion

You can run this query only when user1 is the current loggedinuser.

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.