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...
Related
I'm trying to know if a user liked a URL. I followed the facebook documentation in https://developers.facebook.com/docs/reference/fql/url_like. I had no problem to get all likes by user_id using the query bellow:
select user_id, url from url_like where user_id=me()
The result of this FQL is a list of URLs liked by the user. The problem occours when i add to WHERE clause the URL parameter like this:
select user_id, url from url_like where user_id=me()and url='http://www.climatempo.com.br/previsao-do-tempo/cidade/321/riodejaneiro'
the result is an empty list, but the result appears in the first list.
Any idea?
P.S I tested using graph api explorer: https://developers.facebook.com/tools/explorer
thanks!
What do you want to fetch. As the url_like table contains only two columns and if you query using both columns in where clause, it does not make any sense.
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
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
Having a User ID xUID, i know I can get a profile picture this way:
http://graph.facebook.com/xUID/picture?type=large
The problem is that the picture returned from that URL is not the real size (it's about 200px wide).
I need to get that user picture, but real size.
What i've done so far is:
1. Getting the user albums
https://graph.facebook.com/me/albums?access_token=xToken
2. Iterating on that, and getting the album that have the type="profile".
3. With that Album ID (xAID) I can construct a FQL query:
SELECT pid, object_id, src_big FROM photo WHERE album_object_id = xAID
4. And getting the profile pictures there.
5. I need to iterate and find the lastone uploaded by the user.
So, this process is complex and time consuming. Is there any better/simpler/faster way to acomplish this?
Thanks a lot!
http://graph.facebook.com/xUID/picture?width=720&height=720
You need to perform only one FQL query:
SELECT pid, object_id, src_big
FROM photo
WHERE object_id IN
(SELECT cover_object_id
FROM album
WHERE owner=me() AND type="profile")
src_big will contain link to profile original source.
If you need to get specific user's profile picture please change me() with specific user id.
Ok, just did as the question said. Browse the Albums, and getting the first profile picture from there.
The answer from Julio doesn't work becouse it's not possible to include "type" on a WHERE clause, becouse it's not an indexable column.
The cover photo also isn't always the most recent photo, as of a few days ago.
Get cover_object_id:
fql?q=SELECT cover_object_id, type FROM album WHERE owner="userid" AND type="profile"
Get src_big:
fql?q=SELECT pid, object_id, src_big FROM photo WHERE object_id="cover object id obtained above"
img src="src_big obtained above"
This helps in something?