I am trying to retrieve all my friends' likes using FQL. But I am not getting all the likes only those pages which have "is_community_page" value true are being returned. Here's my FQL query
SELECT uid, page_id FROM page_fan WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
There is a max limit of 5000 results per FQL query that Facebook imposes before the results are trimmed for Privacy preferences of users. You can read this blog post about the same.
Facebook FQL retrieve a link to have full likes list and a samples list (quite unuseful), the point is not the limit of result, the point is fql has a different approach to list this data.
I stepped into it as well, trying to find a solution atm
Related
I am trying to get all links shared by a user's friends I tried all of the queries and requests from the below questions,
How do I get a friend's links with Facebook's graph api?
Finding who shared a link publicly and finding who reshared a given link
Facebook API: All links shared by all friends?
get shared links on facebook newsfeed
but unable to figure out what would be the exact FQL or the request URL to get all links shared from my friends from a defined past interval. I am kind of a newbie with the graph API and FQL, so kindly help me in figuring out a way to do this.
I tried a simple query
SELECT link_id, owner, owner_comment, created_time, title, summary, url, image_urls FROM link WHERE owner IN (SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 100)
but I get
{
"error": "Request failed"
}
as the response from the API Explorer.
Your query is too long for FQL to construct the answer. If you'll try this:
SELECT link_id, owner, owner_comment, created_time, title, summary, url, image_urls
FROM link WHERE owner IN
(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 10)
(the same query, only limit set to 10 instead of 100) FQL explorer will think ~5-8secs but then give you back the result. Or if you will not receive the result, you have to reduce limit again.
So you have 2 choices:
You can lower you limit from 100 to 10 or less and run your query without changes
You can run query
SELECT uid2 FROM friend WHERE uid1 = me()
and then for each received friend ID run another query
SELECT link_id, owner, owner_comment, created_time, title, summary, url, image_urls
FROM link WHERE owner = FRIEND_ID
How can I get a list of profiles via Facebook Graph API or FQL ordered by their relevance to the current user just as the result I would get after a name search within Facebook?
A graph API search like /search?type=user&fields=name&q=NAME with my current access token returns an irrelevant list of NAMEs while a search within Facebook for NAME returns most probable matches for me, starting from friends, friends of friends with most mutual friends, etc.
With and FQL query like
SELECT uid, name FROM user
WHERE strpos(name, 'NAME') >=0
AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
ORDER BY mutual_friend_count DESC
I can search within my friends and get the results ordered by mutual friend count. But I want to have non-friends in the result list as well.
How can I implement a Graph or FQL search query to get a similar set of profiles ordered by relevance to the current user making the query?
Here is an example query:
SELECT uid FROM page_fan WHERE page_id IN (104266592953439, 16155433, 5768707450)
AND uid IN (SELECT uid2 FROM friend WHERE uid1=me())
This will give me the uids of friends who like either of the above three pages.
I would like a solution that lets me know how many of the pages within the above subset is liked by each friend (provided they like at least one of them). Something that can scale out to 20+ pages within the subset would be ideal.
For example, if a friend likes all 3 of the pages, listing their uid 3 times would suffice. Although I'm not sure if that is possible in FQL.
Using PHP Facebook SDK.
The Graph API doesn't have a count method, so you're going to have to do this in your script.
Change your query above to this:
SELECT uid, page_id FROM page_fan WHERE page_id IN (104266592953439, 16155433, 5768707450)
AND uid IN (SELECT uid2 FROM friend WHERE uid1=me()) ORDER BY uid
Then loop through your result and count how many times each uid appears.
I have this query:
SELECT uid, name, current_location FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ) AND current_location.id IN (Select current_location.id from user where uid = me() )
It gives me results as required i-e friends only with a particular location.
Can i get the same results using Graph API instead? assuming I have the location id.
I tried this in graph API:
me/friends?location.id='111501225536407'&fields=location
Is something of ^ sort even possible using graph API?
Not that I can see. The Graph API is best for getting all of or the most recent items of an object. If you wanted to filter those friends by location, you would need to do that on the client side.
If you want Facebook to pre-filter your results on their servers, you need to use FQL.
you can execute fql queries (including multiqueries) through the graph api like this:
https://graph.facebook.com/fql?q={"albums":"select aid, name,cover_pid FROM album where owner=me()","album_covers":"select src from photo where pid in (select cover_pid from %23albums)"}&access_token=xxxxxx
It's a little tricky with the url encoding. Be sure that "#" sign used in multiqueries is encoded as %23
Iam new to the Facebook graph api.
I want to get all the names of the pages with more then a milion likes
This is my fql:
fql?q=SELECT name FROM page WHERE fan_count > 1000000
But i don't think that this is the right way. Is there a way to get all the names of the pages that meet the fql criteria?
No, the page FQL table is indexed only on id, name and username, not on fan count, so you can't query like this