Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook FQL - How do I fetch the posts I made to a friend's wall

I have a facebook desktop app with some test users all having granted the stream_read & offline access permissions. I can easily retrieve posts to each users' stream & profile. What I cannot do easily is retrieve posts that a user has made to one of their friend's walls.

In fact, this used to work with a rather complex multiquery, but has stopped working now, or is working only intermittently...

Does anyone care to share their method if one exists or discuss what restrictions there might be to this type of complex querying?

like image 615
simianarmy Avatar asked Mar 21 '10 00:03

simianarmy


1 Answers

I gave this a try and ran into the same problem I belive but perhaps I can help explain it a little more.

It might be something worth posting in the Facebook wiki talkpage and see if someone from Facebook can shed some light on it unless I'm missing something here.

Anywhere I put USER_ID would need to be filled in with the user you want to search as and F_ID1, F_ID2 are friends ...

FQL #1: should work (in theory)

  • First get a list of all your friends
  • then use that list in the IN clause of the next query
  • filter out to just posts made by the USER_ID
  • make sure the message isn't NULL

FQL #1: No posts are returned

{
"friends":"SELECT uid2 FROM friend WHERE uid1= USER_ID ",

"postsonfriendswall":"SELECT source_id, actor_id, target_id, message FROM stream WHERE source_id IN (SELECT uid2 FROM #friends) AND message != '' AND actor_id = USER_ID "

}

FQL #2: Posts are returned

Strangely however if you limit to just one friend (F_ID1), you will get back posts USER_ID made to their friends wall!

{
"friends":"SELECT uid2 FROM friend WHERE uid1= USER_ID ",

"postsonfriendswall":"SELECT source_id, actor_id, target_id, message FROM stream WHERE source_id IN (SELECT uid2 FROM #friends WHERE uid2 = F_ID1) AND message != '' AND actor_id = USER_ID "

}

FQL #3: No posts are returned

Yet, try to add another friend to the IN F_ID1 & F_ID2 ... no result again ...

{
"friends":"SELECT uid2 FROM friend WHERE uid1= USER_ID ",

"postsonfriendswall":"SELECT source_id, actor_id, target_id, message FROM stream WHERE source_id IN (F_ID1,F_ID2) AND message != '' AND actor_id = USER_ID "

}
like image 68
Justin Jenkins Avatar answered Jan 04 '23 14:01

Justin Jenkins