Facebook: Get all "Likes" for a specific page - facebook

I am currently planning a facebook integration on our website. In the example given at the Getting Started page (http://developers.facebook.com/docs/opengraph), you can see that I like "The Rock" on Imdb. If I were Imdb, would it be possible to query the user object to get all likes on Imdb? For example would it be possible for them to build a page like "these are the films where you clicked the like button on our website"?
Thank you for your answer!

To get the likes for a page you need to do this:
use http://graph.facebook.com/
this will return a JSON object be default. Just snatch the likes property off it.
http://graph.facebook.com/wearex3 for example
But what you are asking requires you to request access to the user's data and from there get all the likes.
http://developers.facebook.com/docs/opengraph and http://developers.facebook.com/docs/guides/web are what you want to read.

Related

Facebook Graphic API 2.8: Get page posts by date/keywords?

I want to get a page's posts by facebook graphic api(2.8, without FQL),
I have page_id, so I write something like this on graphic api testing page:
{post-id}/feed?limit=100
I know facebook only allow we get 100 posts,
is there any other way to get maybe number 101~200 posts?
or setting a keywords parameters like
{post-id}/feed?limit=100&keywords=apple
or setting a date duration parameter like
{post-id}/feed?limit=100&date=20160101_20161231
I only use graphic api testing page, so if it don't have to write any other codes, it will be very nice.
Thanks
You can limit your result with until and since like this
me?fields=feed.since(2016-12-20).until(2016-12-25).limit(4)

"Top Posts" depending on facebook likes

I have an idea to create a "top posts" feature to my website, which creates the "top" list depending on how many likes and shares that a post have on facebook.
Users may see how many likes an post has received so far since they only have to ask for a single, defined url. However, the website itself has to be able to query all the links that are tied to itself (which have a predefined url template like website.com/[post-id]) to create the "top" list. Is it possible to do something similar (or achieve the same result in a different way)?
Any ideas on a real workflow about something like this will be appreciated!
this seems like a little but interesting project. I don't know if there is a feature that could get that directly in the way you want, but i did something similar.
First you have the Graph API, with that you can get the Posts of a user using feed, with that every post is telling you how many likes does it have which you can get with POST_ID/likes.
Then you'll have to check for changes in the post periodically comparing its created_time and updated_time.
This could seem very hard, because you have a lot of posts and you have to check them all for updates, but you can use batch_requests so you can check them all at once.
I have made a bookmarklet which shows top posts in the Facebook News Feed as well as Google+, Twitter and Instagram Profiles.
Just add a new bookmark in your bookmarks bar and replace its URL with the following code and save it, then go to the social network website and run it:
javascript:(function(){var s=document.createElement('script');s.src='https://niutech.github.io/topnewsfeed/topnewsfeed.min.js';document.body.appendChild(s);})()
The source code is available on GitHub.

How to get the facebook user id that likes my website (not a facebook site)

I am making a raffle within the people that had make an "I like" to a certain article of my external website (non facebook). In order to choose the winner I need to know who has made the I like.
This query:
https://api.facebook.com/method/fql.query?query=select%20like_count%20from%20link_stat%20where%20url='myWEBSITE'&format=json
Only get me the total count of I Likes but not the users ID
This query is perfect:
https://api.facebook.com/method/fql.query?query=SELECT%20user_id%20FROM%20like%20WHERE%20object_id%3D%MY_object_ID&access_token=MY_ACCESS_TOKEN
But how do I get an OBJECTID for an external url??
Thanks in advance
Object can be any thing like video, note, link, photo, or album but can not be any FB page or Url.. So I guess its not possible to get the user Id for a URL.
If you are using JS SDK / Like plugin in your website to like it, i think you can subscribe to an event and then use some ajax calls to get those userIds whenever they instantly like it.
See Somnath Muluk's answer in https://stackoverflow.com/a/13467793/269521

Like an object on Facebook outside Facebook

I've been trying to use the Like button generator to get a Like button for some content on my fan page: http://www.facebook.com/photo.php?fbid=363385833679921&set=a.314588171893021.85085.305618229456682&type=1
What I want to do is show the likes this photo got on Facebook in the like button on my site and vice versa.
This seems to work for the actual fan page url but doesn't work for individual photos (haven't tested other objects).
You are able to see the likes the object on Facebook got through the graph API call: http://graph.facebook.com/363385833679921. So shouldn't that be available on non-Facebook sites as well?
Anyone know a solution to this without having to make a custom handler to show and post likes on site?
Why don't you just use the API to read the comments and likes on the object? Any user's access token will work if that user can see the object

Facebook Like Count Discrepancies - Page vs. Button

there is a huge discrepancy between the number of likes our page has received and the number of likes displayed when using the like button, and giving it the facebook page's URL (like button is much higher). Does anyone know why this happens?
As described in the doc :
What makes up the number shown on my Like button?
The number shown is the sum of:
The number of likes of this URL
The number of shares of this URL (this includes copy/pasting a link back to Facebook)
The number of likes and comments on stories on Facebook about this URL
The number of inbox messages containing this URL as an attachment.
I am a Facebook Partner Engineer working on platform. To bring your Facebook page Likes to your web page you should use the Like Box rather than the like button. This will allow you to gain Facebook page likes from your website while also giving you the option to show your page's stream stories right in your web site.
You can find out more about the like box here:
https://developers.facebook.com/docs/reference/plugins/like-box/
I hope this helps!
Jonathan
My understanding is the like button aggregates likes, comments and other interactions.
Basically the counter next to the button isn't the like count but an activity or interaction count.
You can get the actual like count through the graph api if you need it.