I have a problem. I am using fql to get user information. I want to take the pages the user has liked.
https://developers.facebook.com/docs/reference/fql
I have been investigating all tables, but I have not seen what I wanted.
If you know how can I do it, that would be fantastic.
Thank you!!
You want the page_fan table
https://developers.facebook.com/docs/reference/fql/page_fan
uid should be an indexable field
here's a sample FQL query to get you started
select page_id,name from page where page_id in (select page_id from page_fan where uid=me())
https://developers.facebook.com/tools/explorer?fql=select%20page_id%2Cname%20from%20page%20where%20page_id%20in%20(select%20page_id%20from%20page_fan%20where%20uid%3Dme())
Related
As mentioned above, I want to get name and page_URL(website) on People Also Like list using FQL OR Facebook Graph API.
I was making some Query for FQL such as:
select page_id, name, username, page_url, website from page where page_id in (select page_id from page_fan where uid= "")
But it gives Liked by this page not for People Also like
Please give me your kind advices for getting People Also Like lists.
Is it possible to get all liked movie pages via FQL?
The most stable way currently to get the names of the pages not necessarily the ids would be to run a query on the user table. page_fan returns little to no results even though the user may have numerous pages likes of type Movie.
SELECT movies from user where uid=me() and movies != ''
or for all friends
SELECT movies from user where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and movies != ''
There is currently no way to get all like movie pages of a user (in terms of ids) via FQL.
Update: I jumped the gun.
This should work
SELECT name, page_id from page where page_id in (SELECT page_id from page_fan where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and profile_section='movies')
Though it's still unstable and doesn't return all matches >.<
Yes it is. Check out the Graph API Explorer. You can run FQL statements on the page_fan table from there. You'll need to require the user_likes permission and then parse out the movie entries. that field is not index.
yes, just query the FQL page_fan table http://developers.facebook.com/docs/reference/fql/page_fan/ with the correct permissions.
I've been digging on Stackoverflow for hours now and found no solution:
I want to get pages that a user liked using the page_fan table.
However, that user is not my friend - is it possible? I think it might be because when i go the user's profile I can see all the pages he liked but not using FQL...Any advice?
Tnx.
Shai.
Yes, that is possible as long as the user gave your app "user_likes" permission. See very beginning of below page:
http://developers.facebook.com/docs/reference/fql/page_fan/
query:
SELECT name, about, description, keywords, pic_cover, pic_large FROM page
WHERE page_id
IN (
SELECT page_id FROM page_fan
WHERE uid =me()
)
This query will return data for each of the pages a user that is using your app has liked.
I'm trying to grab the Facebook pages that my friends liked.
SELECT uid,page_id,type,profile_section,created_time FROM page_fan WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
I noticed that some data is missing from the result set, therefore I queried the table for individual user ids, as follows:
SELECT uid,page_id,type,profile_section,created_time FROM page_fan WHERE uid={id1}
SELECT uid,page_id,type,profile_section,created_time FROM page_fan WHERE uid={id2}
...
Apparently for some friend ids is working, but for some others the query returns empty result.
I thought that maybe those missing users have some privacy settings not allowing apps to pull data from their accouns.
Any thoughts?
Are you using a valid access token when making this request?
If you look at the documentation for the page_fan table it explains what access tokens are needed
https://developers.facebook.com/docs/reference/fql/page_fan/
To read the page_fan table you need:
any valid access_token if it is public (visible to anyone on
Facebook).
user_likes permissions if querying the current user.
friends_likes permissions if querying a user's friend.
I'm trying to replicate the results of the graph api call:
graph.facebook.com/[fbid]/likes
using FQL so that I can obtain the likes of multiple people using a single call. Anyone know if this is possible / how to do it?
FQL can supposedly support multiqueries. Check out this page:
FQL Multiquery
which says:
"query2":"SELECT name, url, pic FROM profile WHERE id IN (SELECT uid FROM #query1)"
You can use SELECT page_id,name FROM page WHERE page_id IN (SELECT page_id FROM page_fan WHERE uid in (....). Hope this was helpful. I found the answer in this discussion. Since this was one of the first pages I came across, I thought I should link it to the answer