How to get the like list of open graph object? - facebook

Recently I have created several facebook like button, each of them use iframe and href to link with an open graph object url. Then url will redirect the user into the facebook apps.
But, how can I get the like list from these open graph object? I have pass the urls into fql debugger and want to get the like list, it return nothing. Then I use graph API to check my open graph object page, it return the normal data without the like array list.
So now I cannot get the user id and their name, and I still don't know why I cannot get this... I saw some webpage in the facebook sample that can get the like list. This really make me down.

Due to privacy policies, there is no real way to extract this information.
You might get the friends list who liked the link, try this
SELECT user_id FROM like WHERE object_id IN (SELECT link_id from link WHERE url = 'YOUR URL HERE') and user_id IN ( SELECT uid2 FROM friend WHERE uid1 = me() )

You can use this query to get the fan count of your page.
select fan_count from page where page_id = 'page_id'
You can't list down all the users of your page. Instead you can check if a particular user is your page's fan or not using this query.
select uid from page_fan where uid = 'user_id' and page_id = 'page_id'

Related

get user like of link using facebook api

I am trying to get user's like from a given link-
for example my link would be- "http//:www.example.org"
Now trying to get whether user has liked this link before or not.
FB.api({
method: 'fql.query',
query: "SELECT uid from object_id WHERE uid = " + user_id + "and link_id =" + page_url
}, function (rows) {
console.log(rows);
});
But this query doesn't shows undefined in console.
I want to know the way of doing this using facebook graph API reference.
Afaik you can only get Likes of Facebook Pages via the Facebook API, but not Likes of external websites. Also, keep in mind that FQL is deprecated and only available in v2.0 of the Facebook API. Which means, it will get removed when support for v2.0 runs out (2-3 years probably).
Getting the Facebook Page Likes is pretty easy though: /me/likes ... Although, you need to let Facebook review the permission in v2.0.
Upgrade guide (v1.0 > v2.0): https://developers.facebook.com/docs/apps/upgrading/
There is one way to check if a user liked something on an external website, but only right when he clicks on the Like Button: https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/v2.0
Edit: After some testing, i figured out that it is indeed possible to get the Likes. Although, i think there is a bug in FQL - You can get a list of external Likes with the following FQL query:
SELECT url, user_id FROM url_like WHERE user_id = me()
...but if you add the url to the query, the result is emtpy:
SELECT url, user_id FROM url_like WHERE user_id = me() AND url = '...'
There is a similar question on stackoverflow btw, maybe you want to take a look at the answers: Retrieve Facebook users that like a URL / web page via Open Graph

Get all facebook ids of people who like our facebook page

How can we get a list of facebook ids of all the people that like our page?
Can we write some kind of code that goes over the page and gets them?
You can't get a list of ALL the users who have liked a particular page using the Graph API or FQL.
However, you can get a count of number of users who have liked your page by using:
SELECT fan_count from page where page_id = {page_id}
And you can also check whether any of the user in your friend list has liked a particular page or not (this requires additional friends_likes permission). This can be done by using:
SELECT created_time from page_fan where
page_id = {page_id} AND uid IN (uid1, uid2, ...)
EDIT: Just found out there's already a discussion going on regarding this on Stack Overflow. Take a look at this question: Facebook API: Get fans of / people who like a page

How to use facebook api to show friends been to a place?

I am building a website with venues (for exaple cinemas) and i need to show to the user (user logged in with facebook) his/her friends that have checked in to this place.
I am using long, lat for my places. I am thinking of using a query that will bring the check ins from user;s friends, that are specified by a location center and a distance:
https://graph.facebook.com/search?type=location&center=38.01166,23.69272&distance=30&access_token=AAAAAAITEghMBAOL5MyxLDoFpRlirSFmEYYGZB7tHd8BH8YsUOW03uX4ewz6lVVPFWudujS0RZC7HdXm2r7OfVvnEgSr3KqRw4Q5WqlEeCNYm07XxyO
Is the query right? Is there any better way? How am i going to show to the venue page on my website, the users' profile pics?
What i realy need to create is something like this!(from tripbirds.com)
but i only want to show their photo not their post on that place.
http://imageshack.us/photo/my-images/13/22811412.png/
Since each place has its own page_id, you can use the checkin table and friend table to construct a query like -
select author_uid from checkin where page_id = [PLACEID_WHERE_CHECKEDIN] and author_uid in (select uid2 from friend where uid1 = me())
And once you have the friends' id, it's simple to get their info and profile pic from the user table. If you really wanted to do it in 1 query, you could enclose the above in a query like -
select pic_square from user where uid in (ABOVE-QUERY)

Getting a list of everyone that likes a link.

If I create a page, is it possible to get a list of all the people that like that page on facebook. For example, if I create http://www.facebook.com/honeybadger, as an admin can I get a list of everyone that likes it?
You can't get a list of users who like a URL or Facebook page anymore. Facebook has gone and taken the page_fan and url_like tables and made the only indexable column on these the uid field.
Trying something like this
SELECT uid FROM page_fan WHERE page_id IN (SELECT page_id FROM page WHERE username = "honeybadger")
Throws an OAuth exception: "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql"
The only thing you can do is create an app, have users authorize your app, then test if an authenticated user likes a specific page or link. If you ask for the right permissions, you can also test to see if their friends like your app.
This change was implemented to prevent spammers from harvesting Facebook IDs from their page fans or url likers.
The Facebook documentation seems to give the exact answer to your question.
https://developers.facebook.com/docs/reference/fql/like/
SELECT user_id FROM like WHERE object_id = <INSERT_FACEBOOK_OBJECT_ID_HERE>
simpler way is to get it thru graph api
https://graph.facebook.com/honeybadger/likes?access_token=valid_access_token

Retrieve Facebook users who like a URL/web page

How can I retrieve the list of Facebook users that have clicked the like button on an external site?
Say I have a like button:
<fb:like href="http://example.com/xyz"></fb:like>
I'd like a list of FB user IDs of people who have liked it.
I've tried OpenGraph:
https://graph.facebook.com/OBJECTID/likes/
(where OBJECTID is the id of the like example.com/xyz)
and FQL
select user_id from like where object_id in (
select id from object_url where url = 'http://example.com/xyz'))
but both return empty results.
I can see from other calls that the likes are counted alright, but I can't get the actual users.
Anyone know what permissions etc. I'd need to retrieve these?
Also see this question for sample code.
The simple answer is 'Its not possible to get individual user ids who liked a page'.
https://graph.facebook.com/cocacola/likes?access_token='xxxxxxxxxxxxxxxxxxxxxxx'
will surely return the data about the likes from the user/page but not the list of users who liked the specific object(in this case coca-cola). But make sure you send a proper access_token with proper permissions.
The FQL like is used to get the likes of any objects like video, note, link, photo, or album. To get liked users count of a page please use either link_stat or page from FQL.
the sample query will be like
SELECT url, normalized_url, share_count, like_count, comment_count, total_count,
commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url="facebook.com"
SELECT name, fan_count FROM page WHERE page_id = 19292868552
For more clear answers on this, please read the answer by Jonathan Dean in How to list facebook users who like a page or interest
or ifaour answer in Querying Users who 'like' my Facebook Page