Getting user likes and friends likes by category - facebook-graph-api

I need to get a user's music and movie likes, and a user's friends music and movie likes. Is there a way to add to the following query the category name?
https://graph.facebook.com/me/likes
https://graph.facebook.com/likes?ids=id1,id2...
I tried adding &category=Musician%2fband but that doesn't work.
Does anyone have an idea of how it can be done?
Thanks
JD

Try using FQL (http://developers.facebook.com/docs/reference/fql/page_fan/ and http://developers.facebook.com/docs/reference/fql/page/)
fql?q=SELECT page_id,type, description FROM page WHERE page_id IN (SELECT uid, page_id, type FROM page_fan WHERE uid=me()) AND type='musician/band'
EDIT
Since August 17, 2016, FQL is no longer available and cannot be queried.

Related

Graph api equivalent for some FQL features

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...

Getting all links of any sort shared by a user's facebook friends

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

FQL does not give all the Friends likes

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

Facebook Graph-Api: Get name of pages

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

How to get a real-size profile picture from a user?

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?