$fql = "SELECT link_id, owner, created_time, title, summary, url, image_urls FROM link WHERE owner IN (select uid2 from friend where uid1 = me() LIMIT 20) AND created_time >= $_7ago";
The above query works great. However, when I increase the LIMIT from 20 to, say 21 or anything higher, I get an error and the query returns Null. I am looking to query Links shared by ALL friends. Thanks.
That query takes forever to execute. Just testing it a few times in the Graph API explorer, even getting the links from 20 friends takes > 28 seconds. As I’m writing this, I’ve got a query running for 100 friends. We’ll see if it completes before I do.
It looks like if you want to get all the links shared by all friends, you’ll need to break this query up into smaller chunks and repeat it multiple times.
I might structure it like this to get your closest friend’s links first, and then dig deeper for people who have less in common with you:
You’d increment
$offsetin multiples of 20.This is best done as an asynchronous query where you’ll get the initial results quickly and others will fill in as they become available. It’s going to take a LONG time to get all these results.
(100 Friends query still hasn’t returned results after 5 mins.)
BTW, don’t forget to mark your questions as resolved.