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
Related
Is there a way by which we can group user’s facebook likes based on the category of the pages, when I request from Graph API /[user-id]?fields=likes what I get is array of user’s likes in reverse chronological order. I need to group these likes based on the page’s category like Entertainer, Comedians, Celebrity, Artist, Actor/Director, etc categories should be grouped in a one category (say Personalities) and other pages like TV Show, Movie, TV Series, etc to be grouped in other category (let’s say Movies)
No, you would have to do any sorting on your own, after getting all the entries. You can use paging to get all entries: https://developers.facebook.com/docs/graph-api/using-graph-api/#paging
Since FQL is deprecated and gonna be removed, are there graph api ways to get:
the profile photos album photos on a single request, like:
SELECT owner, src_big, images FROM photo WHERE aid IN (SELECT aid FROM album WHERE type="profile" AND owner=USERID
traverse all the users photos on a single location/endpoint like:
SELECT pid, src_big, images FROM photo WHERE owner=USERID
me/photos/uploaded?fields=id,images,source is your best bet with pagination
Ok, so I had the same problem and using field expansion this is the best I found:
https://graph.facebook.com/me?fields=albums.limit(1).fields(name,photos.fields(name,picture,source,images))
Im assuming the first album is the profile pictures...
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
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
I need to find a profile in a specific town or nation, but I just
found a way to get profiles by checking locale column in my Facebook
query. Is it possible to retrieve a user id and link with town and
other location information, but is it not possible to retrieve
profiles by town?
Using the Facebook API, it is not possible to query by locale since it's not indexed (see: http://developers.facebook.com/docs/reference/fql/user/ and look for column names with a * star). According to the documentation the only columns you can search on with the API is uid, username, and name.
If you only want to query over the friends associated with the provided access token, you can do this FQL query:
query = {}
# first get friends which have provided a current location
query['friends'] = "SELECT uid, name, current_location FROM user \
WHERE uid IN (SELECT uid1 FROM friend WHERE uid2=me()) \
AND current_location"
# then get the latlongs corresponding to their current location
query['latlong'] = "SELECT page_id, latitude, longitude FROM place \
WHERE page_id IN (SELECT current_location.id FROM #friends)"
You can use this information to assign a latlong to each friend. The filtering must be done client-side ... I don't think there is another way.
NOTE: Of course this needs the friends_location permission.
Using the Graph API, you can search profiles using text place names like so:
https://graph.facebook.com/search?q=new%20york&type=user&access_token=???
(Replace ??? with your current access_token.)
Not clear to me exactly what profile text is matched against, so you may end up finding people that have a name similar to your search query or that are just talking about a place. Best to check the users specified location as a second filter. Hope that helps.